HELP: Link "wavparse" to "audioconvert" has error.

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

HELP: Link "wavparse" to "audioconvert" has error.

Freeman Zhang
HI
 
Please help me.
When I link "wavparse" to the "audioconvert" it is failed. but if I use "mad", it will success.
 
I have ran it from the command line:
"gst-launch filesrc location=./media/login.wav ! wavparse ! audioconvert ! audioresample ! alawenc ! rtppcmapay" it is ok.
 
I don't know why it failed, please help me, how can I can the error details?
 
Thanks in advance.  
 
Freeman
 
P.S the source code:
 
  // Source "filesrc ! wavparse ! audioconvert "
  GstElement* src = gst_element_factory_make("filesrc", "src");
  SET(src, "location", cmd->filename);
  
  printf("File = %s\n", cmd->filename);
  
  // Parse
  GstElement* parse = NULL;
  switch (cmd->filetype)
  {
  case EWAVE:
   printf("Using wav parser\n");
   parse = gst_element_factory_make("wavparse", "parse");
   break;
  case EMP3:
   printf("Using mp3 parser\n");
   parse = gst_element_factory_make("mad", "parse");
   break;
  default:
   break;
  }
   
  // Converter
  GstElement* convert = gst_element_factory_make("audioconvert", "con");

  // Audio Sample
  GstElement* sample = gst_element_factory_make("audioresample", "sample");
 
  // The Package Format
  GstElement* encoder = NULL;
  GstElement* payload = NULL;
   
  switch (cmd->codec)
  {
  case EG711:
   encoder = gst_element_factory_make("alawenc", "encoder");
   payload = gst_element_factory_make("rtppcmapay", "payload");
   break;
   
  default:
   break;
  }
  
  // Link source and converter
  gst_bin_add_many(GST_BIN (pipeline), src, parse, convert,
   sample, encoder, payload, NULL);
  
  res = gst_element_link_many(src, parse, convert, sample, encoder, payload, NULL);
  g_assert(res == TRUE);


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: HELP: Link "wavparse" to "audioconvert" has error.

Tim-Philipp Müller-2
On Mon, 2009-11-02 at 18:37 +0800, Freeman Zhang wrote:
Hi,

 
> When I link "wavparse" to the "audioconvert" it is failed. but if I
> use "mad", it will success.
>  
> I have ran it from the command line:
> "gst-launch filesrc location=./media/login.wav ! wavparse !
> audioconvert ! audioresample ! alawenc ! rtppcmapay" it is ok.
>  
> I don't know why it failed, please help me, how can I can the error
> details?

Because that pipeline assumes that the .wav file contains raw audio
(which is the only thing audioconvert can handle). However, in the case
where it fails the .wav file seems to contain mp3-encoded audio, which
audioconvert can't handle (but 'mad' can).

You can avoid this kind of problem if you use the 'decodebin2' element
instead of wavparse. (or replace filesrc ! wavparse with
'uridecodebin').

Cheers
 -Tim



------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: HELP: Link "wavparse" to "audioconvert" has error.

Freeman Zhang
Oh~~~
Get it, thanks a lot.

2009/11/2 Tim-Philipp Müller <[hidden email]>
On Mon, 2009-11-02 at 18:37 +0800, Freeman Zhang wrote:
Hi,


> When I link "wavparse" to the "audioconvert" it is failed. but if I
> use "mad", it will success.
>
> I have ran it from the command line:
> "gst-launch filesrc location=./media/login.wav ! wavparse !
> audioconvert ! audioresample ! alawenc ! rtppcmapay" it is ok.
>
> I don't know why it failed, please help me, how can I can the error
> details?

Because that pipeline assumes that the .wav file contains raw audio
(which is the only thing audioconvert can handle). However, in the case
where it fails the .wav file seems to contain mp3-encoded audio, which
audioconvert can't handle (but 'mad' can).

You can avoid this kind of problem if you use the 'decodebin2' element
instead of wavparse. (or replace filesrc ! wavparse with
'uridecodebin').

Cheers
 -Tim



------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: HELP: Link "wavparse" to "audioconvert" has error.

Freeman Zhang
But, why the command line "gst-launch" can handle it?


 
2009/11/2 Freeman Zhang <[hidden email]>
Oh~~~
Get it, thanks a lot.

2009/11/2 Tim-Philipp Müller <[hidden email]>

On Mon, 2009-11-02 at 18:37 +0800, Freeman Zhang wrote:
Hi,


> When I link "wavparse" to the "audioconvert" it is failed. but if I
> use "mad", it will success.
>
> I have ran it from the command line:
> "gst-launch filesrc location=./media/login.wav ! wavparse !
> audioconvert ! audioresample ! alawenc ! rtppcmapay" it is ok.
>
> I don't know why it failed, please help me, how can I can the error
> details?

Because that pipeline assumes that the .wav file contains raw audio
(which is the only thing audioconvert can handle). However, in the case
where it fails the .wav file seems to contain mp3-encoded audio, which
audioconvert can't handle (but 'mad' can).

You can avoid this kind of problem if you use the 'decodebin2' element
instead of wavparse. (or replace filesrc ! wavparse with
'uridecodebin').

Cheers
 -Tim



------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel



------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: HELP: Link "wavparse" to "audioconvert" has error.

Tim-Philipp Müller-2
On Mon, 2009-11-02 at 19:57 +0800, Freeman Zhang wrote:

> But, why the command line "gst-launch" can handle it?

Ah, sorry, it seems I was a bit too quick and completely misunderstood
your problem.

The problem is that wavparse's sink pad is a sometimes pad which will be
added only later when data flow starts (-> 'dynamic pads'). The reason
for that is that wavparse needs to figure out the type of data first (it
uses dynamic pads for historical reason related to decodebin/playbin, it
doesn't strictly have to, but we can't change that now). So there will
be no sink pad to link to after the element has been created, and you
will need to do the linking to audioconvert or whatever in a pad-added
callback later.

Mad's sink pad on the other hand always exists, so you can link it right
away.

Still, I would recommend you just use uridecodebin/decodebin2/playbin2
if that's an option.

Cheers
 -Tim




------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: HELP: Link "wavparse" to "audioconvert" has error.

Freeman Zhang
Thanks you very much, I understand.

2009/11/2 Tim-Philipp Müller <[hidden email]>
On Mon, 2009-11-02 at 19:57 +0800, Freeman Zhang wrote:

> But, why the command line "gst-launch" can handle it?

Ah, sorry, it seems I was a bit too quick and completely misunderstood
your problem.

The problem is that wavparse's sink pad is a sometimes pad which will be
added only later when data flow starts (-> 'dynamic pads'). The reason
for that is that wavparse needs to figure out the type of data first (it
uses dynamic pads for historical reason related to decodebin/playbin, it
doesn't strictly have to, but we can't change that now). So there will
be no sink pad to link to after the element has been created, and you
will need to do the linking to audioconvert or whatever in a pad-added
callback later.

Mad's sink pad on the other hand always exists, so you can link it right
away.

Still, I would recommend you just use uridecodebin/decodebin2/playbin2
if that's an option.

Cheers
 -Tim




------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: HELP: Link "wavparse" to "audioconvert" has error.

Tim-Philipp Müller-2
In reply to this post by Tim-Philipp Müller-2
On Mon, 2009-11-02 at 12:17 +0000, Tim-Philipp Müller wrote:

> The problem is that wavparse's sink pad is a sometimes pad (...)
> Mad's sink pad on the other hand always exists, (...)

Err, source pad not sink pad.

Cheers
 -Tim


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel