From ec366cfa3d178760c26ac303dffe98ed4e0abd9f Mon Sep 17 00:00:00 2001 From: Luke Yelavich Date: Tue, 3 Jul 2018 10:05:56 +1000 Subject: [PATCH] vlc-video: Load libvlccore.dylib on macOS As of version 3, libvlc on macOS is linked against libvlccore differently. Previously libvlccore was referred to via the @loader_path macro, now @rpath is used. As such, dlopen is no longer able to find libvlccore. Explicitly load libvlccore so that the symbols that libvlc needs can be found. Tested against VLC versions 2.2.8 and 3.0.3. --- plugins/vlc-video/vlc-video-plugin.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/plugins/vlc-video/vlc-video-plugin.c b/plugins/vlc-video/vlc-video-plugin.c index 4160f9107..d87ae5149 100644 --- a/plugins/vlc-video/vlc-video-plugin.c +++ b/plugins/vlc-video/vlc-video-plugin.c @@ -57,6 +57,10 @@ LIBVLC_MEDIA_LIST_PLAYER_NEXT libvlc_media_list_player_next_; LIBVLC_MEDIA_LIST_PLAYER_PREVIOUS libvlc_media_list_player_previous_; void *libvlc_module = NULL; +#ifdef __APPLE__ +void *libvlc_core_module = NULL; +#endif + libvlc_instance_t *libvlc = NULL; uint64_t time_start = 0; @@ -154,8 +158,14 @@ static bool load_libvlc_module(void) #ifdef __APPLE__ #define LIBVLC_DIR "/Applications/VLC.app/Contents/MacOS/" +/* According to otoolo -L, this is what libvlc.dylib wants. */ +#define LIBVLC_CORE_FILE LIBVLC_DIR "lib/libvlccore.dylib" #define LIBVLC_FILE LIBVLC_DIR "lib/libvlc.5.dylib" setenv("VLC_PLUGIN_PATH", LIBVLC_DIR "plugins", false); + libvlc_core_module = os_dlopen(LIBVLC_CORE_FILE); + + if (!libvlc_core_module) + return false; #else #define LIBVLC_FILE "libvlc.so.5" #endif @@ -204,6 +214,10 @@ void obs_module_unload(void) { if (libvlc) libvlc_release_(libvlc); +#ifdef __APPLE__ + if (libvlc_core_module) + os_dlclose(libvlc_core_module); +#endif if (libvlc_module) os_dlclose(libvlc_module); }