[gst-devel] Using gnonlin to extract time segments from a video file

Rodrigo Manhães rmanhaes at gmail.com
Fri Feb 13 18:53:02 CET 2009


Hi,

I wrote two small scripts to explain my problem on getting dynamic
pads with gnonlin.

The first, with no gnonlin, uses a filesrc, and prints:

video/x-raw-yuv
audio/x-raw-int

indicating that it found the two pads.
The code is below.

###
import gst
import gtk

pipeline = gst.Pipeline()

source = gst.element_factory_make('filesrc')
source.set_property('location', 'creature.mpg')
pipeline.add(source)

decoder = gst.element_factory_make('decodebin')
pipeline.add(decoder)
source.link(decoder)

def on_new_pad(bin, pad):
    print pad.get_caps()[0].get_name()

decoder.connect('pad-added', on_new_pad)

pipeline.set_state(gst.STATE_PLAYING)
gtk.main()

####

The second, using gnonlin, prints:

video/x-raw-yuv

indicating that only the video stream was found. (If I connect the
signal to gnlfilesource rather than gnlcomposition, the result is the
same)
The code is below:

###
import gst
import gtk

pipeline = gst.Pipeline()

composition = gst.element_factory_make('gnlcomposition')
pipeline.add(composition)

source = gst.element_factory_make('gnlfilesource')
source.set_property('location', 'creature.mpg')
source.set_property('start', 0)
source.set_property('media-start', 0)
source.set_property('duration', 10)
source.set_property('media-duration', 10)
composition.add(source)

def on_new_pad(bin, pad):
    print pad.get_caps()[0].get_name()

source.connect('pad-added', on_new_pad)

pipeline.set_state(gst.STATE_PLAYING)
gtk.main()
#####

What am I doing wrong?

[]'s
Rodrigo

2009/2/12 Rodrigo Manhães <rmanhaes at gmail.com>:
> 2009/2/12 Edward Hervey <bilboed at gmail.com>:
>>  'new-decoded-pad' is a convenience signal for new pads on decodebin.
>> The normal signal for new pads being added to an element is 'pad-added'.
>
> Using 'pad-added' signal, the callback is called only once, for the
> video stream. The pad for audio part is not added.
>
> []'s
> Rodrigo
>




More information about the gstreamer-devel mailing list