[gst-devel] why wavparse can't be linked in programming?

Tim Müller t.i.m at zen.co.uk
Wed Apr 25 11:58:33 CEST 2007


On Wed, 2007-04-25 at 14:55 +0800, linguang_wang at astrocom.cn wrote:

> I play a .wav file in my application to use such an
> element "wavparse" element.This leads to a problem:
> I can't link wavparse and osssink immediately.As
> follow:
>    gst_element_link_many (source, mywavparse ,sink,NULL);
> when running this app,it will print an error that:
> 	assertion failed: (gst_element_link_many (source, mywavparse,sink,NULL))
> ------------------------------------------------------------------------------------------------
> But if I use gst-launch to playback ,that is ok.
>    gst-launch filesrc location=music.wav ! wavparse ! osssink sync=false
> 
> Who knows the reason please tell me. Thanks in advance!

wavparse's source pad is only created once data processing in the
pipeline starts, so the source pad doesn't exist yet when you're trying
to link wavparse to the sink, therefore the linking fails. gst-launch
handles this case automatically for you.

Check out the section about 'dynamic pads' in the application
developer's manual and/or search the mailing list archives for this
term.

You can also use gst_parse_launch() to get the same magic as gst-launch.

I don't know why you use sync=false on osssink though - you're not using
a live source, so your audio sink should probably sync against the
clock. Also, please plug converters (audioconvert/audioresample) before
the sink unless you absolutely know that it will always work without.

Cheers
 -Tim






More information about the gstreamer-devel mailing list