[vlc-commits] python: adapt to new libvlc_media_list_new API
Olivier Aubert
git at videolan.org
Thu Apr 8 09:54:27 UTC 2021
vlc/python | branch: master | Olivier Aubert <contact at olivieraubert.net> | Thu Apr 8 11:52:29 2021 +0200| [fc4858868c978c51c0e99a408a3b7e4a10702657] | committer: Olivier Aubert
python: adapt to new libvlc_media_list_new API
> http://git.videolan.org/gitweb.cgi/vlc/python.git/?a=commit;h=fc4858868c978c51c0e99a408a3b7e4a10702657
---
generator/templates/header.py | 2 +-
generator/templates/override.py | 9 ++++++++-
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/generator/templates/header.py b/generator/templates/header.py
index 4890308..e75fc2c 100755
--- a/generator/templates/header.py
+++ b/generator/templates/header.py
@@ -47,7 +47,7 @@ import sys
import functools
# Used by EventManager in override.py
-from inspect import getargspec
+from inspect import getargspec, signature
import logging
logger = logging.getLogger(__name__)
diff --git a/generator/templates/override.py b/generator/templates/override.py
index 35cb4b7..b10ab11 100644
--- a/generator/templates/override.py
+++ b/generator/templates/override.py
@@ -100,7 +100,14 @@ class Instance:
"""Create a new MediaList instance.
@param mrls: optional list of MRL strings, bytes, or PathLike objects.
"""
- l = libvlc_media_list_new(self)
+ # API 3 vs 4: libvlc_media_list_new does not take any
+ # parameter as input anymore.
+ if len(signature(libvlc_media_list_new).parameters) == 1:
+ # API <= 3
+ l = libvlc_media_list_new(self)
+ else:
+ # API >= 4
+ l = libvlc_media_list_new()
# We should take the lock, but since we did not leak the
# reference, nobody else can access it.
if mrls:
More information about the vlc-commits
mailing list