首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >gobject自检元素类型GstStructure

gobject自检元素类型GstStructure
EN

Stack Overflow用户
提问于 2016-04-04 01:25:15
回答 1查看 226关注 0票数 0

根据this,我认为使用python绑定创建GArray是不可能的。为了克服这个问题,我正在编写一个小型库,它将返回一个GArray。这个库利用了gobject内省并公开了一个方法create_codec_array。

代码语言:javascript
复制
/**
* webrtc_interface_create_codec_array:
* @interface: a #WebrtcInterface
*
* creates codecs_array.
*
* Returns: (element-type GstStructure) (transfer full): a #GArray of #GstStructure
*/
GArray *
webrtc_interface_create_codec_array (WebrtcInterface * interface)
{
 WebrtcInterfacePrivate *priv ;
 g_return_if_fail (interface != NULL);

 priv = WEBRTC_INTERFACE_GET_PRIVATE (interface);
 gchar * codecs[] = {priv->codec, NULL};

 GArray *a = g_array_new (FALSE, TRUE, sizeof (GValue));
 int i;

 for (i=0; i < g_strv_length (codecs); i++) {
     GValue v = G_VALUE_INIT;
     GstStructure *s;

     g_value_init (&v, GST_TYPE_STRUCTURE);
     s = gst_structure_new (codecs[i], NULL, NULL);
     gst_value_set_structure (&v, s);
     gst_structure_free (s);
     g_array_append_val (a, v);
 }

 return a;
}

当我运行g-ir-scanner时,我得到以下错误:

代码语言:javascript
复制
webrtc_interface.c:149: Warning: Webrtc: webrtc_interface_create_codec_array: 
Unknown type: 'GstStructure'

这个函数返回一个GstStructure元素的GArray,我不能自省。在这种情况下,元素类型注释应该是什么?

非常感谢!

EN

回答 1

Stack Overflow用户

发布于 2017-03-03 19:10:28

GstStructure是一种内省类型--它是在Gst-1.0.gir中定义的。当你运行--include Gst-1.0来构建你的GIR时,你会把它传递给g-ir-scanner吗?

如果您正在使用GIR autotools integration (如果您正在使用autotools,则强烈建议您),可以通过将Gst-1.0添加到您的GIR模块的*_INCLUDES变量来完成此操作。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/36388642

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档