Type Find Function Not Called in GStreamer Plugin

谁都会走 提交于 2019-12-12 03:34:26

问题


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);
}

来源:https://stackoverflow.com/questions/14652668/type-find-function-not-called-in-gstreamer-plugin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!