I'm evaluating the possibility of using gstreamer for the next version of my real time image processing application. It seems I need to write a gstreamer plugin to get access to the actual data being passed through the gstreamer pipeline.
I've succeed in using the gst-template to compile a simple filter plugin, but before I put much more effort into learning gstreamer I need to solve a problem with the v4l2src plugin. My question is how do I initialize the plugin? I need to set NTSC mode (some of our cards default to PAL on powerup), image size to 640x480 (although it seems I could use one of the resize or cropping plugins), select the composite or S-Video input (most cards seem to default to tuner), and maybe set 8-bit grayscale video mode (our cameras are monochrome). If I run an application like TVtime first, the card then works with v4l2src in a simple gst-launch pipeline to test my plugin. But it seems pretty fragile with respect to video errors often requiring another run of TVtime to reset the card so v4l2src will work. I've searched the gestreamer-devel archive and only found some discussion of a similar issue on Win32 with directshow tuners. ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
On Tue, 2009-08-18 at 17:30 -0500, Kulecz, Walter wrote:
> I'm evaluating the possibility of using gstreamer for the next version > of my real time image processing application. It seems I need to > write a gstreamer plugin to get access to the actual data being passed > through the gstreamer pipeline. Not necessarily, but if you want to manipulate the data in the middle of a pipeline writing an element is usually the right thing to do. You can get data out of a pipeline using the appsink element, or the fakesink element with a "handoff" signal handler, or the identity element with a "handoff" signal handler, or by setting up a pad probe. > I've succeed in using the gst-template to compile a simple filter > plugin, but before I put much more effort into learning gstreamer I > need to solve a problem with the v4l2src plugin. > > My question is how do I initialize the plugin? I need to set NTSC mode > (some of our cards default to PAL on powerup), image size to 640x480 > (although it seems I could use one of the resize or cropping > plugins), select the composite or S-Video input (most cards seem to > default to tuner), and maybe set 8-bit grayscale video mode (our > cameras are monochrome). The desired pixel format/layout and resolution can be set by putting a capsfilter with suitable filter caps after the v4l2src element. This usually assumes the camera/drivers/libv4l support the exact format and resolution desired. If you just want to get data in a particular format/size no matter what you can put some converters like ffmpegcolorspace and videoscale between v4l2src and your capsfilter, and those elements will try their best to convert the data from the camera into the desired format if the format isn't supported. NTSC/PAL selection is done using the GstTuner interface (see gst-plugins-base libraries docs), I believe. The device might need to be open already when you use the interface (ie. the v4l2src element needs to be set to at least READY or PAUSED state [it should be READY, but IIRC the v4l elemens didn't implement that correctly until recently, so you might need PAUSED instead depending on the version used]). > If I run an application like TVtime first, the card then works with > v4l2src in a simple gst-launch pipeline to test my plugin. But it > seems pretty fragile with respect to video errors often requiring > another run of TVtime to reset the card so v4l2src will work. What errors do you get? What does TVtime do to reset it? Cheers -Tim ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
In reply to this post by Kulecz, Walter (JSC-SK)[WYLE INTEG. SCI. & ENG.]
>>It seems I need to write a gstreamer plugin to get access to the actual data being passed
>> through the gstreamer pipeline. > >Not necessarily, but if you want to manipulate the data in the middle of >a pipeline writing an element is usually the right thing to do. >You can get data out of a pipeline using the appsink element, or the >fakesink element with a "handoff" signal handler, or the identity >element with a "handoff" signal handler, or by setting up a pad probe. Thanks so much for this and the quick response Tim, I'll look into it. It could make for a much easier to maintain project if I simply have a gstreamer application instead of a gstreamer application and plugin. But if the documentation or sample programs were better I can clearly see the advantage of using a plugin. >> My question is how do I initialize the v4l2src plugin? I need to set NTSC mode >> (some of our cards default to PAL on power up), image size to 640x480 >> (although it seems I could use one of the resize or cropping >> plugins), select the composite or S-Video input (most cards seem to >> default to tuner), and maybe set 8-bit grayscale video mode (our >> cameras are monochrome). > >The desired pixel format/layout and resolution can be set by putting a >capsfilter with suitable filter caps after the v4l2src element. This >usually assumes the camera/drivers/libv4l support the exact format and >resolution desired. If you just want to get data in a particular >format/size no matter what you can put some converters like >ffmpegcolorspace and videoscale between v4l2src and your capsfilter, and >those elements will try their best to convert the data from the camera >into the desired format if the format isn't supported. The devil is in the details of exactly how I put a "capsfilter with suitable filter caps after the v4l2src element". I'd prefer to avoid format conversions if possible beyond what it takes for ximagesink to display on a 16-bit or 24-bit or 32-bit X server. Playing around with this pipeline: v4l2src ! video/x-raw-yuv, framerate=\(fraction\)30000/1001 ! gamma ! wally ! xvimagesink where wally is my gst-template made gstfilter toy plugin, it seems I'm getting I420 video. I've not had a lot of luck Googling for for the details of the data layouts for the various formats, but poking around the SMTPE plugin, I420 seems to be something I can use as the buffer seems to consist of width*height bytes of intensity (essentially grayscale) data followed by width*height/2 arrays of half resolution color channel data which I could ignore. Since my application needs to run a pair of genlocked cameras into two capture cards, I prefer not to be passing around data I intend to ignore. Although with performance of today's machines its probably not an issue. Enhancing the system for higher frame rates would be much higher priority over trying to incorporate any color data into the analysis. I'm finding the details of specifying a colorspace in ffmpegcolorspace or videoscale lacking. I'd rather set the capture to be width=640 height=480 from the start instead of cropping something line 704x480 to 640x480. I'm all in favor of having things auto-negotiate formats, but how to I tell them my choices are when it matters? >NTSC/PAL selection is done using the GstTuner interface (see >gst-plugins-base libraries docs), I believe. The device might need to be > There seems to be a lot of poorly if at all documented "common knowledge" about the gstreamer structure and conventions. At: http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-plugins/html/ I don't see any gstTuner or tuner anywhere in the list of base Elements or base Plugins. I did find this: http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gsttunernorm.html but the "Details" leaves out the actual strings that sets the norm and what "property" I'd be setting or method to invoke to change it, since gst-inspect tuner or gsttuner returns "No such element". I'm not clairvoyant. I'm left without a clue as to how I'd have "gst-launch v4l2src" set the norm to NTSC, short of perhaps grepping the gstreamer tree in hopes of finding NTSC or ntsc somewhere. Automatically generated documentation I find generally voluminous, repetitive, and mostly useless except for looking up the details you've forgotten once you've already become an "expert". A big factor in my evaluation is the fact that retirement is on the horizon, and its very unlikely I'll be here past three more years, so choosing a methodology for the next version of my application (which I inherited and ported from the Mac in 2005) that has an enormous learning curve would be a disservice to my employer and my replacement. On the plus side, learning and using gstreamer might facilitate porting to Windows or back to Mac; but a major plus of Linux is I can "clone" the system and give it to colleagues to use without having to invoke our bureaucracy to buy or sell anything. So on balance, facilitating a port away from Linux could make the system less useful overall. >> If I run an application like TVtime first, the card then works with >> v4l2src in a simple gst-launch pipeline to test my plugin. But it >> seems pretty fragile with respect to video errors often requiring >> another run of TVtime to reset the card so v4l2src will work. > >What errors do you get? What does TVtime do to reset it? > I can't cause the problem on command except after a reboot, but I suspect bad spots on the SVHS tapes I play back for development/testing might have something to do with it. I've not dissected TVtime yet to figure out what its doing (that is Plan B, if I choose not to use gstreamer), but I know it just works from a cold boot and recovers whatever got messed up while I was playing with gstreamer every time. On boot up or after my screw-up or error, either my gst-launch pipeline just dies in about a second: $ gst-launch v4l2src ! video/x-raw-yuv, framerate=\(fraction\)30000/1001 ! xvimagesink Setting pipeline to PAUSED ... Pipeline is live and does not need PREROLL ... WARNING: from element /pipeline0/v4l2src0: Could not set parameters on device '/dev/video0' Additional debug info: v4l2src_calls.c(1165): gst_v4l2src_set_capture (): /pipeline0/v4l2src0: system error: Invalid argument Setting pipeline to PLAYING ... New clock: GstSystemClock ERROR: from element /pipeline0/v4l2src0: Failed trying to get video frames from device '/dev/video0'. Additional debug info: v4l2src_calls.c(1069): gst_v4l2src_grab_frame (): /pipeline0/v4l2src0:The buffer type is not supported, or the index is out of bounds, or no buffers have been allocated yet, or the userptr or length are invalid. device /dev/video0 Execution ended after 998910962 ns. Setting pipeline to PAUSED ... Setting pipeline to READY ... Setting pipeline to NULL ... FREEING pipeline ... or it displays a messed up window with a few mostly correct scanlines at the top with a bunch of green tinged distorted lines filling the window. Then if I start and stop TVtime, the gstreamer pipeline will work fine afterwards: $ gst-launch v4l2src ! video/x-raw-yuv, framerate=\(fraction\)30000/1001 ! xvimagesink Setting pipeline to PAUSED ... Pipeline is live and does not need PREROLL ... WARNING: from element /pipeline0/v4l2src0: Could not set parameters on device '/dev/video0' Additional debug info: v4l2src_calls.c(1165): gst_v4l2src_set_capture (): /pipeline0/v4l2src0: system error: Invalid argument Setting pipeline to PLAYING ... New clock: GstSystemClock ERROR: from element /pipeline0/xvimagesink0: Output window was closed Additional debug info: xvimagesink.c(1223): gst_xvimagesink_handle_xevents (): /pipeline0/xvimagesink0 Execution ended after 9357423821 ns. Setting pipeline to PAUSED ... Setting pipeline to READY ... Setting pipeline to NULL ... FREEING pipeline ... I haven't been able to get a clue as to what: WARNING: from element /pipeline0/v4l2src0: Could not set parameters on device '/dev/video0' Additional debug info: v4l2src_calls.c(1165): gst_v4l2src_set_capture (): /pipeline0/v4l2src0: system error: Invalid argument is trying to tell me, other than its clearly not a problem in terms of seeing the video playing in the ximagesink window and is there independent of if the pipeline actually works or not. ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
On Wed, 2009-08-19 at 11:40 -0500, Kulecz, Walter wrote:
> It could make for a much easier to maintain project if I simply have a > gstreamer application instead of a gstreamer application and plugin. Keep in mind that you can have 'static' plugins local to the application and part of the application binary. You don't need to create and install a plugin .so. > But if the documentation or sample programs were better I can clearly > see the advantage of using a plugin. That didn't quite parse. In any case, what sample programs and which parts of the documentation did you find lacking in particular? If there's something specific you would like us to add or fix, please file a bug in bugzilla. > The devil is in the details of exactly how I put a "capsfilter with > suitable filter caps after the v4l2src element". I'd prefer to avoid > format conversions if possible beyond what it takes for ximagesink to > display on a 16-bit or 24-bit or 32-bit X server. > > Playing around with this pipeline: > v4l2src ! video/x-raw-yuv, framerate=\(fraction\)30000/1001 ! gamma ! wally ! xvimagesink > > where wally is my gst-template made gstfilter toy plugin, it seems I'm > getting I420 video. I've not had a lot of luck Googling for for the > details of the data layouts for the various formats, but poking around > the SMTPE plugin, I420 seems to be something I can use as the buffer > seems to consist of width*height bytes of intensity (essentially > grayscale) data followed by width*height/2 arrays of half resolution > color channel data which I could ignore. http://gstreamer.freedesktop.org/data/doc/gstreamer/head/pwg/html/section-types-definitions.html has some information and links to fourcc.org, which has information about most of the YUV pixel formats. To specify width/height you add ,width=640,height=480 to the capsfilter. If the camera doesn't support that you'll get an appropriate error. There are various gray formats, such as video/x-raw-gray and video/x-raw-yuv,format=(fourcc)Y800, but if you are adding other elements to the pipeline or want to output them to an imagesink, they're of limited use really, since only few elements support them. Not sure how many cams can output data in any of those formats either. > I'm finding the details of specifying a colorspace in ffmpegcolorspace > or videoscale lacking. I'd rather set the capture to be width=640 > height=480 from the start instead of cropping something line 704x480 > to 640x480. I'm all in favor of having things auto-negotiate formats, > but how to I tell them my choices are when it matters? You put a capsfilter with your desired format and width=640,height=480 in the right place. See gst-inspect-0.10 ffmpegcolorspace for what formats are supported. > >NTSC/PAL selection is done using the GstTuner interface (see > >gst-plugins-base libraries docs), I believe. The device might need to be > > > There seems to be a lot of poorly if at all documented "common knowledge" about the gstreamer structure and conventions. Yes. There is a lot of common knowledge and conventions assumed. In particular, we expect people to have a firm grasp of GLib/Gtk conventions and some basic knowledge and understanding of GObject and the GType/GValue system (at least when coding in C). > At: > http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-plugins/html/ > I don't see any gstTuner or tuner anywhere in the list of base > Elements or base Plugins. It's an interface, not an element or plugin. I did say '-base libraries docs' for a reason. > I did find this: > http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gsttunernorm.html > but the "Details" leaves out the actual strings that sets the norm and > what "property" I'd be setting or method to invoke to change it, since > gst-inspect tuner or gsttuner returns "No such element". I'm not > clairvoyant. I'm left without a clue as to how I'd have "gst-launch > v4l2src" set the norm to NTSC, short of perhaps grepping the gstreamer > tree in hopes of finding NTSC or ntsc somewhere. I don't think there is a way to do this via gst-launch, you'll have to write code. > Automatically generated documentation I find generally (snip bla). > > A big factor in my evaluation is the fact that retirement is on the > horizon, and its very unlikely I'll be here past three more years, so > choosing a methodology for the next version of my application (which I > inherited and ported from the Mac in 2005) that has an enormous > learning curve would be a disservice to (snip more bla) GStreamer does have a bit of a learning curve. However, I think there's plenty of documentation and good source code around to get you started, and people in the #gstreamer IRC channel on Freenode will be happy to fill in the blanks where our docs are not as good as one would hope for, or at least point you in the right direction. Cheers -Tim ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
In reply to this post by Kulecz, Walter (JSC-SK)[WYLE INTEG. SCI. & ENG.]
>Keep in mind that you can have 'static' plugins local to the application
>and part of the application binary. You don't need to create and install >a plugin .so. I've no idea how I'd do such a thing. I can make a plugin, export the plugin path, and then use in a pipeline; this procedure was reasonably well documented. I don't see how making a local plugin does anything worthwhile. Let's punt on this as it gets too specific as to a design for my application, unless understanding this distinction is important to effectively using gstreamer. >> But if the documentation or sample programs were better I can clearly >> see the advantage of using a plugin. > >That didn't quite parse. In any case, what sample programs and which >parts of the documentation did you find lacking in particular? If >there's something specific you would like us to add or fix, please file >a bug in bugzilla. My current design has the image capture, processing, and user feedback display in one application, and the user interface to control the image processing parameters in another. They communicate via a shared mmapped file. This would make the transition pretty easy as I could open the mmapped file in my plugin to control the real-time image processing without having to change my user interface at all initially. Obviously I could also do this in a gstreamer application that didn't use a plug in, but initially I might be able to start things with a simple gst-launch command in a startup script. I believe more in software evolution than development and like to make changes in terms of the smallest thing I can debug at a time. As too Bugzilla, I did file a report before I got to first base as the instructions in the Plugin Writers Guide to use anonymous git didn't work for me because of telnet being blocked by our firewall. It was immediately marked as "won't fix", although the responder did give me a link to download a *.tar.gz file of the template tree. Later I got a second response about an http anonymous git command that I verified worked on another system (for testing 16-bit Xserver vs. 32-bit Xserver, having gstreamer automatically solve this issue is one of my prime motavations). Clearly the http link to get the template should be documentated in the Plugin Writer's Guide, or am I the first one to ever have telnet blocked :) Another gap in the Plugin Writer's Guide is there is no mention as to how to actually modify the Makefile.am file, it wasn't too hard to figure out after a bit of Googling, but its a time waster caused by incomplete instructions which are particularly frustrating at the "Hello World" stage. While stumbling around the documention I've run into several of these "Not Found" errors: http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-plugins/html/gst-plugins-base-plugins-queue2.html This is the most recent one I've run across, mostly I just cuss a bit and hit the back button and stumble around some more. If you want Bugzilla reports for these, I'll start keeping track assuming I continue down the gstreamer path. >> I don't see any gstTuner or tuner anywhere in the list of base >> Elements or base Plugins. > >It's an interface, not an element or plugin. I did say '-base libraries docs' for a reason. > >> I did find this: >> http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gsttunernorm.html >> but the "Details" leaves out the actual strings that sets the norm and >> what "property" I'd be setting or method to invoke to change it, since >> gst-inspect tuner or gsttuner returns "No such element". I'm not >> clairvoyant. I'm left without a clue as to how I'd have "gst-launch >> v4l2src" set the norm to NTSC, short of perhaps grepping the gstreamer >> tree in hopes of finding NTSC or ntsc somewhere. > >I don't think there is a way to do this via gst-launch, you'll have to write code. Which begs the question of how do I figure out exactly what to write? The GStreamer Application Development Manual isn't too helpful here, referring me to the API references. The API Indices are a bad joke since just about everything starts with Gst or gst_ and the link above is about the only thing I see talking about gsttuner. I really need to solve the composite input selection and NTSC setting issue before I can justify putting more effort into gstreamer. I just don't understand how to invoke these interface functions and what there parameters should be. >GStreamer does have a bit of a learning curve. However, I think there's >plenty of documentation and good source code around to get you started, >and people in the #gstreamer IRC channel on Freenode will be happy to >fill in the blanks where our docs are not as good as one would hope for, >or at least point you in the right direction. Unfortunately for me, like telnet, irc and all manner of chat is blocked here. I have modified the Application Development Manual's "Hello World" program to open a pipeline with the gst-launch equivalent: v4l2src ! video/x-raw-yuv, framerate=\(fraction\)30000/1001 ! queue ! wally ! ffmpegcolorspace ! xvimagesink And it works, (as long as the NTSC and composite input has been set by another program) if I use: caps = gst_caps_new_simple ("video/x-raw-yuv", "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('I', '4', '2', '0'), "width", G_TYPE_INT, 640, "height", G_TYPE_INT, 480, "framerate", GST_TYPE_FRACTION, 30, 1, NULL); link_ok = gst_element_link_filtered (source, queue, caps); But changing it to: caps = gst_caps_new_simple ("video/x-raw-gray", "width", G_TYPE_INT, 640, "height", G_TYPE_INT, 480, "framerate", GST_TYPE_FRACTION, 30, 1, NULL); link_ok = gst_element_link_filtered (source, queue, caps); the gst_element_like_filtered() fails. The v4l2src src caps claim to support video/x-raw-gray according to gst-inspect. and queue is CAP_ANY so the idea was to queue 8-bit video, do my processing, and then use ffmpegcolorspace to transform to something xvimage sink supports (video/x-raw-gray is not listed). I can use I420, and ignore the color info in my processing and then leave out the ffmpegcolorspace which might arguably be more efficient overall. Playing like this is part of the learning curve, but I can't get video/x-raw-gray to work. I know the card captures 8-bit gray scale as this is what I use in my application and I then do a table lookup to convert it to 16-bit gray format for the Xserver shared memory window after overlaying a few things (making use of color) for user feedback. Thanks again for your help. ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
On Thu, 2009-08-20 at 17:25 -0500, Kulecz, Walter wrote:
> >Keep in mind that you can have 'static' plugins local to the application > >and part of the application binary. You don't need to create and install > >a plugin .so. > > I've no idea how I'd do such a thing. > > I can make a plugin, export the plugin path, and then use in a > pipeline; this procedure was reasonably well documented. I don't see > how making a local plugin does anything worthwhile. It was just a suggestion. Other people find static plugins much easier. If you ever want to do this, find the API reference for GstPlugin and search for the word 'static'. It's not that difficult, especially if you have managed to create a plugin .so beofre. I'm sure you can find examples somewhere. > As too Bugzilla, I did file a report before I got to first base as the > instructions in the Plugin Writers Guide to use anonymous git didn't > work for me because of telnet being blocked by our firewall. It was > immediately marked as "won't fix", although the responder did give me > a link to download a *.tar.gz file of the template tree. Later I got > a second response about an http anonymous git command that I verified > worked on another system (for testing 16-bit Xserver vs. 32-bit > Xserver, having gstreamer automatically solve this issue is one of my > prime motavations). Clearly the http link to get the template should > be documentated in the Plugin Writer's Guide, or am I the first one to > ever have telnet blocked :) Yes, you are the first one to ever bring this up in bugzilla, and I have added the http link to the docs now (I never noticed those download links on cgit before). > Another gap in the Plugin Writer's Guide is there is no mention as to > how to actually modify the Makefile.am file, it wasn't too hard to > figure out after a bit of Googling, but its a time waster caused by > incomplete instructions which are particularly frustrating at the > "Hello World" stage. That is true, but there's only so much you can do in these kind of docs. Just like we don't teach people C or GLib/GObject basics, we can't really teach them how to compile code or how autotools work (IMHO). However, if you have any links that you have found particularly helpful, please let us know (in bugzilla, preferably) so we can mention them somewhere. > While stumbling around the documention I've run into several of these "Not Found" errors: > http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-plugins/html/gst-plugins-base-plugins-queue2.html > > This is the most recent one I've run across, mostly I just cuss a bit > and hit the back button and stumble around some more. If you want > Bugzilla reports for these, I'll start keeping track assuming I > continue down the gstreamer path. I think/hope this is only linked to from http://gstreamer.freedesktop.org/documentation/plugins.html in which case the disclaimer at the top of the page applies. However, elements in core, -base and -good *should* really all be documented, so if you find core/base/good elements that aren't, a bug report would certainly be appreciated. > >I don't think there is a way to do this via gst-launch, you'll have to write code. > > Which begs the question of how do I figure out exactly what to write? > The GStreamer Application Development Manual isn't too helpful here, > referring me to the API references. The API Indices are a bad joke > since just about everything starts with Gst or gst_ and the link above > is about the only thing I see talking about gsttuner. You could start by creating a pipeline with your elements (gst_parse_launch() might come in handy), and setting their state to PLAYING. If you have a GstElement * pointer to a v4l2src element, you can cast it to a GstTuner using: GstTuner *tuner = GST_TUNER (v4l2src); (this will only work if the v4l2src device is open, ie. at least in PAUSED or READY state.) Then you can get the norms using something like (untested): GList *norms, *l; norms = (GList *) gst_tuner_list_norms (tuner); for (l = norms; l != NULL; l = l->next) { GstTunerNorm *norm = GST_TUNER_NORM (l->data); if (GST_VALUE_HOLDS_FRACTION (&norm->framerate)) { g_print ("Norm: %s @ %d/%d fps\n", norm->label, gst_value_get_fraction_numerator (&norm->framerate), gst_value_get_fraction_denominator (&norm->framerate)); } else { g_print ("Norm: %s\n", norm->label); } } > Unfortunately for me, like telnet, irc and all manner of chat is blocked here. I believe there are web interfaces for IRC. > (snip code) > the gst_element_like_filtered() fails. The v4l2src src caps claim to > support video/x-raw-gray according to gst-inspect. gst-inspect lists all the caps that the element can possibly support. It does not mean that all these caps are actually supported at runtime. The caps actually supported is a subset of the template caps listed in gst-inspect and mostly depends on your hardware and the driver. Something like this should show what's supported: GST_DEBUG=v4l2*:5 gst-launch v4l2src num-buffers=1 ! fakesink 2>&1 | grep probed (Not pretty, but the easy. You can query this programmatically of course). Anyways, good luck! Cheers -Tim ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
>> Another gap in the Plugin Writer's Guide is there is no mention as to
>> how to actually modify the Makefile.am file, it wasn't too hard to >> figure out after a bit of Googling, but its a time waster caused by >> incomplete instructions which are particularly frustrating at the >> "Hello World" stage. > >That is true, but there's only so much you can do in these kind of docs. >Just like we don't teach people C or GLib/GObject basics, we can't >really teach them how to compile code or how autotools work (IMHO). >However, if you have any links that you have found particularly helpful, >please let us know (in bugzilla, preferably) so we can mention them >somewhere. It would be most helpful if the gst-template/gst-plugin/tools/make_element script created the Makefile.am needed by generated element source files. This thread found on nabble.com via Google, http://www.nabble.com/Novice-td24209412.html had the key piece of info for me. Actually, browsing the archives of this list on nabble seems to be much better than via sourceforge. I guess source forge is a bit overloaded. What was left out is how to modify the Makefile.am, good luck if you don't understand automake. Since in this case it is a script generated template, for a single plugin its not too hard. Every place the substring "plugin" occurs in a non-commented line in the Makefile.am you need to replace it with the name you gave in the ../tools/make_element command, "wally" in my case. I'm not sure anyone can explain how the autotools work or why you often end having to have multiple versions of them installed. No Starch Press is supposed to have a book coming out later this year about GNU Autotools, so maybe there is hope. The goodness of any framework is basically how well it encapsulates all this arcane knowledge to provide usable recipes. Once I got the template to build I had no trouble making a trivial video filter plug-in. The instructions in the Application Guide to build the helloworld gstreamer audio player application were correct and complete, but Ubuntu 8.04 let me down here by missing the sym links needed to make the nested include files find everything. I posted a thread on the Ubuntu programming talk forum with my fix: http://ubuntuforums.org/showthread.php?t=1233105 >> While stumbling around the documentation I've run into several of these "Not Found" errors: > >I think/hope this is only linked to from >http://gstreamer.freedesktop.org/documentation/plugins.html in which >case the disclaimer at the top of the page applies. However, elements in >core, -base and -good *should* really all be documented, so if you find >core/base/good elements that aren't, a bug report would certainly be >appreciated. Just ran across this one while trying to incorporate the clue about gsttuner you've given me below. >From Overview of available plug-ins, choose v4l2src, then under Implemented Interfaces choose GstTuner and I get another "Not Found": http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-good-plugins/gst-plugins-base-libs-0.10/gst-plugins-base-libs-gsttuner.html#GstTuner I've just posted it to Bugzilla. >You could start by creating a pipeline with your elements >(gst_parse_launch() might come in handy), and setting their state to >PLAYING. > >If you have a GstElement * pointer to a v4l2src element, you can cast it >to a GstTuner using: > >GstTuner *tuner = GST_TUNER (v4l2src); --- rest of code snippet deleted --- I'm working on it, thanks for the clue. I modified the helloworld.c program to launch my video pipeline instead of playing an ogg audio file, and made my plug-in do a histogram equalization so the pieces are in place. If I solve the tuner component input selection issue I'll post this as an example. >> Unfortunately for me, like telnet, irc and all manner of chat is blocked here. > >I believe there are web interfaces for IRC. If you've got a link I can try it, but the top level Freenode website was blocked :( as are all manner of public Email sites. I can get gmail with https:// so if you've got a direct link to the web interface I can try getting there with https:// >> (snip code) >> the gst_element_like_filtered() fails. The v4l2src src caps claim to >> support video/x-raw-gray according to gst-inspect. > >gst-inspect lists all the caps that the element can possibly support. It >does not mean that all these caps are actually supported at runtime. The >caps actually supported is a subset of the template caps listed in >gst-inspect and mostly depends on your hardware and the driver. >Something like this should show what's supported: > > This doesn't show video/x-raw-gray either, which would explain why it don't work. I know this card supports it my my version 1 program sets it up with Video4Linux2 calls. Its a cheap saa7134 capture card. Would this be considered a bug in v4l2src? If so, I will submit to Bugzilla. Using Ubuntu 8.04 and is gstreamer-0.18 , so it might be best if anyone else out there with an saa1734 card and the current gstreamer version could run that probe command to verify before going to Bugzilla. The tuner input setting issue is a showstopper, using I420 and passing around buffers half unused I can live with. Thanks again for your help. I am making progress! Interesting that "gst-launch v4l2src ! queue ! xvimagesink" had gst-launch and Xorg using about 35% CPU (test machine is weak, 1.4G Athelon) but my hellovideo.c and plug in only had hellovideo.c and Xorg run about 22%. Playing with gst-launch made me think I might come up against a performance issue as my application runs two live video streams. It seems the issue is gst-launch, not gstreamer. ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
In reply to this post by Tim-Philipp Müller-2
>You could start by creating a pipeline with your elements
>(gst_parse_launch() might come in handy), and setting their state to >PLAYING. I've modified the gstreamer helloworld.c program from the Application Development Manual to build my pipeline with my sample plug-in instead of playing ogg audio, and it works fine, as long as some other application sets the card to NTSC and composite input before I run it. >If you have a GstElement * pointer to a v4l2src element, you can cast it >to a GstTuner using: > >GstTuner *tuner = GST_TUNER (v4l2src); > >(this will only work if the v4l2src device is open, ie. at least in >PAUSED or READY state.) > >Then you can get the norms using something like (untested): > >GList *norms, *l; > >norms = (GList *) gst_tuner_list_norms (tuner); >for (l = norms; l != NULL; l = l->next) { > GstTunerNorm *norm = GST_TUNER_NORM (l->data); > > if (GST_VALUE_HOLDS_FRACTION (&norm->framerate)) { > g_print ("Norm: %s @ %d/%d fps\n", norm->label, > gst_value_get_fraction_numerator (&norm->framerate), > gst_value_get_fraction_denominator (&norm->framerate)); > } else { > g_print ("Norm: %s\n", norm->label); > } >} I have: GstElement *vrl2src=gst_element_factory_make("v4l2src", video-source); and did: GstTuner *tuner = GST_TUNER (v4l2src); and the rest, after I added all elements to the pipeline and linked them, just before doing: gst_element_set_state(pipeline, GST_STATE_PLAYING); I'm trying to use your info to figure out how to set NTSC mode and select the composite or S-video inputs, but after getting it to compile and link when I run it I get these errors: (HelloVideo:2347): GStreamer-CRITICAL **: gst_implements_interface_cast: assertion `gst_element_implements_interface (GST_ELEMENT (from), iface_type)' failed ** (HelloVideo:2347): CRITICAL **: gst_tuner_list_norms: assertion `GST_IS_TUNER (tuner)' failed The pipeline runs after these errors. And I'm hopelessly lost in a bunch of self-referential object spaghetti. The Video4Linux2 interface to select input sources is pretty lousy. I'd hoped some object wrapper around it would be clearer :( ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
On Fri, 2009-08-21 at 17:16 -0500, Kulecz, Walter wrote:
> >If you have a GstElement * pointer to a v4l2src element, you can cast it > >to a GstTuner using: > > > >GstTuner *tuner = GST_TUNER (v4l2src); > > > >(this will only work if the v4l2src device is open, ie. at least in > >PAUSED or READY state.) > > > >Then you can get the norms using something like (snip) > > I have: > > GstElement *vrl2src=gst_element_factory_make("v4l2src", video-source); > > and did: > > GstTuner *tuner = GST_TUNER (v4l2src); > > and the rest, after I added all elements to the pipeline and linked them, just before doing: > > gst_element_set_state(pipeline, GST_STATE_PLAYING); Have you tried setting v4l2src to PAUSED or PLAYING state before doing the cast to GST_TUNER(), like I suggested? > (HelloVideo:2347): GStreamer-CRITICAL **: > gst_implements_interface_cast: assertion > `gst_element_implements_interface (GST_ELEMENT (from), iface_type)' > failed ** (HelloVideo:2347): CRITICAL **: gst_tuner_list_norms: > assertion `GST_IS_TUNER (tuner)' failed This is what you get when the element isn't in the right state (yes, it's awful; and yes, it's very bad API and we intend to fix it at the next possible opportunity, but we're stuck with it for the current API cycle). Cheers -Tim ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
On Sat, 2009-08-22 at 01:28 +0100, Tim-Philipp Müller wrote:
> Have you tried setting v4l2src to PAUSED or PLAYING state before doing > the cast to GST_TUNER(), like I suggested? That should've read 'READY or PAUSED'. ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
>On Sat, 2009-08-22 at 01:28 +0100, Tim-Philipp Müller wrote:
>> Have you tried setting v4l2src to PAUSED or PLAYING state before doing >> the cast to GST_TUNER(), like I suggested? > >That should've read 'READY or PAUSED'. Thanks a lot. Sorry it took me so long to get back to this. Setting it to 'PAUSED' is what allows the interface method functions to be accessed. I've attached HelloVideo.c which is just the basic gstreamer "HelloWorld.c" audio player example modified to for: v4l2src ! queue ! ffmpegcolorspace ! xvimagesink. Perhaps it'll save someone else some hassles. Do with it what you will. Seems to work OK for now. But I still see two issues. First is an apparently bogus error warning, shown in this dump of the console output: wally@voms:~$ ./HelloVideo Norm: PAL @ 25/1 fps Norm: PAL-BG @ 25/1 fps Norm: PAL-I @ 25/1 fps Norm: PAL-DK @ 25/1 fps Norm: NTSC @ 30000/1001 fps Norm: SECAM @ 25/1 fps Norm: SECAM-DK @ 25/1 fps Norm: SECAM-L @ 25/1 fps Norm: SECAM-Lc @ 25/1 fps Norm: PAL-M @ 30000/1001 fps Norm: PAL-Nc @ 25/1 fps Norm: PAL-60 @ 30000/1001 fps Previous Norm: PAL (HelloVideo:17735): GLib-GObject-WARNING **: IA__g_object_notify: object class `GstV4l2Src' has no property named `norm' Current Norm: NTSC Chan: Composite1 Chan: Television Chan: S-Video Capturing from v4l2src plugin Running... Error: Output window was closed Returned, stopping playback Deleting pipeline The second issue is if my VCR is idle (tape not playing) the pipeline fails to start with: "Error: Failed trying to get video frames from device: /dev/video0" But if the tape is playing it works, I can then stop the tape and the pipeline continues to display the recorder's "blue screen" status. This one is a bit more inconvenient as we run in two modes, live where it won't be a problem since the cameras are on before the program would start, and archive where old tapes are analyzed and the tape rarely if ever playing when the program is started. I'd assume the gst_element_set_state(pipeline, GST_STATE_PLAYING) returns some status I could loop on if no video, or quit on if the window is closed, but it seems the return codes are just a generic success or failure. So my question becomes is there a better way then working on the bus_call() function in the sample application to interpret the error and restart the loop if the error is simply a lack of video frames because the recorder is stopped? This whole thread would never have happened if things like GstTunerNorm *ntsc=gst_tuner_find_norm_by_name (tuner, "NTSC"); if(ntsc) gst_tuner_set_norm (tuner, ntsc); else g_print("Can't set NTSC!\n"); and GstTunerChannel *composite=gst_tuner_find_channel_by_name(tuner, "Composite1"); if(composite) gst_tuner_set_channel(tuner, composite); else g_print("Can't select Composite1 input!\n"); were documented with v4l2src along with the recipe of casts needed to allow access to the gsttuner interface. I know that "introspective" objects are trendy these days, but I don't see the point as the documentation needed for this "self-discovery" to actually work is far greater than just listing the possibilities and adding to it as features grow, and returning "not supported" errors for things a specific class instance can't support. The whole "interface" thing seems a kludge around not having multiple inheritance in GObjects. The video for Linux stuff seems to have lost something in the translation, as "channel" is (or should be) what frequency (station) the television tuner input is tuned to, whereas selection of S-Video, Composite, Tuner, etc. input sources should not really be part of the TV channel selection/definition code which in the case of NTSC is now defunct for over the air broadcasts anyways. ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel HelloVideo.c (10K) Download Attachment |
Free forum by Nabble | Edit this page |