Reputation: 553
I have followed the instruction available in Gst Plugin Development Basics in constructing the boilerplate for my sample plugin which is HelloWorld in this case.
I have created the sample plugin by calling the make_element tool in the cloned repo
../tools/make_element HelloWorld
After that, I have modified the meson.build in gst-plugin directory to include the generated source files namely gsthelloworld.h and 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,
)
I encountered errors after doing 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.
I cant seem to find the declaration of GST_HELLOWORLD
in either generated source files.
Looking at the tutorial in Gst Plugin Development Basics, I see there was a declaration of macro that follows the similar naming convention with mine being HelloWorld while the provided sample being MyFilter.
#define GST_MY_FILTER(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_MY_FILTER,GstMyFilter))
However, I see none of the macro in the generated source files. So, I guess it might have been written somewhere else as the template provided in form of gstplugin.c and gstplugin.h looks very similar to the generated source files and can be compiled successfully if I remove my sample plugin from the build file.
Thus, is there any step I miss that is relevant for the compilation? Thanks.
EDITED: I was doing this on a PC with Ubuntu 18.04(gstreamer 1.14.5)
Upvotes: 0
Views: 454
Reputation: 1
The gstmyfilter.h which worked for me is:
#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__ */
Also these are build commands:
Upvotes: 0
Reputation: 21
In
#define GST_TYPE_HELLOWORLD (gst_my_filter_get_type())
G_DECLARE_FINAL_TYPE (GstHelloWorld, gst_hello_world,
GST, PLUGIN_TEMPLATE, GstElement)
replace PLUGIN_TEMPLATE
with HELLOWORLD
Upvotes: 2
Reputation: 19
I compared with a working plugin and this modification to gsthelloworld.h
worked for me :
#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))
Upvotes: 1