[gst-devel] About using the tuner interface in python

Tim Müller t.i.m at zen.co.uk
Mon May 1 02:24:04 CEST 2006


On Sun, 2006-04-30 at 23:27 +0200, Fredrik Persson wrote:

Hi,

> If programming in c, it seems that I can get a cast from source element to 
> tuner like this: 
> 
> tuner = GST_TUNER (video_source);
> 
> This seems to be needed in order to use the list_channels, get_channel and 
> set_channel methods that selects inputs (composite, S-video and so on) on 
> capture cards.
> 
> Does anyone know what the equivalent would be in python? At first I thought 
> that these methods could be used on a v4l2src element like so:
> 
> source = gst.element_factory_make("v4l2src",name="Pinnacle PCTV USB2.0")
> print source.get_channel()
> 
> This does not work. I get the following error message when running that:
> 
> (mypythontest.py:21507): GStreamer-CRITICAL **: gst_implements_interface_cast: 
> assertion `gst_element_implements_interface (GST_ELEMENT (from), iface_type)' 
> failed

Some interfaces in GStreamer are wrapped via the GstImplementsInterface,
the reasoning being (I think) that one might only be able to know
whether a certain device supports a certain interface once the device
has been opened (meaning: the element is in READY state or higher).

So with things like GstMixer or GstTuner the cast will fail if the
element is in NULL state.

Try setting it to READY state before doing the source.get_channel().

(Of course there's always the possibility that the interface stuff isn't
implemented properly in some element or something broke in the course of
porting it to 0.10).

Cheers
 -Tim






More information about the gstreamer-devel mailing list