Delay loading of GStreamer DLLs on Windows
Andy Robinson
andy at seventhstring.com
Thu Dec 10 02:16:54 PST 2015
On 09/12/15 18:09, Nirbheek Chauhan wrote:
> On Wed, Dec 9, 2015 at 5:13 PM, Andy Robinson <andy at seventhstring.com> wrote:
>> I could, as you say, bundle the DLLs. My app download for Windows is
>> currently 2.2 MB so it seems a little strange to increase that to over 100
>> MB (the size of gstreamer-1.0-x86-1.6.1-merge-modules.zip), when many of my
>
> You don't need to (and should never) ship the entire contents of that
> zip file with your application. Your application only links to a tiny
> subset of that, and you can check what it links to with dumpbin.
> Usually it's just libgstreamer-1.0-0.dll and its dependencies: orc,
> glib (libglib, libgmodule, libgobject), libintl, libffi. All these
> when compressed are less than 5MB.
>
>> users wouldn't need the extra capabilities that GStreamer would provide. I
>> would also have to think about how to comply with the licenses, as my app is
>> closed source so I can't just include everything (GPL license, patents,
>> etc).
>>
>
> Thanks to the plugin-based architecture of GStreamer, your application
> never links to any of these plugins (also these are all in
> gst-plugins-ugly), you don't need to ship any of them with your
> application, and basically no one does that. Just ship whatever
> plugins you use (mostly plugins from -base and -good) as a separate
> zip file for users to download if they want to use the extra features
> of your application.
>
> Of course, all this is a trade-off. If increasing the download from
> 2.2MB to 7-10MB is unacceptable to you, the shim is the other option.
Thanks for this - I'm going to try a different Plan A first but if I run
into any gotchas then I might well switch to this method.
My Plan A will be, use LoadLibrary and locate pointers to the functions
I need (not such a huge number after all) and change my code by
prefixing all the functions, e.g. gst_pipeline_new becomes
z_gst_pipeline_new, etc.
Then I can include the unmodified GST headers, followed by something
like this:
#if Linux
#define z_gst_pipeline_new gst_pipeline_new
#else
GstElement * (*z_gst_pipeline_new)();
#endif
I hope I'm not missing anything, but if this works then it wouldn't be
too painful. Come to think of it, if the headers have e.g. macros or
inline functions containing function calls then I would have to z_
prefix those macros as well, but hopefully that problem won't snowball
too much. The same applies to data exported from the DLLs.
Regards,
Andy Robinson, Seventh String Software, www.seventhstring.com
More information about the gstreamer-devel
mailing list