-
-
Notifications
You must be signed in to change notification settings - Fork 72
Using a Redistributable macOS GStreamer
If you want to re-distribute GStreamer with your gstreamer-java application, it's fairly simply on Windows. You just include the GStreamer distribution in your application's layout and set PATH from your app before calling Gst.init(). On macOS, life is not so easy. Here's the magic you need to make it work.
Install the version of GStreamer you want to use. The macOS installer will install it here:
/Library/Frameworks/GStreamer.framework
Make a copy of the installation
$ sudo cp -R /Library/Frameworks/GStreamer.framework/Versions/1.0 ~/mygst
Change ownership of the layout
$ sudo chown -R jdoe ~/mygst # where jdoe is your user ID
Check to see if you need to use osxrelocator to adjust the library references in GStreamer's executables. Run:
$ otool -L ~/mygst/libexec/gstreamer-1.0/gst-plugin-scanner
The output will show which dynamic libraries (*.dylib) the scanner program uses. If you see absolute paths there (/Library/Frameworks/GStreamer.framework/…), then you need to do this adjustment. As of GStreamer 1.16. that is the case. A future release may not.
If you need to adjust, do the following:
$ git clone https://github.com/tito/osxrelocator.git ~/osxrelocator
$ python ~/osxrelocator/osxrelocator/__init__.py -r ~/mygst/libexec/gstreamer-1.0 /Library/Frameworks/GStreamer.framework/Versions/1.0/lib @executable_path/../../lib
In the gstreamer-java application, before calling Gst.init() on macOS, you'll need to do a few things.
Set property jna.library.path
to ~/mygst/lib
Set two environment variables: (use gstreamer-java's GLib class after setting the property above)
GST_PLUGIN_PATH_1_0=~/mygst/lib/gstreamer-1.0
GST_PLUGIN_SCANNER_1_0=~/mygst/libexec/gstreamer-1.0/gst-plugin-scanner
Obviously, GStreamer in the field is not going to be at ~/mygst. You're going to package what you created at ~/mygst into your application's layout. So the paths you set in the property and environment variables will be dynamically generated based on where the application is running from.