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

linguang_wang at astrocom.cn linguang_wang at astrocom.cn
Thu Apr 26 04:52:43 CEST 2007


Hi,Tim and Zaheer!
	Thanks your help! The problem is solved as you sayed.I didn't seen the code at gstwavparse:
---------------------------------------------------------------------------
  /* first chunk of data? create the source pad. We do this only here so
   * we can detect broken .wav files with dts disguised as raw PCM (sigh) */
  if (G_UNLIKELY (wav->first)) {
    wav->first = FALSE;
    gst_wavparse_add_src_pad (wav, buf);
  }
---------------------------------------------------------------------------

	By the way, when I play .mp4 file that include audio and video data ,if I don't use sync=false on the osssink,
the audio will be dropped a few minites.But if I use that,the audio and video are fine.So that is the reason why I set sync=false
on osssink when playing .wav file. I didn't know what is the matter.

>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
>
>
>
>
>
>------------------------------
>
>Message: 2
>Date: Wed, 25 Apr 2007 11:58:56 +0200
>From: "Zaheer Merali" <zaheermerali at gmail.com>
>Subject: Re: [gst-devel] why wavparse can't be linked in programming?
>To: "linguang_wang at astrocom.cn" <linguang_wang at astrocom.cn>
>Cc: gstreamer-devel <gstreamer-devel at lists.sourceforge.net>
>Message-ID:
>	<15e616860704250258m2096e785x4c6db01ebccf2185 at mail.gmail.com>
>Content-Type: text/plain; charset=GB2312; format=flowed
>
>On 4/25/07, linguang_wang at astrocom.cn <linguang_wang at astrocom.cn> wrote:
>> Hi??all??
>>         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!
>>
>> linguang_wang
>> ????????????????linguang_wang at astrocom.cn
>
>Hi Linguang,
>
>Read the section on dynamic pads in:
>http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/chapter-pads.html
>
>It answers your question.
>
>Zaheer

        linguang_wang
        linguang_wang at astrocom.cn
          2007-04-26



More information about the gstreamer-devel mailing list