Merge pull request #1356 from TheMuso/fix-vlc-plugin-on-mac

vlc-video: Dlopen libvlccore.dylib on mac OS
master
Jim 2018-07-07 11:50:00 -07:00 committed by GitHub
commit b00272210b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 0 deletions

View File

@ -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);
}