[vlc-commits] python bindings: fix void pointer handling
Olivier Aubert
git at videolan.org
Tue May 31 15:49:53 CEST 2011
vlc/python | branch: master | Olivier Aubert <olivier.aubert at liris.cnrs.fr> | Tue May 31 15:49:30 2011 +0200| [c342e0dc9739b3df8dc9a2271497ec86416deff6] | committer: Olivier Aubert
python bindings: fix void pointer handling
> http://git.videolan.org/gitweb.cgi/vlc/python.git/?a=commit;h=c342e0dc9739b3df8dc9a2271497ec86416deff6
---
generated/vlc.py | 6 +++++-
header.py | 4 ++++
test.py | 6 ++++++
3 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/generated/vlc.py b/generated/vlc.py
index cbbf3a9..2553042 100755
--- a/generated/vlc.py
+++ b/generated/vlc.py
@@ -47,7 +47,7 @@ import sys
from inspect import getargspec
__version__ = "N/A"
-build_date = "Wed May 18 15:32:47 2011"
+build_date = "Tue May 31 15:49:06 2011"
# Used on win32 and MacOS in override.py
plugin_path = None
@@ -174,6 +174,8 @@ class _Ctype(object):
def from_param(this): # not self
"""(INTERNAL) ctypes parameter conversion method.
"""
+ if this is None:
+ return None
return this._as_parameter_
class ListPOINTER(object):
@@ -204,6 +206,8 @@ def class_result(classname):
"""Errcheck function. Returns a function that creates the specified class.
"""
def wrap_errcheck(result, func, arguments):
+ if result is None:
+ return None
return classname(result)
return wrap_errcheck
diff --git a/header.py b/header.py
index 1cd7105..6d42eac 100755
--- a/header.py
+++ b/header.py
@@ -173,6 +173,8 @@ class _Ctype(object):
def from_param(this): # not self
"""(INTERNAL) ctypes parameter conversion method.
"""
+ if this is None:
+ return None
return this._as_parameter_
class ListPOINTER(object):
@@ -203,6 +205,8 @@ def class_result(classname):
"""Errcheck function. Returns a function that creates the specified class.
"""
def wrap_errcheck(result, func, arguments):
+ if result is None:
+ return None
return classname(result)
return wrap_errcheck
diff --git a/test.py b/test.py
index 4b006f5..0779726 100755
--- a/test.py
+++ b/test.py
@@ -86,6 +86,12 @@ class TestVLCAPI(unittest.TestCase):
p=i.media_player_new(mrl)
self.assertEqual(p.get_media().get_mrl(), mrl)
+ def test_libvlc_none_object(self):
+ i=vlc.Instance()
+ p=i.media_player_new()
+ p.set_media(None)
+ self.assertEqual(p.get_media(), None)
+
def test_libvlc_player_state(self):
mrl='/tmp/foo.avi'
i=vlc.Instance()
More information about the vlc-commits
mailing list