Search code examples
c++windowsboostpluginsgstreamer

Custom Gstreamer plugin cannot be registered on Windows


I am writing plugin for C++ that uses boost shared memory as source. I am using Visual Studio 2022 and Windows 11 as environment. I used gstplugin.c gstplugin.h files from official gstreamer repository. My .dll compiles properly so I copied .dll and .pdb to lib\gstreamer-1.0. When I am using gst-inspect-1.0 shared_memory_source command I cannot see my plugin.

I tried to debug it with --gst-debug-level=4 but there is no information about my plugin. I tried some tinkering with environment variable GST_PLUGIN_PATH but it didn't help. I even deleted registry.x86_64-msvc.bin to force plugin discovery. Here is my code responsible for my plugin registration:

#ifndef PACKAGE
#define PACKAGE "shared_memory_source"
#endif
#define PACKAGE_VERSION "1.0"
#define GST_LICENSE "LGPL"
#define GST_PACKAGE_NAME "shared_memory_source"
#define GST_PACKAGE_ORIGIN "https://XDDDDSDSA.pl/"

// gstreamer looks for this structure to register plugins
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
    GST_VERSION_MINOR,
    plugin,
    "shared_memory_source",
    plugin_init,
    PACKAGE_VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)

I suspected that it may be issue with boost library linking: VS2022 linker settings

I want to know what am I missing and how to find future issues myself.


Solution

  • I solved my problem. It was typical rookie mistake. Name of the plugin is third argument that should be filled without quotes.

    GST_PLUGIN_DEFINE (
    GST_VERSION_MAJOR,
    GST_VERSION_MINOR,
    shared_memory_source,
    "description",
    plugin_init,
    PACKAGE_VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
    

    Definition GST_PLUGIN_DEFINE provides macro for wrapping name as string G_STRINGIFY(name) in my case G_STRINGIFY(shared_memory_source) which will look something like "shared_memory_source"