How does GStreamer load static plugins?

Sebastian Dröge slomo at circular-chaos.org
Tue Jun 4 23:33:50 PDT 2013


On Mi, 2013-06-05 at 04:21 +0300, Nikos Chantziaras wrote:
> On 03/06/13 00:28, Sebastian Dröge wrote:
> > On So, 2013-06-02 at 13:58 +0300, Nikos Chantziaras wrote:
> >> I'm not able to find any documentation on this.  How would I use
> >> GStreamer in an application that has GStreamer itself as well the
> >> plugins linked-in statically?  And for that matter, how would I link it
> >> correctly?  Are the pkg-config files enough, or should I instead
> >> manually link-in every plugin?
> >
> > You need to manually link in every single plugin that is going to be
> > used by your application and manually register it with
> > GST_PLUGIN_STATIC_DECLARE() and GST_PLUGIN_STATIC_REGISTER().
> 
> I've been battling with this for quite a while now.  I've successfully 
> built gstreamer 0.10 from the SDK source repo, so I've now got those 
> macros.  I used the "--enable-static-plugins" option when building.
> 
> But no matter what I do, I get "undefined reference" linker errors. 
> Even for this very simple test C program (main.c):
> 
>    #include <gst/gstplugin.h>
> 
>    GST_PLUGIN_STATIC_DECLARE(coreelements);
> 
>    int main(void)
>    {
>            GST_PLUGIN_STATIC_REGISTER(coreelements);
>            return 0;
>    }
> 
> I tried compiling with:
> 
>    gcc `pkg-config gstreamer-0.10 --cflags` main.c \
>      `pkg-config gstreamer-0.10 --libs` \
>      `pkg-config gstreamer-plugins-base-0.10 --libs`
> 
> That fails, so I'm trying to manually link against "libgstcoreelements.a":
> 
>    gcc `pkg-config gstreamer-0.10 --cflags` main.c \
>      `pkg-config gstreamer-0.10 --libs` \
>      `pkg-config gstreamer-plugins-base-0.10 --libs` \
>      -L/prefix/usr/lib/gstreamer-0.10 -lgstcoreelements
> 
> And even that produces the same "undefined reference" error.

That's exactly what you need to do, yes. What's the linker error you
get, what's the complete compiler output?

Also you still have to call gst_init() before registering static
plugins.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20130605/67b453fd/attachment.pgp>


More information about the gstreamer-devel mailing list