[gst-devel] Using a Bin

José Luis Segura Lucas josel.segura at gmx.es
Sun Oct 17 20:06:32 CEST 2010


I just test it on my Debian unstable and it works perfectly (your
command, copy and pasted).

I don't understand what is the difference between create the bin by
hand or using the function parse_bin_from_description.

A little example in Python:

import gobject
import gst

def connection(element, pad, next_element):
    print pad.get_name()
    if pad.get_name() == 'src0':
        element.link(next_element)

pipe = gst.Pipeline()

src = gst.element_factory_make('videotestsrc', 'src_element')

dec  = gst.element_factory_make('decodebin2', 'dec_element')
sink = gst.element_factory_make('xvimagesink', 'sink_element')

bin = gst.Bin('my_bin')
bin.add(dec, sink)

bin.add_pad(gst.GhostPad('bin_sink', dec.get_static_pad('sink')))
dec.connect('pad-added', connection, sink)

pipe.add(src, bin)
src.link(bin)

pipe.set_state(gst.STATE_PLAYING)

gobject.MainLoop().run()


This example works fine, but if I change:

 dec  = gst.element_factory_make('decodebin2', 'dec_element')
 sink = gst.element_factory_make('xvimagesink', 'sink_element')

 bin = gst.Bin('my_bin')
 bin.add(dec, sink)

 bin.add_pad(gst.GhostPad('bin_sink', dec.get_static_pad('sink')))
 dec.connect('pad-added', connection, sink)

to:

 bin = gst.parse_bin_from_description('decodebin2 ! xvimagesink', True)


It only freeze when it starts playing. I tried using a filesrc instead
the videotestsrc, and the result is the same: the first example works,
the second, doesn't play nothing


El Sat, 16 Oct 2010 20:44:04 +1000
David Liu <davel at itee.uq.edu.au> escribió:
> The pipeline you describe doesn't actually work (connecting a
> videotestsrc to decodebin2), i.e.:
> 
> Daves-MacBook-Pro:bin dave$ gst-launch videotestsrc ! bin.
> \( decodebin2 ! autovideosink \) Setting pipeline to PAUSED ...
> Pipeline is PREROLLING ...
> ERROR: from
> element /GstPipeline:pipeline0/GstVideoTestSrc:videotestsrc0:
> Internal data flow error. Additional debug info: gstbasesrc.c(2543):
> gst_base_src_loop
> (): /GstPipeline:pipeline0/GstVideoTestSrc:videotestsrc0: streaming
> task paused, reason not-linked (-1) ERROR: pipeline doesn't want to
> preroll. Setting pipeline to NULL ... Freeing pipeline ...
> Daves-MacBook-Pro:bin dave$ 
> 
> However, if you provide an encoded media file then it works fine:
> 
> Daves-MacBook-Pro:videos dave$ gst-launch filesrc
> location=Jumper.mov ! bin. \( decodebin2 name=a a. ! audioconvert !
> audioresample ! autoaudiosink a. ! ffmpegcolorspace ! autovideosink
> \) Setting pipeline to PAUSED ... Pipeline is PREROLLING ... Pipeline
> is PREROLLED ... Setting pipeline to PLAYING ...
> New clock: GstAudioSinkClock
> [snip]
> 
> 
> Cheers,
> 
> - Dave L




More information about the gstreamer-devel mailing list