[gst-devel] Problem Trying To Use v4l2src

Tim-Philipp Müller t.i.m at zen.co.uk
Fri Aug 21 01:46:38 CEST 2009


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






More information about the gstreamer-devel mailing list