在为我的示例插件构建样板时,我遵循了Gst插件开发基础中可用的说明,在本例中是HelloWorld。
我通过在克隆的回购中调用make_element工具创建了示例插件
../tools/make_element HelloWorld
之后,我修改了gst-plugin目录中的meson.build,以包含生成的源文件,即gsthelloworld.h和gsthelloworld.c。
helloworld_sources = [
'src/gsthelloworld.c'
]
gsthelloworld = library('gsthelloworld',
helloworld_sources,
c_args: plugin_c_args,
dependencies : [gst_dep],
install : true,
install_dir : plugins_install_dir,
)
我在执行meson build && ninja -C build
后遇到了错误
gst-template/build/../gst-plugin/src/gsthelloworld.c:184: undefined reference to `GST_HELLOWORLD'
**there are multiple lines of the same errors happen at different part of the source file.
我似乎在两个生成的源文件中都找不到GST_HELLOWORLD
的声明。
查看Gst插件开发基础中的教程,我发现有一个宏声明遵循类似的命名约定,我的是HelloWorld,而提供的示例是MyFilter。
#define GST_MY_FILTER(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_MY_FILTER,GstMyFilter))
但是,我在生成的源文件中没有看到任何宏。因此,我猜它可能是作为gstplugin.c和gstplugin.h提供的模板编写的,与生成的源文件非常相似,如果我从构建文件中删除我的示例插件,就可以成功地编译它。
因此,我是否错过了与汇编相关的任何步骤?谢谢。
编辑:我是用Ubuntu18.04(GStreer1.14.5)在PC上这样做的。
发布于 2021-03-11 04:10:22
在……里面
#define GST_TYPE_HELLOWORLD (gst_my_filter_get_type())
G_DECLARE_FINAL_TYPE (GstHelloWorld, gst_hello_world,
GST, PLUGIN_TEMPLATE, GstElement)
将PLUGIN_TEMPLATE
替换为HELLOWORLD
发布于 2020-11-14 10:52:50
我将其与一个工作插件进行了比较,对gsthelloworld.h
的这一修改适用于我:
#define GST_TYPE_HELLOWORLD (gst_my_filter_get_type())
G_DECLARE_FINAL_TYPE (GstHelloWorld, gst_hello_world,
GST, PLUGIN_TEMPLATE, GstElement)
// You need to add this one below in your gsthelloworld.h
#define GST_HELLOWORLD(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_HELLOWORLD,GstHelloWorld))
发布于 2022-11-22 14:30:23
为我工作的是:
#ifndef __GST_MYFILTER_H__
#define __GST_MYFILTER_H__
#include <gst/gst.h>
G_BEGIN_DECLS
/* #defines don't like whitespacey bits */
#define GST_TYPE_MYFILTER \
(gst_my_filter_get_type())
#define GST_MYFILTER(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_MYFILTER,GstMyFilter))
#define GST_MYFILTER_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_MYFILTER,GstMyFilterClass))
#define GST_IS_MYFILTER(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_MYFILTER))
#define GST_IS_MYFILTER_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_MYFILTER))
typedef struct _GstMyFilter GstMyFilter;
typedef struct _GstMyFilterClass GstMyFilterClass;
struct _GstMyFilter
{
GstElement element;
GstPad *sinkpad, *srcpad;
gboolean silent;
};
struct _GstMyFilterClass
{
GstElementClass parent_class;
};
GType gst_my_filter_get_type (void);
G_END_DECLS
#endif /* __GST_MYFILTER_H__ */
这些也是构建命令:
https://stackoverflow.com/questions/60862505
复制