Load Statically Linked GStreamer Plugin

gstreamer, static-libraries

Solution

With some help from the GStreamer developers I found the answer.... don't use version 0.10.36. :)

Basically the ability to build static plugin libraries was added/fixed in later versions. To get it to work in 0.10.36, I've had to back port changes from the GStreamer SDK and GStreamer 1.x into 0.10.36. Things are still a work in progress, but I am able to build `libgstcoreelements.`a and statically link with it. If I wasn't already building a modified version of 0.10.36, I probably would have just used the SDK.

Update

I created static versions of all of the libraries I'm using. My GStreamer library is now a bit of a hybrid between 0.10.36, the SDK, and 1.2.2, but it works. I wouldn't recommend this solution for anyone though. Use the SDK or version 1.x.

Problem

I'm working on software for an embedded system that uses GStreamer 0.10.36. My goal is to keep the software as small as possible in terms of Flash memory space, so I'd like to statically linking the GStreamer plugins I need. According to the Core Reference Manual: "There are options to statically link plugins to an app or even use GStreamer without a plugin repository in which case gst_plugin_load() can be needed to bring the plugin into memory. " Unfortunately, it's not clear to me exactly what I need to do to bring the plugin into memory such that a subsequent call to `gst_element_factory_make()` completes successfully. I'm doing the following: - Building GStreamer with `--enable-static` and `--disable-registry` set. - Linking the static library into my application - Call `gst_element_factory_make()` to create an element Right now I'm only doing this for one plugin (tcpclientsink) out of several as an experiment. I had to edit the Makefile for that plugin to remove a `--disable-static` statement to get the libgsttcp.a file to build. I assume the library is good, but I'm not sure if there is a good way to verify that. `gst-inspect` does not appear to work on static libraries. Note: If I call `load_gst_plugin(/path/to/libgsttcp.a)`, GStreamer fails to load the plugin because of an invalid ELF header. How does one load a statically linked GStreamer library?

Original source