[vlc-commits] Fix libvlccore loading on MacOS X

Olivier Aubert git at videolan.org
Mon Feb 19 18:14:22 CET 2018


vlc/python | branch: master | Olivier Aubert <contact at olivieraubert.net> | Mon Feb 19 18:14:11 2018 +0100| [81926faa7bdefe3cdd01d64476154191de8c3702] | committer: Olivier Aubert

Fix libvlccore loading on MacOS X

Closes #37

> http://git.videolan.org/gitweb.cgi/vlc/python.git/?a=commit;h=81926faa7bdefe3cdd01d64476154191de8c3702
---

 generated/3.0/setup.py       |  6 +++---
 generated/3.0/vlc.py         | 15 ++++++++++-----
 generated/dev/vlc.py         | 38 +++++++++++---------------------------
 generator/generate.py        |  2 +-
 generator/templates/setup.py |  2 +-
 5 files changed, 26 insertions(+), 37 deletions(-)

diff --git a/generated/3.0/setup.py b/generated/3.0/setup.py
index 2a15dea..2a6769e 100644
--- a/generated/3.0/setup.py
+++ b/generated/3.0/setup.py
@@ -4,7 +4,7 @@ use_setuptools()
 from setuptools import setup
 
 setup(name='python-vlc',
-      version = '3.0.0101',
+      version = '3.0.0102',
       author='Olivier Aubert',
       author_email='contact at olivieraubert.net',
       maintainer='Olivier Aubert',
@@ -32,8 +32,8 @@ setup(name='python-vlc',
       long_description = """This module provides ctypes-based bindings (see
       http://wiki.videolan.org/PythonBinding) for the native libvlc
       API (see http://wiki.videolan.org/LibVLC) of the VLC video
-      player.
+      player. Note that it relies on an already present install of VLC.
 
       It has been automatically generated from the include files of
-      vlc 3.0.0, using generator 1.1.
+      vlc 3.0.0, using generator 1.2.
       """)
diff --git a/generated/3.0/vlc.py b/generated/3.0/vlc.py
index 5f16932..5c36110 100644
--- a/generated/3.0/vlc.py
+++ b/generated/3.0/vlc.py
@@ -52,10 +52,10 @@ from inspect import getargspec
 import logging
 logger = logging.getLogger(__name__)
 
-__version__ = "3.0.0101"
+__version__ = "3.0.0102"
 __libvlc_version__ = "3.0.0"
-__generator_version__ = "1.1"
-build_date  = "Thu Jan  4 23:45:25 2018 3.0.0"
+__generator_version__ = "1.2"
+build_date  = "Mon Feb 19 18:13:20 2018 3.0.0"
 
 # The libvlc doc states that filenames are expected to be in UTF8, do
 # not rely on sys.getfilesystemencoding() which will be confused,
@@ -178,15 +178,20 @@ def find_lib():
     elif sys.platform.startswith('darwin'):
         # FIXME: should find a means to configure path
         d = '/Applications/VLC.app/Contents/MacOS/'
+        c = d + 'lib/libvlccore.dylib'
         p = d + 'lib/libvlc.dylib'
-        if os.path.exists(p):
+        if os.path.exists(p) and os.path.exists(c):
+            # pre-load libvlccore VLC 2.2.8+
+            ctypes.CDLL(c)
             dll = ctypes.CDLL(p)
             for p in ('modules', 'plugins'):
                 p = d + p
                 if os.path.isdir(p):
                     plugin_path = p
                     break
-        else:  # hope, some PATH is set...
+        else:  # hope, some [DY]LD_LIBRARY_PATH is set...
+            # pre-load libvlccore VLC 2.2.8+
+            ctypes.CDLL('libvlccore.dylib')
             dll = ctypes.CDLL('libvlc.dylib')
 
     else:
diff --git a/generated/dev/vlc.py b/generated/dev/vlc.py
index 10ac259..6a65010 100644
--- a/generated/dev/vlc.py
+++ b/generated/dev/vlc.py
@@ -52,10 +52,10 @@ from inspect import getargspec
 import logging
 logger = logging.getLogger(__name__)
 
-__version__ = "4.0.0-dev-602-gde421537d9101"
-__libvlc_version__ = "4.0.0-dev-602-gde421537d9"
-__generator_version__ = "1.1"
-build_date  = "Thu Jan  4 23:33:14 2018 4.0.0-dev-602-gde421537d9"
+__version__ = "4.0.0-dev-1124-g10db447e00102"
+__libvlc_version__ = "4.0.0-dev-1124-g10db447e00"
+__generator_version__ = "1.2"
+build_date  = "Mon Feb 19 18:13:20 2018 4.0.0-dev-1124-g10db447e00"
 
 # The libvlc doc states that filenames are expected to be in UTF8, do
 # not rely on sys.getfilesystemencoding() which will be confused,
@@ -178,15 +178,20 @@ def find_lib():
     elif sys.platform.startswith('darwin'):
         # FIXME: should find a means to configure path
         d = '/Applications/VLC.app/Contents/MacOS/'
+        c = d + 'lib/libvlccore.dylib'
         p = d + 'lib/libvlc.dylib'
-        if os.path.exists(p):
+        if os.path.exists(p) and os.path.exists(c):
+            # pre-load libvlccore VLC 2.2.8+
+            ctypes.CDLL(c)
             dll = ctypes.CDLL(p)
             for p in ('modules', 'plugins'):
                 p = d + p
                 if os.path.isdir(p):
                     plugin_path = p
                     break
-        else:  # hope, some PATH is set...
+        else:  # hope, some [DY]LD_LIBRARY_PATH is set...
+            # pre-load libvlccore VLC 2.2.8+
+            ctypes.CDLL('libvlccore.dylib')
             dll = ctypes.CDLL('libvlc.dylib')
 
     else:
@@ -3571,15 +3576,6 @@ class MediaPlayer(_Ctype):
         return libvlc_media_player_set_android_context(self, p_awindow_handler)
 
     
-    def set_evas_object(self, p_evas_object):
-        '''Set the EFL Evas Object.
-        @param p_evas_object: a valid EFL Evas Object (Evas_Object).
-        @return: -1 if an error was detected, 0 otherwise.
-        @version: LibVLC 3.0.0 and later.
-        '''
-        return libvlc_media_player_set_evas_object(self, p_evas_object)
-
-    
     def audio_set_callbacks(self, play, pause, resume, flush, drain, opaque):
         '''Sets callbacks and private data for decoded audio.
         Use L{audio_set_format}() or L{audio_set_format_callbacks}()
@@ -6609,18 +6605,6 @@ def libvlc_media_player_set_android_context(p_mi, p_awindow_handler):
                     None, MediaPlayer, ctypes.c_void_p)
     return f(p_mi, p_awindow_handler)
 
-def libvlc_media_player_set_evas_object(p_mi, p_evas_object):
-    '''Set the EFL Evas Object.
-    @param p_mi: the media player.
-    @param p_evas_object: a valid EFL Evas Object (Evas_Object).
-    @return: -1 if an error was detected, 0 otherwise.
-    @version: LibVLC 3.0.0 and later.
-    '''
-    f = _Cfunctions.get('libvlc_media_player_set_evas_object', None) or \
-        _Cfunction('libvlc_media_player_set_evas_object', ((1,), (1,),), None,
-                    ctypes.c_int, MediaPlayer, ctypes.c_void_p)
-    return f(p_mi, p_evas_object)
-
 def libvlc_audio_set_callbacks(mp, play, pause, resume, flush, drain, opaque):
     '''Sets callbacks and private data for decoded audio.
     Use L{libvlc_audio_set_format}() or L{libvlc_audio_set_format_callbacks}()
diff --git a/generator/generate.py b/generator/generate.py
index 9b6aeca..3921db0 100755
--- a/generator/generate.py
+++ b/generator/generate.py
@@ -56,7 +56,7 @@ __all__     = ('Parser',
 
 # Version number MUST have a major < 10 and a minor < 99 so that the
 # generated dist version can be correctly generated.
-__version__ =  '1.1'
+__version__ =  '1.2'
 
 _debug = False
 
diff --git a/generator/templates/setup.py b/generator/templates/setup.py
index d5b58e0..ebfef37 100644
--- a/generator/templates/setup.py
+++ b/generator/templates/setup.py
@@ -32,7 +32,7 @@ setup(name='python-vlc',
       long_description = """This module provides ctypes-based bindings (see
       http://wiki.videolan.org/PythonBinding) for the native libvlc
       API (see http://wiki.videolan.org/LibVLC) of the VLC video
-      player.
+      player. Note that it relies on an already present install of VLC.
 
       It has been automatically generated from the include files of
       vlc {libvlc_version}, using generator {generator_version}.



More information about the vlc-commits mailing list