GNOME Bugzilla – Bug 161661
[PATCH] screenshots via gstreamer
Last modified: 2005-05-18 22:15:55 UTC
There is currently no possibility to get screenshots via gstreamer. Patch to follow soon...
Created attachment 34980 [details] screenshotsrc/Makefile.am
Created attachment 34981 [details] screenshotsrc/gstscreenshotsrc.c
Created attachment 34982 [details] screenshotsrc/gstscreenshotsrc.h
Created attachment 34983 [details] screenshotsrc/screenshot-utils.c
Created attachment 34984 [details] screenshotsrc/screenshot-utils.h
Created attachment 34985 [details] screenshotsrc/README
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
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.
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...
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 :-)
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.
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.
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
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.
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.
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.
after speaking with Ronald in IRC i've committed this in CVS as ximagesrc. The bug should be closed..
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?
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.