]> git.sesse.net Git - vlc/blob - bindings/python/vlc_instance.c
python bindings: documentation update
[vlc] / bindings / python / vlc_instance.c
1 /*****************************************************************************
2  * vlc_instance.c: vlc.Instance binding
3  *****************************************************************************
4  * Copyright (C) 2006 the VideoLAN team
5  * $Id: $
6  *
7  * Authors: Olivier Aubert <oaubert at bat710.univ-lyon1.fr>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22  *****************************************************************************/
23 #include "vlcglue.h"
24
25 /* Helper functions */
26 static int
27 pyoptions_to_args(PyObject *py_options, char*** pppsz_args)
28 {
29     int i_size;
30     int i_index;
31     char** ppsz_args = *pppsz_args;
32     
33     ppsz_args = NULL;
34
35     Py_INCREF( py_options );
36     if( ! PySequence_Check( py_options ) )
37     {
38         PyErr_SetString( PyExc_TypeError, "Parameter must be a sequence." );
39         return -1;
40     }
41     i_size = PySequence_Size( py_options );
42     ppsz_args = malloc( ( i_size + 1 ) * sizeof( char * ) );
43     if( ! ppsz_args )
44     {
45         PyErr_SetString( PyExc_MemoryError, "Out of memory" );
46         return -1;
47     }
48
49     for ( i_index = 0; i_index < i_size; i_index++ )
50     {
51         ppsz_args[i_index] =
52             strdup( PyString_AsString( PyObject_Str(
53                                            PySequence_GetItem( py_options,
54                                                                i_index ) ) ) );
55     }
56     ppsz_args[i_size] = NULL;
57     Py_DECREF( py_options );
58     return i_size;
59 }
60
61 static void
62 free_args(int i_size, char** ppsz_args)
63 {
64     int i_index;
65
66     for ( i_index = 0; i_index < i_size; i_index++ )
67         if( ppsz_args[i_index] )
68             free(ppsz_args[i_index]);
69     free( ppsz_args );
70 }
71
72 /*****************************************************************************
73  * Instance object implementation
74  *****************************************************************************/
75
76 static PyObject *
77 vlcInstance_new( PyTypeObject *type, PyObject *args, PyObject *kwds )
78 {
79     vlcInstance *self;
80     libvlc_exception_t ex;
81     PyObject* py_list = NULL;
82     char** ppsz_args = NULL;
83     int i_size = 0;
84
85     self = PyObject_New( vlcInstance, &vlcInstance_Type );
86
87
88     if( PyArg_ParseTuple( args, "O", &py_list ) )
89     {
90         i_size = pyoptions_to_args( py_list, &ppsz_args );
91         if( i_size < 0 )
92             return NULL;
93     }
94     else
95     {
96         /* No arguments were given. Clear the exception raised
97            by PyArg_ParseTuple. */
98         PyErr_Clear( );
99     }
100
101     Py_BEGIN_ALLOW_THREADS
102     LIBVLC_TRY
103     LIBVLC_INSTANCE->p_instance = libvlc_new( i_size, ppsz_args, &ex );
104     free_args( i_size, ppsz_args );
105     LIBVLC_EXCEPT
106     Py_END_ALLOW_THREADS
107
108     Py_INCREF( self );
109     return ( PyObject * )self;
110 }
111
112 static void
113 vlcInstance_dealloc( PyObject *self )
114 {
115     libvlc_exception_t ex;
116     libvlc_destroy( LIBVLC_INSTANCE->p_instance, &ex );
117     PyMem_DEL( self );
118 }
119
120 static PyObject *
121 vlcInstance_get_vlc_id( PyObject *self, PyObject *args )
122 {
123     return Py_BuildValue( "i", libvlc_get_vlc_id( LIBVLC_INSTANCE->p_instance ) );
124 }
125
126 /* Playlist play. 2 parameters: i_id, the id to play
127    l_options: a list of options */
128 static PyObject *
129 vlcInstance_playlist_play( PyObject *self, PyObject *args )
130 {
131     libvlc_exception_t ex;
132     int i_id = -1;
133     PyObject *py_options = NULL;
134     int i_size = 0;
135     char** ppsz_args = NULL;
136
137     if( !PyArg_ParseTuple( args, "|iO", &i_id, &py_options ) )
138         return NULL;
139
140     if( py_options )
141     {        
142         i_size = pyoptions_to_args( py_options, &ppsz_args );
143     }
144
145     LIBVLC_TRY;
146     libvlc_playlist_play( LIBVLC_INSTANCE->p_instance, i_id, i_size, ppsz_args, &ex );
147     free_args( i_size, ppsz_args );
148     LIBVLC_EXCEPT;
149
150     Py_INCREF( Py_None );
151     return Py_None;
152 }
153
154 static PyObject *
155 vlcInstance_playlist_pause( PyObject *self, PyObject *args )
156 {
157     libvlc_exception_t ex;
158     LIBVLC_TRY;
159     libvlc_playlist_pause( LIBVLC_INSTANCE->p_instance, &ex );
160     LIBVLC_EXCEPT;
161     Py_INCREF( Py_None );
162     return Py_None;
163 }
164
165 static PyObject *
166 vlcInstance_playlist_isplaying( PyObject *self, PyObject *args )
167 {
168     libvlc_exception_t ex;
169     int i_ret;
170
171     LIBVLC_TRY;
172     i_ret = libvlc_playlist_isplaying( LIBVLC_INSTANCE->p_instance, &ex );
173     LIBVLC_EXCEPT;
174     return Py_BuildValue( "i", i_ret );
175 }
176
177 static PyObject *
178 vlcInstance_playlist_items_count( PyObject *self, PyObject *args )
179 {
180     libvlc_exception_t ex;
181     int i_ret;
182
183     LIBVLC_TRY;
184     i_ret = libvlc_playlist_items_count( LIBVLC_INSTANCE->p_instance, &ex );
185     LIBVLC_EXCEPT;
186     return Py_BuildValue( "i", i_ret );
187 }
188
189 static PyObject *
190 vlcInstance_playlist_stop( PyObject *self, PyObject *args )
191 {
192     libvlc_exception_t ex;
193     LIBVLC_TRY;
194     libvlc_playlist_stop( LIBVLC_INSTANCE->p_instance, &ex );
195     LIBVLC_EXCEPT;
196     Py_INCREF( Py_None );
197     return Py_None;
198 }
199
200 static PyObject *
201 vlcInstance_playlist_next( PyObject *self, PyObject *args )
202 {
203     libvlc_exception_t ex;
204     LIBVLC_TRY;
205     libvlc_playlist_next( LIBVLC_INSTANCE->p_instance, &ex );
206     LIBVLC_EXCEPT;
207     Py_INCREF( Py_None );
208     return Py_None;
209 }
210
211 static PyObject *
212 vlcInstance_playlist_prev( PyObject *self, PyObject *args )
213 {
214     libvlc_exception_t ex;
215     LIBVLC_TRY;
216     libvlc_playlist_prev( LIBVLC_INSTANCE->p_instance, &ex );
217     LIBVLC_EXCEPT;
218     Py_INCREF( Py_None );
219     return Py_None;
220 }
221
222 static PyObject *
223 vlcInstance_playlist_clear( PyObject *self, PyObject *args )
224 {
225     libvlc_exception_t ex;
226     LIBVLC_TRY;
227     libvlc_playlist_clear( LIBVLC_INSTANCE->p_instance, &ex );
228     LIBVLC_EXCEPT;
229     Py_INCREF( Py_None );
230     return Py_None;
231 }
232
233 /* Add a playlist item. Main parameter: URI.
234    Optional parameters: name, options */
235 static PyObject *
236 vlcInstance_playlist_add( PyObject *self, PyObject *args)
237 {
238     libvlc_exception_t ex;
239     int i_ret;
240     char* psz_uri = NULL;
241     char* psz_name = NULL;
242     PyObject *py_options = NULL;
243     int i_size = 0;
244     char** ppsz_args = NULL;
245
246     if( !PyArg_ParseTuple( args, "s|sO", &psz_uri, &psz_name, &py_options ) )
247         return NULL;
248
249     if( !psz_name )
250     {
251         /* Set a default name */
252         psz_name = strdup( psz_uri );
253     }
254
255     if( py_options )
256     {        
257         i_size = pyoptions_to_args( py_options, &ppsz_args );
258     }
259
260     LIBVLC_TRY;
261     if( ppsz_args )
262     {
263         i_ret = libvlc_playlist_add_extended( LIBVLC_INSTANCE->p_instance,
264                                               psz_uri,
265                                               psz_name,
266                                               i_size,
267                                               ppsz_args,
268                                               &ex );
269         free_args( i_size, ppsz_args );
270     }
271     else
272     {
273         i_ret = libvlc_playlist_add( LIBVLC_INSTANCE->p_instance,
274                                      psz_uri,
275                                      psz_name,
276                                      &ex );
277     }
278     LIBVLC_EXCEPT;
279
280     return Py_BuildValue( "i", i_ret );
281 }
282
283 static PyObject *
284 vlcInstance_playlist_delete_item( PyObject *self, PyObject *args )
285 {
286     libvlc_exception_t ex;
287     int i_id;
288     int i_ret;
289
290     if( !PyArg_ParseTuple( args, "i", &i_id ) )
291         return NULL;
292
293     LIBVLC_TRY;
294     i_ret = libvlc_playlist_delete_item( LIBVLC_INSTANCE->p_instance, i_id, &ex );
295     LIBVLC_EXCEPT;
296
297     return Py_BuildValue( "i", i_ret );
298 }
299
300 static PyObject *
301 vlcInstance_playlist_get_input( PyObject *self, PyObject *args )
302 {
303     libvlc_exception_t ex;
304     libvlc_input_t *p_input;
305     vlcInput *p_ret;
306
307     LIBVLC_TRY;
308     p_input = libvlc_playlist_get_input( LIBVLC_INSTANCE->p_instance, &ex );
309     LIBVLC_EXCEPT;
310
311     p_ret = PyObject_New( vlcInput, &vlcInput_Type );
312     p_ret->p_input = p_input;
313     Py_INCREF( p_ret ); /* Ah bon ? */
314     return ( PyObject * )p_ret;
315 }
316
317 static PyObject *
318 vlcInstance_video_set_parent( PyObject *self, PyObject *args )
319 {
320     libvlc_exception_t ex;
321     int i_drawable;
322
323     if( !PyArg_ParseTuple( args, "i", &i_drawable ) )
324         return NULL;
325
326     LIBVLC_TRY;
327     libvlc_video_set_parent( LIBVLC_INSTANCE->p_instance, (libvlc_drawable_t) i_drawable, &ex );
328     LIBVLC_EXCEPT;
329
330     Py_INCREF( Py_None );
331     return Py_None;
332 }
333
334 static PyObject *
335 vlcInstance_video_set_size( PyObject *self, PyObject *args )
336 {
337     libvlc_exception_t ex;
338     int i_width;
339     int i_height;
340
341     if( !PyArg_ParseTuple( args, "ii", &i_width, &i_height ) )
342         return NULL;
343
344     LIBVLC_TRY;
345     libvlc_video_set_size( LIBVLC_INSTANCE->p_instance, i_width, i_height, &ex );
346     LIBVLC_EXCEPT;
347
348     Py_INCREF( Py_None );
349     return Py_None;
350 }
351
352 static PyObject *
353 vlcInstance_audio_toggle_mute( PyObject *self, PyObject *args )
354 {
355     libvlc_exception_t ex;
356     LIBVLC_TRY;
357     libvlc_audio_toggle_mute( LIBVLC_INSTANCE->p_instance, &ex );
358     LIBVLC_EXCEPT;
359     Py_INCREF( Py_None );
360     return Py_None;
361 }
362
363 static PyObject *
364 vlcInstance_audio_get_mute( PyObject *self, PyObject *args )
365 {
366     libvlc_exception_t ex;
367     int i_ret;
368
369     LIBVLC_TRY;
370     i_ret = libvlc_audio_get_mute( LIBVLC_INSTANCE->p_instance, &ex );
371     LIBVLC_EXCEPT;
372     return Py_BuildValue( "i", i_ret );
373 }
374
375 static PyObject *
376 vlcInstance_audio_set_mute( PyObject *self, PyObject *args )
377 {
378     libvlc_exception_t ex;
379     int i_mute;
380
381     if( !PyArg_ParseTuple( args, "i", &i_mute ) )
382         return NULL;
383
384     LIBVLC_TRY;
385     libvlc_audio_set_mute( LIBVLC_INSTANCE->p_instance, i_mute, &ex );
386     LIBVLC_EXCEPT;
387     Py_INCREF( Py_None );
388     return Py_None;
389 }
390
391 static PyObject *
392 vlcInstance_audio_get_volume( PyObject *self, PyObject *args )
393 {
394     libvlc_exception_t ex;
395     int i_ret;
396
397     LIBVLC_TRY;
398     i_ret = libvlc_audio_get_volume( LIBVLC_INSTANCE->p_instance, &ex );
399     LIBVLC_EXCEPT;
400     return Py_BuildValue( "i", i_ret );
401 }
402
403 static PyObject *
404 vlcInstance_audio_set_volume( PyObject *self, PyObject *args )
405 {
406     libvlc_exception_t ex;
407     int i_volume;
408
409     if( !PyArg_ParseTuple( args, "i", &i_volume ) )
410         return NULL;
411
412     LIBVLC_TRY;
413     libvlc_audio_set_mute( LIBVLC_INSTANCE->p_instance, i_volume, &ex );
414     LIBVLC_EXCEPT;
415     Py_INCREF( Py_None );
416     return Py_None;
417 }
418
419 /* vlm_add_broadcast : name, input MRL, output MRL
420    Keywords: options, enable, loop */
421 static PyObject *
422 vlcInstance_vlm_add_broadcast( PyObject *self, PyObject *args, PyObject *kwds )
423 {
424     libvlc_exception_t ex;
425     static char *kwlist[] = { "name", "input", "output", 
426                               "options", "enable", "loop", NULL};
427     char* psz_name = NULL;
428     char* psz_input = NULL;
429     char* psz_output = NULL;
430     PyObject* py_options = NULL;
431     int i_enable = 1;
432     int i_loop = 0;
433     int i_size = 0;
434     char** ppsz_args = NULL;
435
436     if( !PyArg_ParseTupleAndKeywords( args, kwds, "sss|Oii", kwlist, 
437                                       &psz_name,
438                                       &psz_input, &psz_output,
439                                       &py_options, &i_enable, &i_loop ) )
440         return NULL;
441     
442     if( py_options )
443     {
444         i_size = pyoptions_to_args( py_options, &ppsz_args );
445     }
446    
447     LIBVLC_TRY;
448     libvlc_vlm_add_broadcast( LIBVLC_INSTANCE->p_instance, 
449                               psz_name, psz_input, psz_output,
450                               i_size, ppsz_args, i_enable, i_loop, &ex);
451     free_args( i_size, ppsz_args );
452     LIBVLC_EXCEPT;
453     Py_INCREF( Py_None );
454     return Py_None;
455 }
456
457 static PyObject *
458 vlcInstance_vlm_del_media( PyObject *self, PyObject *args )
459 {
460     libvlc_exception_t ex;
461     char* psz_name;
462
463     if( !PyArg_ParseTuple( args, "s", &psz_name ) )
464         return NULL;
465
466     LIBVLC_TRY;
467     libvlc_vlm_del_media( LIBVLC_INSTANCE->p_instance, psz_name, &ex);
468     LIBVLC_EXCEPT;
469     Py_INCREF( Py_None );
470     return Py_None;
471 }
472
473 static PyObject *
474 vlcInstance_vlm_set_enabled( PyObject *self, PyObject *args )
475 {
476     libvlc_exception_t ex;
477     char* psz_name;
478     int i_enabled;
479     
480     if( !PyArg_ParseTuple( args, "si", &psz_name, &i_enabled ) )
481         return NULL;
482
483     LIBVLC_TRY;
484     libvlc_vlm_set_enabled( LIBVLC_INSTANCE->p_instance, psz_name, i_enabled, &ex);
485     LIBVLC_EXCEPT;
486     Py_INCREF( Py_None );
487     return Py_None;
488 }
489
490 static PyObject *
491 vlcInstance_vlm_set_output( PyObject *self, PyObject *args )
492 {
493     libvlc_exception_t ex;
494     char* psz_name;
495     char* psz_output;
496     
497     if( !PyArg_ParseTuple( args, "ss", &psz_name, &psz_output ) )
498         return NULL;
499
500     LIBVLC_TRY;
501     libvlc_vlm_set_output( LIBVLC_INSTANCE->p_instance, psz_name, psz_output, &ex);
502     LIBVLC_EXCEPT;
503     Py_INCREF( Py_None );
504     return Py_None;
505 }
506
507 static PyObject *
508 vlcInstance_vlm_set_input( PyObject *self, PyObject *args )
509 {
510     libvlc_exception_t ex;
511     char* psz_name;
512     char* psz_input;
513     
514     if( !PyArg_ParseTuple( args, "ss", &psz_name, &psz_input ) )
515         return NULL;
516
517     LIBVLC_TRY;
518     libvlc_vlm_set_input( LIBVLC_INSTANCE->p_instance, psz_name, psz_input, &ex);
519     LIBVLC_EXCEPT;
520     Py_INCREF( Py_None );
521     return Py_None;
522 }
523
524 static PyObject *
525 vlcInstance_vlm_set_loop( PyObject *self, PyObject *args )
526 {
527     libvlc_exception_t ex;
528     char* psz_name;
529     int i_loop;
530     
531     if( !PyArg_ParseTuple( args, "si", &psz_name, &i_loop ) )
532         return NULL;
533
534     LIBVLC_TRY;
535     libvlc_vlm_set_loop( LIBVLC_INSTANCE->p_instance, psz_name, i_loop, &ex);
536     LIBVLC_EXCEPT;
537     Py_INCREF( Py_None );
538     return Py_None;
539 }
540
541 static PyObject *
542 vlcInstance_vlm_change_media( PyObject *self, PyObject *args, PyObject *kwds )
543 {
544     libvlc_exception_t ex;
545     static char *kwlist[] = { "name", "input", "output", 
546                               "options", "enable", "loop", NULL};
547     char* psz_name = NULL;
548     char* psz_input = NULL;
549     char* psz_output = NULL;
550     PyObject* py_options = NULL;
551     int i_enable = 1;
552     int i_loop = 0;
553     int i_size = 0;
554     char** ppsz_args = NULL;
555
556     if( !PyArg_ParseTupleAndKeywords( args, kwds, "sss|Oii", kwlist, 
557                                       &psz_name,
558                                       &psz_input, &psz_output,
559                                       &py_options, &i_enable, &i_loop ) )
560         return NULL;
561     
562     if( py_options )
563     {
564         i_size = pyoptions_to_args( py_options, &ppsz_args );
565     }
566    
567     LIBVLC_TRY;
568     libvlc_vlm_change_media( LIBVLC_INSTANCE->p_instance, 
569                               psz_name, psz_input, psz_output,
570                               i_size, ppsz_args, i_enable, i_loop, &ex);
571     free_args( i_size, ppsz_args );
572     LIBVLC_EXCEPT;
573     Py_INCREF( Py_None );
574     return Py_None;
575 }
576
577 static PyObject *
578 vlcInstance_vlm_play_media( PyObject *self, PyObject *args )
579 {
580     libvlc_exception_t ex;
581     char* psz_name;
582     
583     if( !PyArg_ParseTuple( args, "s", &psz_name ) )
584         return NULL;
585
586     LIBVLC_TRY;
587     libvlc_vlm_play_media( LIBVLC_INSTANCE->p_instance, psz_name, &ex);
588     LIBVLC_EXCEPT;
589     Py_INCREF( Py_None );
590     return Py_None;
591 }
592
593 static PyObject *
594 vlcInstance_vlm_stop_media( PyObject *self, PyObject *args )
595 {
596     libvlc_exception_t ex;
597     char* psz_name;
598     
599     if( !PyArg_ParseTuple( args, "s", &psz_name ) )
600         return NULL;
601
602     LIBVLC_TRY;
603     libvlc_vlm_stop_media( LIBVLC_INSTANCE->p_instance, psz_name, &ex);
604     LIBVLC_EXCEPT;
605     Py_INCREF( Py_None );
606     return Py_None;
607 }
608
609 static PyObject *
610 vlcInstance_vlm_pause_media( PyObject *self, PyObject *args )
611 {
612     libvlc_exception_t ex;
613     char* psz_name;
614     
615     if( !PyArg_ParseTuple( args, "s", &psz_name ) )
616         return NULL;
617
618     LIBVLC_TRY;
619     libvlc_vlm_pause_media( LIBVLC_INSTANCE->p_instance, psz_name, &ex);
620     LIBVLC_EXCEPT;
621     Py_INCREF( Py_None );
622     return Py_None;
623 }
624
625 /* Method table */
626 static PyMethodDef vlcInstance_methods[] =
627 {
628     { "get_vlc_id", vlcInstance_get_vlc_id, METH_VARARGS,
629       "get_vlc_id( ) -> int        Get the instance id."},
630     { "playlist_play", vlcInstance_playlist_play, METH_VARARGS,
631       "playlist_play(id=int, options=list)   Play the given playlist item (-1 for current item) with optional options (a list of strings)" },
632     { "playlist_pause", vlcInstance_playlist_pause, METH_VARARGS,
633       "playlist_pause()            Pause the current stream"},
634     { "playlist_isplaying", vlcInstance_playlist_isplaying, METH_VARARGS,
635       "playlist_isplaying() -> int     Return True if the playlist if playing"},
636     { "playlist_items_count", vlcInstance_playlist_items_count, METH_VARARGS,
637       "playlist_items_count() -> int   Return the number of items in the playlist"},
638     { "playlist_stop", vlcInstance_playlist_stop, METH_VARARGS,
639       "playlist_stop()             Stop the current stream"},
640     { "playlist_next", vlcInstance_playlist_next, METH_VARARGS,
641       "playlist_next()             Play the next item"},
642     { "playlist_prev", vlcInstance_playlist_prev, METH_VARARGS,
643       "playlist_prev()             Play the previous item"},
644     { "playlist_clear", vlcInstance_playlist_clear, METH_VARARGS,
645       "playlist_clear()            Clear the playlist"},
646     { "playlist_add", vlcInstance_playlist_add, METH_VARARGS,
647       "playlist_add(mrl=str, name=str, options=list) -> int  Add a new item to the playlist. options is a list of strings."},
648     { "playlist_delete_item", vlcInstance_playlist_delete_item, METH_VARARGS,
649       "playlist_delete_item(id=int)   Delete the given item"},
650     { "playlist_get_input", vlcInstance_playlist_get_input, METH_VARARGS,
651       "playlist_get_input() -> object   Return the current input"},
652     { "video_set_parent", vlcInstance_video_set_parent, METH_VARARGS,
653       "video_set_parent(xid=int)       Set the parent xid or HWND"},
654     { "video_set_size", vlcInstance_video_set_size, METH_VARARGS,
655       "video_set_size(width=int, height=int)    Set the video width and height"},
656     { "audio_toggle_mute", vlcInstance_audio_toggle_mute, METH_VARARGS,
657       "audio_toggle_mute()         Toggle the mute state"},
658     { "audio_get_mute", vlcInstance_audio_get_mute, METH_VARARGS,
659       "audio_get_mute() -> int     Get the mute state"},
660     { "audio_set_mute", vlcInstance_audio_set_mute, METH_VARARGS,
661       "audio_set_mute(state=int)         Set the mute state"},
662     { "audio_get_volume", vlcInstance_audio_get_volume, METH_VARARGS,
663       "audio_get_volume() -> int   Get the audio volume"},
664     { "audio_set_volume", vlcInstance_audio_set_volume, METH_VARARGS,
665       "audio_set_volume(volume=int)       Set the audio volume"},
666
667     { "vlm_add_broadcast", vlcInstance_vlm_add_broadcast, METH_VARARGS | METH_KEYWORDS,
668       "vlm_add_broadcast(name=str, input=str, output=str, options=list, enable=int, loop=int)   Add a new broadcast" },
669     { "vlm_del_media", vlcInstance_vlm_del_media, METH_VARARGS,
670       "vlm_del_media(name=str)    Delete a media" },
671     { "vlm_set_enabled", vlcInstance_vlm_set_enabled, METH_VARARGS,
672       "vlm_set_enabled(name=str, enabled=int)    Enable/disable a media" },
673     { "vlm_set_output", vlcInstance_vlm_set_output, METH_VARARGS,
674       "vlm_set_output(name=str, output=str)      Set the output" },
675     { "vlm_set_input", vlcInstance_vlm_set_input, METH_VARARGS,
676       "vlm_set_input(name=str, output=str)       Set the input" },
677     { "vlm_set_loop", vlcInstance_vlm_set_loop, METH_VARARGS,
678       "vlm_set_loop(name=str, loop=int)          Change the looping value" },
679     { "vlm_change_media", vlcInstance_vlm_change_media, METH_VARARGS | METH_KEYWORDS,
680       "vlm_change_media(name=str, input=str, output=str, options=list, enable=int, loop=int)   Change the broadcast parameters" },
681     { "vlm_play_media", vlcInstance_vlm_play_media, METH_VARARGS,
682       "vlm_play_media(name=str)" },
683     { "vlm_stop_media", vlcInstance_vlm_stop_media, METH_VARARGS,
684       "vlm_stop_media(name=str)" },
685     { "vlm_pause_media", vlcInstance_vlm_pause_media, METH_VARARGS,
686       "vlm_pause_media(name=str)" },
687
688     { NULL, NULL, 0, NULL },
689 };
690
691 static PyTypeObject vlcInstance_Type =
692 {
693     PyObject_HEAD_INIT( NULL )
694     0,                          /*ob_size*/
695     "vlc.Instance",             /*tp_name*/
696     sizeof( vlcInstance_Type ), /*tp_basicsize*/
697     0,                          /*tp_itemsize*/
698     ( destructor )vlcInstance_dealloc,      /*tp_dealloc*/
699     0,                         /*tp_print*/
700     0,                         /*tp_getattr*/
701     0,                         /*tp_setattr*/
702     0,                         /*tp_compare*/
703     0,                         /*tp_repr*/
704     0,                         /*tp_as_number*/
705     0,                         /*tp_as_sequence*/
706     0,                         /*tp_as_mapping*/
707     0,                         /*tp_hash */
708     0,                         /*tp_call*/
709     0,                         /*tp_str*/
710     0,                         /*tp_getattro*/
711     0,                         /*tp_setattro*/
712     0,                         /*tp_as_buffer*/
713     Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
714     "VLC Instance(args)\n\nNote: if args is specified, the first arg is interpreted as an executable name to get the directory of the VLC plugins.",  /* tp_doc */
715     0,                     /* tp_traverse */
716     0,                     /* tp_clear */
717     0,                     /* tp_richcompare */
718     0,                     /* tp_weaklistoffset */
719     0,                     /* tp_iter */
720     0,                     /* tp_iternext */
721     vlcInstance_methods,             /* tp_methods */
722     0,             /* tp_members */
723     0,                         /* tp_getset */
724     0,                         /* tp_base */
725     0,                         /* tp_dict */
726     0,                         /* tp_descr_get */
727     0,                         /* tp_descr_set */
728     0,                         /* tp_dictoffset */
729     0,                         /* tp_init */
730     0,                         /* tp_alloc */
731     vlcInstance_new,          /* tp_new */
732 };