[gst-devel] decodebin2 doesn't call my decoder

Yuancheng Zheng Yuancheng.Zheng at palm.com
Thu Jun 17 22:14:22 CEST 2010


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 )

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

   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,
		  	      			    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_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",
        "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?


More information about the gstreamer-devel mailing list