After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 161661 - [PATCH] screenshots via gstreamer
[PATCH] screenshots via gstreamer
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins
git master
Other All
: Normal enhancement
: 0.8.9
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2004-12-18 23:19 UTC by Lutz Mueller
Modified: 2005-05-18 22:15 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
screenshotsrc/Makefile.am (376 bytes, text/plain)
2004-12-18 23:20 UTC, Lutz Mueller
  Details
screenshotsrc/gstscreenshotsrc.c (18.66 KB, text/plain)
2004-12-18 23:21 UTC, Lutz Mueller
  Details
screenshotsrc/gstscreenshotsrc.h (2.38 KB, text/plain)
2004-12-18 23:21 UTC, Lutz Mueller
  Details
screenshotsrc/screenshot-utils.c (13.04 KB, text/plain)
2004-12-18 23:22 UTC, Lutz Mueller
  Details
screenshotsrc/screenshot-utils.h (429 bytes, text/plain)
2004-12-18 23:22 UTC, Lutz Mueller
  Details
screenshotsrc/README (455 bytes, text/plain)
2004-12-18 23:23 UTC, Lutz Mueller
  Details
Updated plugin (8.28 KB, application/x-compressed-tar)
2004-12-20 09:59 UTC, Lutz Mueller
  Details
Updated plugin (11.60 KB, application/x-compressed-tar)
2005-04-20 19:25 UTC, Lutz Mueller
  Details
Updated plugin (11.82 KB, application/x-compressed-tar)
2005-04-21 20:41 UTC, Lutz Mueller
  Details
updated patch (16.49 KB, patch)
2005-05-18 20:21 UTC, Luca Ognibene
committed Details | Review
Updated plugin (23.23 KB, application/x-compressed-tar)
2005-05-18 22:01 UTC, Lutz Mueller
  Details

Description Lutz Mueller 2004-12-18 23:19:49 UTC
There is currently no possibility to get screenshots via gstreamer. Patch to
follow soon...
Comment 1 Lutz Mueller 2004-12-18 23:20:57 UTC
Created attachment 34980 [details]
screenshotsrc/Makefile.am
Comment 2 Lutz Mueller 2004-12-18 23:21:31 UTC
Created attachment 34981 [details]
screenshotsrc/gstscreenshotsrc.c
Comment 3 Lutz Mueller 2004-12-18 23:21:59 UTC
Created attachment 34982 [details]
screenshotsrc/gstscreenshotsrc.h
Comment 4 Lutz Mueller 2004-12-18 23:22:23 UTC
Created attachment 34983 [details]
screenshotsrc/screenshot-utils.c
Comment 5 Lutz Mueller 2004-12-18 23:22:48 UTC
Created attachment 34984 [details]
screenshotsrc/screenshot-utils.h
Comment 6 Lutz Mueller 2004-12-18 23:23:07 UTC
Created attachment 34985 [details]
screenshotsrc/README
Comment 7 Stephane Loeuillet 2004-12-18 23:53:30 UTC
hum, screenshotsrc ???? it should be a SINK

when providing a new plugin, please, follow one of the following :
  1) attach a tarball containing all the files
  2) attach a diff against latest release(or better, CVS) with the -N option

what about 'pngenc' ? (AFAIK, it can already do this work)
and what about 'snapshot' ?

plus it was implemented in totem lately :

2004-10-08  Ronald S. Bultje  <rbultje@ronald.bitfreak.net>

	* src/Makefile.am:
	* src/bacon-video-widget-gst.c: (bacon_video_widget_signal_idler),
	(got_video_size), (caps_set), (state_change),
	(bacon_video_widget_can_get_frames), (destroy_pixbuf),
	(bacon_video_widget_get_current_frame), (bacon_video_widget_new):
	* src/gstscreenshot.c: (bvw_frame_conv_base_init),
	(bvw_frame_conv_class_init), (bvw_frame_conv_init),
	(bvw_frame_conv_get), (bvw_frame_conv_put),
	(bvw_frame_conv_convert):
	* src/gstscreenshot.h:
	* src/totem-video-thumbnailer.c: (main):
	  Screenshots and thumbnailing for GStreamer backend.

so, please told us what are the good and the bad of your plugin compared to those

sorry if this comment looks a bit negative, and thanks for contributing
Comment 8 David Schleef 2004-12-19 01:05:51 UTC
Did you even bother reading the README?

The idea is interesting, but the implementation (using gdk, gtk, gdk_pixbuf, and
Xlib calls) leaves a lot to be desired.  Something like this should be
preferably be straight Xlib.
Comment 9 Lutz Mueller 2004-12-19 07:56:28 UTC
Hello!

Thanks for you comments.

Ronald: screenshotsrc is actually nearly a 1:1 copy of videotestsrc and provides
(like videotestsrc) a stream of images (screenshots). 

David: Which README? I read gst-plugins/README and gstreamer/README, but there
doesn't seem to be a not in about not using gdk or gdk-pixbuf. I admit that I
have been missing a file gst-plugins/HACKING explaining coding style etc...
Comment 10 Lutz Mueller 2004-12-20 09:59:03 UTC
Created attachment 35036 [details]
Updated plugin

Excerpt from the README:

(1) What is all about?

This plugin returns screenshots, continuously.

(2) Does it work? 

For me, yes. I used

gst-launch-0.8 --gst-debug=screenshotsrc:5 screenshotsrc ! ximagesink

and it worked.

(3) Why would someone need such a thing?

I don't know. I was looking for a generic file format conversion tool and
gstreamer seemed to be something like that. I wrote this plugin to become
familiar with gstreamer. My final goal is related to libgnomeprint: Drop
any file on the print preview window and get it added/inserted there.
For this, I need a "* -> GnomePrintMeta" converter. Such a thing will probably
never exist (I doubt that the GnomePrintMeta format will ever be published).
But a "* -> image(s)" converter would be sufficient, too. I could write some
"PostScript/PDF/... <-> Video" converters for gstreamer. A 5 page PostScript
document would the be converted in a 5 frame video and could easily be
handled by libgnomeprint. As a side effect, you could watch movies on your
laser printer :-)
Comment 11 Ronald Bultje 2005-03-25 17:59:38 UTC
Hi,

I had a look today and was fairly amused by this plugin. It's a nice hack,
really. Also, we've actually wanted this for a long time already. Although I
mostly agree with Dave's comments (this could be done a lot nicer ladieda), we
simply don't have anything like this right now, and it *is* really very useful
(for those of us not running weird x server thingies). We could always improve
it later on.

I'm leaning towards accepting this for now. A few things do need work, mostly
small nitpicks:
* the enum GstScreenshotsrcPattern needs to die, because it is unused.
* so does the num-buffers, or at least the default needs to be to turn it off.
EOS should be handled by a managing bin (see gnome-sound-recorder, cupid, ...).
* ideally, you'd include a small script showing how to capture a theora file at
1 FPS or so.
* get_type() is not const.
* screenshot-utils.[ch] misses a copyright header.
Comment 12 Lutz Mueller 2005-04-20 19:25:04 UTC
Created attachment 45497 [details]
Updated plugin

Hello!

Thanks for the motivating feedback. Attached is the updated plugin. I am
looking forward to seeing it in CVS so that I can port gnome-screenshot to use
gstreamer.
Comment 13 Lutz Mueller 2005-04-21 20:41:24 UTC
Created attachment 45524 [details]
Updated plugin

Capture a screenshot in video format for example using

gst-launch-0.8 screenshotsrc ! ffmpegcolorspace ! theoraenc ! oggmux ! filesink
location=test.ogg
Comment 14 Luca Ognibene 2005-05-18 18:53:40 UTC
cool element!!
Is it ok to add this as "ximagesrc" instead of "screenshotsrc" ? We already have
a ximagesink so i think this is a better name... The element should go in
plugins/sys/ximage right? I would like to do a single plugin with
ximage[src|sink] but i don't think changing the current plugin name (ximagesink)
is a good idea (would break update from old versions, i think). I vote for
putting this element in the ximagesink plugin for 0.8 and change the plugin name
to ximage in 0.9, is this ok? 

I've done a really fast look at the code and i've seen that it doesn't handle
framerate (and so it uses 100% cpu :/). I'll work on this tonigh or tomorrow and
then i'll file a patch here.
Comment 15 Luca Ognibene 2005-05-18 20:21:52 UTC
Created attachment 46619 [details] [review]
updated patch

ok, finished the first version of the patch.
What this patch does:
* add the files gstximageplugin.c, ximagesrc.c and ximagesrc.h to cvs in
gst-plugins/sys/ximage
* add these files to Makefile.am
* move registration of ximagesink to gstimageplugin.c
* s/screenshotsrc/ximagesrc everywhere
* add sync property to ximagesrc (to sync or not to sync with the clock?)
* handle framerate in element's _link function
* remove the call to gst_buffer_set_data (deprecated macro)
* remove some unused code (like the pattern enum and the num_buffer property)

attaching here for review. The code should be optimized (maybe using XFixes and
XDamage extension) but it works fine and we haven't any similar element in
gstreamer.
Comment 16 Ronald Bultje 2005-05-18 21:00:44 UTC
Luca, ximagesrc is not a good idea because it isn't really pure Xlib-based... A
later version using XDamage could be called ximagesrc or xdamagesrc, but this
would just be confusing; fnuctionality-wise, I'd prefer this to keep its old name.
Comment 17 Luca Ognibene 2005-05-18 21:38:50 UTC
after speaking with Ronald in IRC i've committed this in CVS as ximagesrc. The
bug should be closed..
Comment 18 Lutz Mueller 2005-05-18 22:01:26 UTC
Created attachment 46624 [details]
Updated plugin

Ported to gstreamer-0.9 (GstBaseSrc). Still segfaults, but most of the work is
done.

By the way, how can I create a "cvs diff" that includes new files?
Comment 19 Olav Vitters 2005-05-18 22:15:55 UTC
Lutz Mueller: Many thanks for creating all of these patches. Please add that
last attachment to a new bug. This bug is fixed, new stuff should be in a new
bug. Our reports do not track new patches in bugs that are marked fixed.