"Linking" to dynamically loaded plugins.
benoitlahoz
benoit.lahoz at carasuelo.org
Mon May 2 08:39:54 UTC 2016
Hello,
I'm building an umbrella framework on OSX (XCode) including GStreamer.
Everything works fine except for the plugins that doesn't have a dylib.
I add /-undefined dynamic_lookup/ to the Other Linker Flags in order to
avoid errors at build time.
Then, for instance, when I instantiate a gstdecklinksrc plugin it works
fine, but when I try to use its own specific functions in my code, the
runtime tells me that library was not loaded.
I'm wondering how GStreamer loads its plugins and how I can use the
functions of these plugins that don't have a shared library.
For information, before GStreamer initialization I run this method:
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
/**
* Get paths for GStreamer framework.
*/
NSString *frameworksPath = [[NSBundle mainBundle]
privateFrameworksPath];
NSString *scannerPath = [NSString stringWithFormat:@"%@/%@",
frameworksPath,
@"PiplStream.Framework/Versions/A/Frameworks/GStreamer.framework/Versions/0.3/libexec/gstreamer-1.0/gst-plugin-scanner"];
NSString *pluginsPath = [NSString stringWithFormat:@"%@/%@",
frameworksPath,
@"PiplStream.Framework/Versions/A/Frameworks/GStreamer.framework/Versions/0.3/lib/gstreamer-1.0/"];
NSString *gtkPath = [NSString stringWithFormat:@"%@/%@",
frameworksPath,
@"PiplStream.Framework/Versions/A/Frameworks/GStreamer.framework/Versions/0.3/"];
NSString *gioPath = [NSString stringWithFormat:@"%@/%@",
frameworksPath,
@"PiplStream.Framework/Versions/A/Frameworks/GStreamer.framework/Versions/0.3/lib/gio/modules/"];
NSString *gdkDirPath = [NSString stringWithFormat:@"%@/%@",
frameworksPath,
@"PiplStream.Framework/Versions/A/Frameworks/GStreamer.framework/Versions/0.3/lib/gdk-pixbuf-2.0/2.10.0/loaders/"];
NSString *gdkModPath = [NSString stringWithFormat:@"%@/%@",
frameworksPath,
@"PiplStream.Framework/Versions/A/Frameworks/GStreamer.framework/Versions/0.3/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache"];
/**
* Load libraries at this path if a compatible version is not found
on system.
*/
NSString *priorityPath = [NSString stringWithFormat:@"%@/%@",
frameworksPath,
@"PiplStream.Framework/Versions/A/Frameworks/GStreamer.framework/Versions/0.3/lib/"];
setenv("DYLD_FALLBACK_LIBRARY_PATH", [priorityPath UTF8String], 1);
/**
* Setup environment variables for GStreamer.
*/
setenv("GST_PLUGIN_SCANNER", [scannerPath UTF8String], 1);
setenv("GST_PLUGIN_PATH", [pluginsPath UTF8String], 1);
setenv("GTK_PATH", [gtkPath UTF8String], 1);
setenv("GIO_EXTRA_MODULES", [gioPath UTF8String], 1);
setenv("GDK_PIXBUF_MODULEDIR", [gdkDirPath UTF8String], 1);
setenv("GDK_PIXBUF_MODULE_FILE", [gdkModPath UTF8String], 1);
// Initialize GStreamer
gst_init(NULL, NULL);
});
Thank you!
Ben
--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Linking-to-dynamically-loaded-plugins-tp4677283.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
More information about the gstreamer-devel
mailing list