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 self._instance
108 class MediaListPlayer:
109 """Create a new MediaPlayer instance.
111 It may take as parameter either:
115 def __new__(cls, *p):
118 elif p and isinstance(p[0], (int, long)):
119 # instance creation from ctypes
120 o=object.__new__(cls)
121 o._as_parameter_=ctypes.c_void_p(p[0])
123 elif len(p) == 1 and isinstance(p[0], (tuple, list)):
126 if p and isinstance(p[0], Instance):
127 return p[0].media_list_player_new()
130 o=i.media_list_player_new()
133 def get_instance(self):
134 return self._instance