Type Find Function Not Called in GStreamer Plugin

2019-08-29 09:15发布

I have an element that decodes a media type, mytype for example. I want to register the type so that the decodebin element can use my element if needed. I added the code for what I thought would work, but my type_find() function is never called. Any ideas on what I'm doing wrong? Here's what the code looks like:

#define MY_CAPS (gst_static_caps_get(&my_caps))

static GstStaticCaps my_caps = GST_STATIC_CAPS("audio/x-mycaps");
static gchar *my_exts[] = { "mtype", NULL };

static void type_find(GstTypeFind *_type_find, gpointer callback)
{
   printf("Type Find Function\r\n");
   gst_type_find_suggest(_type_find, GST_TYPE_FIND_POSSIBLE, gst_static_caps_get(&my_caps));
}

gboolean plugin_init(GstPlugin *plugin)
{
   if(!gst_type_find_register(plugin, "mytype", GST_RANK_PRIMARY, type_find, my_exts, MY_CAPS, NULL, NULL))
     return FALSE;

   if(!gst_element_register(plugin, "myelement", GST_RANK_PRIMARY, MY_ELEMENT_TYPE)
      return FALSE;

   return(TRUE);
}

0条回答
登录 后发表回答