两个自定义插件之间的元数据共享

问题描述

通过点击以下参考链接,我已经成功实现了元数据API。

https://gstreamer.freedesktop.org/documentation/plugin-d 
evelopment/advanced/allocation.html?gi-language=c#implementing-new- 
gstMeta

到目前为止,我已经完成了元数据写入和读取相同的自定义插件-1 ,如下所示。

自定义插件_1:

gst_custom-plugin-1_transform_frame_ip (GstVideoFilter * filter,GstVideoFrame * frame){

api_id =  my_example_Meta_api_get_type();
auto m =  gst_buffer_add_my_example_Meta(frame->buffer,40,"check"); // write data to buffer
MyExampleMeta* Meta= (MyExampleMeta*) gst_buffer_get_Meta(frame->buffer,api_id); // read it back to conform it 
std::cout << "Reading back: " << Meta->name << Meta->age <<  std::endl; 

}

通过从 GstVideoFrame缓冲区读回元数据,我验证了元数据已成功写入视频帧该元数据将传递到下一个自定义-plugin-2 ,如下所示。

src->custom_1--->custom_2---->display
    | Meta    |
    |---------|

问题

Encountring the below error when I am trying to get back the Meta data from the second custom plugin-2

 (gst-launch-1.0:2743): GStreamer-CRITICAL **: 02:54:07.460: gst_buffer_get_Meta: assertion 'api != 0' Failed

**自定义插件_2

 gst_custom-plugin-2_transform_frame_ip (GstVideoFilter * filter,GstVideoFrame * frame){    

 api_id =  my_example_Meta_api_get_type();
 MyExampleMeta* Meta =(MyExampleMeta*)gst_buffer_get_Meta(frame->buffer,api_id);
 }

GType
    my_example_Meta_api_get_type (void) // same as custom-plugin-1
    {
    static volatile GType type;
    static const gchar *tags[] = { "foo","bar",NULL };

    if (g_once_init_enter (&type)) {
    GType _type = gst_Meta_api_type_register ("MyExampleMetaAPI",tags);
    g_once_init_leave (&type,_type);
    }
    return type;
}

我做错了什么吗?有人可以指导我如何读回我集成到1-custom插件中GstVideoFrame框架的元数据吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)