2 """Create a new Instance instance.
4 It may take as parameter either:
6 - a list of strings as first parameters
7 - the parameters given as the constructor parameters (must be strings)
8 - a MediaControl instance
13 elif p and isinstance(p[0], (int, long)):
14 # instance creation from ctypes
16 o._as_parameter_=ctypes.c_void_p(p[0])
18 elif len(p) == 1 and isinstance(p[0], basestring):
19 # Only 1 string parameter: should be a parameter line
21 elif len(p) == 1 and isinstance(p[0], (tuple, list)):
24 if p and isinstance(p[0], MediaControl):
25 return p[0].get_instance()
28 return libvlc_new(len(p), p, e)
30 def media_player_new(self, uri=None):
31 """Create a new Media Player object.
33 @param uri: an optional URI to play in the player.
36 p=libvlc_media_player_new(self, e)
38 p.set_media(self.media_new(uri))
42 def media_list_player_new(self):
43 """Create an empty Media Player object
46 p=libvlc_media_list_player_new(self, e)
51 """Create a new MediaControl instance
53 It may take as parameter either:
55 - a list of strings as first parameters
56 - the parameters given as the constructor parameters (must be strings)
62 elif p and isinstance(p[0], (int, long)):
63 # instance creation from ctypes
65 o._as_parameter_=ctypes.c_void_p(p[0])
67 elif len(p) == 1 and isinstance(p[0], basestring):
68 # Only 1 string parameter: should be a parameter line
70 elif len(p) == 1 and isinstance(p[0], (tuple, list)):
73 if p and isinstance(p[0], Instance):
74 e=MediaControlException()
75 return mediacontrol_new_from_instance(p[0])
77 e=MediaControlException()
78 return mediacontrol_new(len(p), p, e)
81 """Create a new MediaPlayer instance.
83 It may take as parameter either:
84 - a string (media URI). In this case, a vlc.Instance will be created.
90 elif p and isinstance(p[0], (int, long)):
91 # instance creation from ctypes
93 o._as_parameter_=ctypes.c_void_p(p[0])
96 if p and isinstance(p[0], Instance):
97 return p[0].media_player_new()
100 o=i.media_player_new()
102 o.set_media(i.media_new(p[0]))
105 def get_instance(self):
106 """Return the associated vlc.Instance.
108 return self._instance
110 class MediaListPlayer:
111 """Create a new MediaPlayer instance.
113 It may take as parameter either:
117 def __new__(cls, *p):
120 elif p and isinstance(p[0], (int, long)):
121 # instance creation from ctypes
122 o=object.__new__(cls)
123 o._as_parameter_=ctypes.c_void_p(p[0])
125 elif len(p) == 1 and isinstance(p[0], (tuple, list)):
128 if p and isinstance(p[0], Instance):
129 return p[0].media_list_player_new()
132 o=i.media_list_player_new()
135 def get_instance(self):
136 """Return the associated vlc.Instance.
138 return self._instance