Commit 4b8fd642 authored by Olivier Aubert's avatar Olivier Aubert

python-ctypes: accomodate both old and new message exception getter

parent cb6d304e
...@@ -91,7 +91,30 @@ class LibVLCException(Exception): ...@@ -91,7 +91,30 @@ class LibVLCException(Exception):
pass pass
# From libvlc_structures.h # From libvlc_structures.h
class VLCException(ctypes.Structure):
# This is version-dependent, depending on the presence of libvlc_exception_get_message.
if hasattr(dll, 'libvlc_exception_get_message'):
# New-style message passing
class VLCException(ctypes.Structure):
"""libvlc exception.
"""
_fields_= [
('raised', ctypes.c_int),
]
@property
def message(self):
return dll.libvlc_exception_get_message()
def init(self):
libvlc_exception_init(self)
def clear(self):
libvlc_exception_clear(self)
else:
# Old-style exceptions
class VLCException(ctypes.Structure):
"""libvlc exception. """libvlc exception.
""" """
_fields_= [ _fields_= [
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment