decodebin2 doesn't call my decoder

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

decodebin2 doesn't call my decoder

Yuancheng Zheng

Hi,

I implemented an voice decoder plugin "audiodecoder" with data type, ie. ydt. I can succeed in playing back a file with gst-launch in this way:
    gst-launch filesrc location data.ydt  !  audiodecoder  !  filesink location=myout.pcm

However, I failed in playing back the same file using decodebin2 in this way:
    gst-launch filesrc location data.ydt  !  decodebin2  !  filesink location=myout.pcm

I implemented a typefind function in my audiodecoder plugin:

static gchar *ydt_exts[] = { "ydt", NULL };
static void ydt_typefind_function (GstTypeFind   *tf,
                                                      gpointer      data)
{
  guint8 *typedata = gst_type_find_peek (tf, 8, 4);
  GstCaps* decoderCaps = NULL;
 
  if( typedata == NULL )
  return;


  /* verify YDT container */
  if (memcmp ((char *)typedata, "ydt ", 4) != 0)
        return;

   GST_DEBUG("YDT data type found\n");

   decoderCaps = gst_caps_new_simple("audio/ydt",
            "rate", G_TYPE_INT, 8000,
            "channels", G_TYPE_INT, 1,
                "width", G_TYPE_INT, 16,
                "depth", G_TYPE_INT, 16,
            "endianness", G_TYPE_INT, BYTE_ORDER,
            "signed", G_TYPE_BOOLEAN, TRUE, NULL);

  gst_type_find_suggest (tf, GST_TYPE_FIND_LIKELY, decoderCaps);
  gst_caps_unref (decoderCaps);

}

static gboolean plugin_init (GstPlugin * plugin)
{
    ......
   
        /* register typefind function */
    if(!gst_type_find_register (plugin, "audio/ydt", GST_RANK_MARGINAL,
                           ydt_typefind_function,
                           ydt_exts,
                           GST_CAPS_ANY, NULL, NULL))
 
   ......

}

By using gst-typefind I know that the data type YDT is verified and its caps are displayed correctly. The application decodbin2 display correct caps too.

My problem starts from here: after typefind verifies YDT data type, decodebin2 repeats calling my typefind function and not move on. It seems that decodebin2 can't find appropriate element to connect to.

The setting of pads of my audiodecoder plugin are as below:
static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
    GST_PAD_SINK,
    GST_PAD_ALWAYS,
    GST_STATIC_CAPS ( "audio/x-raw-int, endianness = (int) BYTE_ORDER, signed = (boolean) true, width = (int) 16, depth = (int) 16, channels = (int) 1, rate = (int) 8000")
    );


static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
    GST_PAD_SRC,
    GST_PAD_ALWAYS,
    GST_STATIC_CAPS (
        "audio/x-raw-int, "
        "width = (int) 16, "
        "depth = (int) 16, "
        "endianness = (int) BYTE_ORDER, "
        "channels = (int) 1, "
        "samplerate = (int) {8000}"
    )
    );

Can somebody help me fix the issue the implementation of my audio decoder with using decodebin2?

Thanks,



------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: decodebin2 doesn't call my decoder

michael smith-6-3
On Thu, Jun 17, 2010 at 1:14 PM, Yuancheng Zheng
<[hidden email]> wrote:
>
> Hi,
>
> I implemented an voice decoder plugin "audiodecoder" with data type, ie. ydt. I can succeed in playing back a file with gst-launch in this way:
>    gst-launch filesrc location data.ydt  !  audiodecoder  !  filesink location=myout.pcm
>
> However, I failed in playing back the same file using decodebin2 in this way:
>    gst-launch filesrc location data.ydt  !  decodebin2  !  filesink location=myout.pcm

The problem becomes obvious looking at your template caps for your decoder:

>
> The setting of pads of my audiodecoder plugin are as below:
> static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
>    GST_PAD_SINK,
>    GST_PAD_ALWAYS,
>    GST_STATIC_CAPS ( "audio/x-raw-int, endianness = (int) BYTE_ORDER, signed = (boolean) true, width = (int) 16, depth = (int) 16, channels = (int) 1, rate = (int) 8000")
>    );

Your decoder only accepts audio/x-raw-int, i.e. raw PCM audio. You
presumably wanted this to be your "audio/ydt" format.

Mike

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel