# FIXME: should find a means to configure path
dll=ctypes.CDLL('/Applications/VLC.app/Contents/MacOS/lib/libvlc.2.dylib')
+#
+# Generated enum types.
+#
+
+# GENERATED_ENUMS
+
+#
+# End of generated enum types.
+#
+
class ListPOINTER(object):
'''Just like a POINTER but accept a list of ctype as an argument.
'''
class MediaControlPosition(ctypes.Structure):
_fields_= [
- ('origin', ctypes.c_int),
- ('key', ctypes.c_int),
+ ('origin', PositionOrigin),
+ ('key', PositionKey),
('value', ctypes.c_longlong),
]
+ def __init__(self, value=0, origin=None, key=None):
+ # We override the __init__ method so that instanciating the
+ # class with an int as parameter will create the appropriate
+ # default position (absolute position, media time, with the
+ # int as value).
+ self.value=value
+ if origin is None:
+ origin=PositionOrigin.AbsolutePosition
+ if key is None:
+ key=PositionKey.MediaTime
+ self.origin=origin
+ self.key=key
+
def __str__(self):
return "MediaControlPosition %ld (%s, %s)" % (
self.value,
- str(PositionOrigin(self.origin)),
- str(PositionKey(self.key))
+ str(self.origin),
+ str(self.key)
)
@staticmethod
def from_param(arg):
if isinstance(arg, (int, long)):
- p=MediaControlPosition()
- p.value=arg
- p.key=2
+ p=MediaControlPosition(arg)
return p
else:
return arg
class MediaControlStreamInformation(ctypes.Structure):
_fields_= [
- ('status', ctypes.c_int),
+ ('status', PlayerStatus),
('url', ctypes.c_char_p),
('position', ctypes.c_longlong),
('length', ctypes.c_longlong),
]
def __str__(self):
- return "%s (%s) : %ld / %ld" % (self.url,
- str(PlayerStatus(self.status)),
+ return "%s (%s) : %ld / %ld" % (self.url or "<No defined URL>",
+ str(self.status),
self.position,
self.length)