GStreamer GstVideoTestSrcPattern枚举-它在哪里?

GStreamer GstVideoTestSrcPattern枚举-它在哪里?,c,gstreamer-1.0,C,Gstreamer 1.0,我正在尝试为我的videotestsrc设置“模式”: #include <gst/gst.h> GstElement *pipeline, *source, *sink; ... source = gst_element_factory_make("videotestsrc", "source"); g_object_set(source, "pattern", GST_VIDEO_TEST_SRC_BALL, NULL); 要为GstVideoTestSrcPatternen

我正在尝试为我的
videotestsrc
设置“模式”:

#include <gst/gst.h>

GstElement *pipeline, *source, *sink;
...
source = gst_element_factory_make("videotestsrc", "source");
g_object_set(source, "pattern", GST_VIDEO_TEST_SRC_BALL, NULL);

要为
GstVideoTestSrcPattern
enum声明,我需要包含哪些标头?我搜索了一下,找不到它。

枚举是在gst插件库中的gst/videotestsrc/gstvideotestsrc.h头中定义的。这是一个不以任何方式公开的头(因为这意味着GstVideoTestSrc结构将成为公共API/ABI的一部分)。因此,不能使用实际的枚举符号

要解决这个问题,可以使用相应的整数值(在本例中为18)。如果您实际使用类似于
gst-launch-1.0
或其C等价物
gst\u parse\u launch()
的内容设置属性,那么实际上可以使用
videotestsrc pattern=ball
,这也会起作用

(注意:您甚至可以在
gst\u value\u deserialize()
的帮助下自己实现上述类型的字符串反序列化,但它仍然需要您输入一个在编译时未检查的字符串)


最后,如果您不确定枚举的各种值是什么,您可以使用
gst-inspect-1.0 videotestsrc
作为备忘单。

如果答案有用且正确,请接受答案。
error: ‘GST_VIDEO_TEST_SRC_BALL’ undeclared (first use in this function)