mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-09-19 20:32:15 +02:00
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.
This commit is contained in:
parent
a705030b23
commit
ec366cfa3d
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user