[gst-devel] Problem Trying To Use v4l2src

Kulecz, Walter (JSC-SK)[WYLE LABORATORIES] walter.kulecz-1 at nasa.gov
Sat Aug 22 00:16:18 CEST 2009


>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 :(



More information about the gstreamer-devel mailing list