]> git.sesse.net Git - vlc/blob - bindings/python/vlc_mediaplayer.c
libvlcpp: fix the compilation and throw an exception if the constructor fail.
[vlc] / bindings / python / vlc_mediaplayer.c
1 /*****************************************************************************
2  * vlc_mediaplayer.c: vlc.MediaPlayer binding
3  *****************************************************************************
4  * Copyright (C) 2006,2007,2008,2009 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Olivier Aubert <olivier.aubert at liris.cnrs.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 /***********************************************************************
26  * vlc.Input
27  ***********************************************************************/
28
29 static PyObject *
30 vlcMediaPlayer_get_length( PyObject *self, PyObject *args )
31 {
32     libvlc_exception_t ex;
33     int64_t i_ret;
34     LIBVLC_TRY;
35     i_ret = libvlc_media_player_get_length( LIBVLC_MEDIAPLAYER(self), &ex);
36     LIBVLC_EXCEPT;
37     return Py_BuildValue( "L", i_ret );
38 }
39
40 static PyObject *
41 vlcMediaPlayer_get_time( PyObject *self, PyObject *args )
42 {
43     libvlc_exception_t ex;
44     int64_t i_ret;
45     LIBVLC_TRY;
46     i_ret = libvlc_media_player_get_time( LIBVLC_MEDIAPLAYER(self), &ex);
47     LIBVLC_EXCEPT;
48     return Py_BuildValue( "L", i_ret );
49 }
50
51 static PyObject *
52 vlcMediaPlayer_set_time( PyObject *self, PyObject *args )
53 {
54     libvlc_exception_t ex;
55     int64_t i_time;
56
57     if( !PyArg_ParseTuple( args, "L", &i_time ) )
58         return NULL;
59
60     LIBVLC_TRY;
61     libvlc_media_player_set_time( LIBVLC_MEDIAPLAYER(self), i_time, &ex);
62     LIBVLC_EXCEPT;
63     Py_INCREF( Py_None );
64     return Py_None;
65 }
66
67 static PyObject *
68 vlcMediaPlayer_get_position( PyObject *self, PyObject *args )
69 {
70     libvlc_exception_t ex;
71     float f_ret;
72     LIBVLC_TRY;
73     f_ret = libvlc_media_player_get_position( LIBVLC_MEDIAPLAYER(self), &ex);
74     LIBVLC_EXCEPT;
75     return Py_BuildValue( "f", f_ret );
76 }
77
78 static PyObject *
79 vlcMediaPlayer_set_position( PyObject *self, PyObject *args )
80 {
81     libvlc_exception_t ex;
82     float f_pos;
83
84     if( !PyArg_ParseTuple( args, "f", &f_pos ) )
85         return NULL;
86
87     LIBVLC_TRY;
88     libvlc_media_player_set_position( LIBVLC_MEDIAPLAYER(self), f_pos, &ex);
89     LIBVLC_EXCEPT;
90     Py_INCREF( Py_None );
91     return Py_None;
92 }
93
94 static PyObject *
95 vlcMediaPlayer_will_play( PyObject *self, PyObject *args )
96 {
97     libvlc_exception_t ex;
98     int i_ret;
99     LIBVLC_TRY;
100     i_ret = libvlc_media_player_will_play( LIBVLC_MEDIAPLAYER(self), &ex);
101     LIBVLC_EXCEPT;
102     return Py_BuildValue( "i", i_ret );
103 }
104
105 static PyObject *
106 vlcMediaPlayer_get_rate( PyObject *self, PyObject *args )
107 {
108     libvlc_exception_t ex;
109     float f_ret;
110     LIBVLC_TRY;
111     f_ret = libvlc_media_player_get_rate( LIBVLC_MEDIAPLAYER(self), &ex);
112     LIBVLC_EXCEPT;
113     return Py_BuildValue( "f", f_ret );
114 }
115
116 static PyObject *
117 vlcMediaPlayer_set_rate( PyObject *self, PyObject *args )
118 {
119     libvlc_exception_t ex;
120     float f_rate;
121
122     if( !PyArg_ParseTuple( args, "f", &f_rate ) )
123         return NULL;
124
125     LIBVLC_TRY;
126     libvlc_media_player_set_rate( LIBVLC_MEDIAPLAYER(self), f_rate, &ex);
127     LIBVLC_EXCEPT;
128     Py_INCREF( Py_None );
129     return Py_None;
130 }
131
132 static PyObject *
133 vlcMediaPlayer_get_state( PyObject *self, PyObject *args )
134 {
135     libvlc_exception_t ex;
136     int i_ret;
137     LIBVLC_TRY;
138     i_ret = libvlc_media_player_get_state( LIBVLC_MEDIAPLAYER(self), &ex);
139     LIBVLC_EXCEPT;
140     return Py_BuildValue( "i", i_ret );
141 }
142
143 static PyObject *
144 vlcMediaPlayer_has_vout( PyObject *self, PyObject *args )
145 {
146     libvlc_exception_t ex;
147     int i_ret;
148     LIBVLC_TRY;
149     i_ret = libvlc_media_player_has_vout( LIBVLC_MEDIAPLAYER(self), &ex);
150     LIBVLC_EXCEPT;
151     return Py_BuildValue( "i", i_ret );
152 }
153
154 static PyObject *
155 vlcMediaPlayer_get_fps( PyObject *self, PyObject *args )
156 {
157     libvlc_exception_t ex;
158     float f_ret;
159     LIBVLC_TRY;
160     f_ret = libvlc_media_player_get_fps( LIBVLC_MEDIAPLAYER(self), &ex);
161     LIBVLC_EXCEPT;
162     return Py_BuildValue( "f", f_ret );
163 }
164
165 static PyObject *
166 vlcMediaPlayer_audio_get_track( PyObject *self, PyObject *args )
167 {
168     libvlc_exception_t ex;
169     int i_ret;
170
171     LIBVLC_TRY;
172     i_ret = libvlc_audio_get_track( LIBVLC_MEDIAPLAYER(self), &ex );
173     LIBVLC_EXCEPT;
174     return Py_BuildValue( "i", i_ret );
175 }
176
177 static PyObject *
178 vlcMediaPlayer_audio_set_track( PyObject *self, PyObject *args )
179 {
180     libvlc_exception_t ex;
181     int i_track;
182
183     if( !PyArg_ParseTuple( args, "i", &i_track ) )
184         return NULL;
185
186     LIBVLC_TRY;
187     libvlc_audio_set_track( LIBVLC_MEDIAPLAYER(self), i_track, &ex );
188     LIBVLC_EXCEPT;
189     Py_INCREF( Py_None );
190     return Py_None;
191 }
192
193 static PyObject *
194 vlcMediaPlayer_get_chapter( PyObject *self, PyObject *args )
195 {
196     libvlc_exception_t ex;
197     int i_ret;
198
199     LIBVLC_TRY;
200     i_ret = libvlc_media_player_get_chapter( LIBVLC_MEDIAPLAYER(self), &ex );
201     LIBVLC_EXCEPT;
202     return Py_BuildValue( "i", i_ret );
203 }
204
205 static PyObject *
206 vlcMediaPlayer_get_chapter_count( PyObject *self, PyObject *args )
207 {
208     libvlc_exception_t ex;
209     int i_ret;
210
211     LIBVLC_TRY;
212     i_ret = libvlc_media_player_get_chapter_count( LIBVLC_MEDIAPLAYER(self), &ex );
213     LIBVLC_EXCEPT;
214     return Py_BuildValue( "i", i_ret );
215 }
216
217 static PyObject *
218 vlcMediaPlayer_set_chapter( PyObject *self, PyObject *args )
219 {
220     libvlc_exception_t ex;
221     int i_chapter;
222
223     if( !PyArg_ParseTuple( args, "i", &i_chapter ) )
224         return NULL;
225
226     LIBVLC_TRY;
227     libvlc_media_player_set_chapter( LIBVLC_MEDIAPLAYER(self), i_chapter, &ex );
228     LIBVLC_EXCEPT;
229     Py_INCREF( Py_None );
230     return Py_None;
231 }
232
233
234 static PyObject *
235 vlcMediaPlayer_toggle_fullscreen( PyObject *self, PyObject *args )
236 {
237     libvlc_exception_t ex;
238
239     LIBVLC_TRY;
240     libvlc_toggle_fullscreen( LIBVLC_MEDIAPLAYER(self), &ex);
241     LIBVLC_EXCEPT;
242     Py_INCREF( Py_None );
243     return Py_None;
244 }
245
246 static PyObject *
247 vlcMediaPlayer_set_fullscreen( PyObject *self, PyObject *args )
248 {
249     libvlc_exception_t ex;
250     int i_fullscreen;
251
252     if( !PyArg_ParseTuple( args, "i", &i_fullscreen ) )
253         return NULL;
254
255     LIBVLC_TRY;
256     libvlc_set_fullscreen( LIBVLC_MEDIAPLAYER(self), i_fullscreen, &ex);
257     LIBVLC_EXCEPT;
258     Py_INCREF( Py_None );
259     return Py_None;
260 }
261
262 static PyObject *
263 vlcMediaPlayer_get_fullscreen( PyObject *self, PyObject *args )
264 {
265     libvlc_exception_t ex;
266     int i_ret;
267
268     LIBVLC_TRY;
269     i_ret = libvlc_get_fullscreen( LIBVLC_MEDIAPLAYER(self), &ex);
270     LIBVLC_EXCEPT;
271     return Py_BuildValue( "i", i_ret );
272 }
273
274 static PyObject *
275 vlcMediaPlayer_get_height( PyObject *self, PyObject *args )
276 {
277     libvlc_exception_t ex;
278     int i_ret;
279
280     LIBVLC_TRY;
281     i_ret = libvlc_video_get_height( LIBVLC_MEDIAPLAYER(self), &ex);
282     LIBVLC_EXCEPT;
283     return Py_BuildValue( "i", i_ret );
284 }
285
286 static PyObject *
287 vlcMediaPlayer_get_width( PyObject *self, PyObject *args )
288 {
289     libvlc_exception_t ex;
290     int i_ret;
291
292     LIBVLC_TRY;
293     i_ret = libvlc_video_get_width( LIBVLC_MEDIAPLAYER(self), &ex);
294     LIBVLC_EXCEPT;
295     return Py_BuildValue( "i", i_ret );
296 }
297
298 static PyObject *
299 vlcMediaPlayer_get_aspect_ratio( PyObject *self, PyObject *args )
300 {
301     libvlc_exception_t ex;
302     char* psz_ret;
303     PyObject* o_ret;
304
305     LIBVLC_TRY;
306     psz_ret = libvlc_video_get_aspect_ratio( LIBVLC_MEDIAPLAYER(self), &ex);
307     LIBVLC_EXCEPT;
308     o_ret=Py_BuildValue( "s", psz_ret );
309     free( psz_ret );
310     return o_ret;
311 }
312
313 static PyObject *
314 vlcMediaPlayer_set_aspect_ratio( PyObject *self, PyObject *args )
315 {
316     libvlc_exception_t ex;
317     char* psz_ratio;
318
319     if( !PyArg_ParseTuple( args, "s", &psz_ratio ) )
320         return NULL;
321
322     LIBVLC_TRY;
323     libvlc_video_set_aspect_ratio( LIBVLC_MEDIAPLAYER(self), psz_ratio, &ex);
324     LIBVLC_EXCEPT;
325     free( psz_ratio );
326     Py_INCREF( Py_None );
327     return Py_None;
328 }
329
330 static PyObject *
331 vlcMediaPlayer_video_take_snapshot( PyObject *self, PyObject *args )
332 {
333     libvlc_exception_t ex;
334     char* psz_filename;
335
336     if( !PyArg_ParseTuple( args, "s", &psz_filename ) )
337         return NULL;
338
339     LIBVLC_TRY;
340     libvlc_video_take_snapshot( LIBVLC_MEDIAPLAYER(self), psz_filename, 0, 0, &ex);
341     LIBVLC_EXCEPT;
342     Py_INCREF( Py_None );
343     return Py_None;
344 }
345
346 static PyObject *
347 vlcMediaPlayer_is_seekable( PyObject *self, PyObject *args )
348 {
349     libvlc_exception_t ex;
350     int i_ret;
351     LIBVLC_TRY;
352     i_ret = libvlc_media_player_is_seekable( LIBVLC_MEDIAPLAYER(self), &ex);
353     LIBVLC_EXCEPT;
354     return Py_BuildValue( "i", i_ret );
355 }
356
357 static PyObject *
358 vlcMediaPlayer_can_pause( PyObject *self, PyObject *args )
359 {
360     libvlc_exception_t ex;
361     int i_ret;
362     LIBVLC_TRY;
363     i_ret = libvlc_media_player_can_pause( LIBVLC_MEDIAPLAYER(self), &ex);
364     LIBVLC_EXCEPT;
365     return Py_BuildValue( "i", i_ret );
366 }
367
368 static PyObject *
369 vlcMediaPlayer_play( PyObject *self, PyObject *args )
370 {
371     libvlc_exception_t ex;
372
373     LIBVLC_TRY;
374     libvlc_media_player_play( LIBVLC_MEDIAPLAYER(self), &ex);
375     LIBVLC_EXCEPT;
376     Py_INCREF( Py_None );
377     return Py_None;
378 }
379
380 static PyObject *
381 vlcMediaPlayer_pause( PyObject *self, PyObject *args )
382 {
383     libvlc_exception_t ex;
384
385     LIBVLC_TRY;
386     libvlc_media_player_pause( LIBVLC_MEDIAPLAYER(self), &ex);
387     LIBVLC_EXCEPT;
388     Py_INCREF( Py_None );
389     return Py_None;
390 }
391
392 static PyObject *
393 vlcMediaPlayer_stop( PyObject *self, PyObject *args )
394 {
395     libvlc_exception_t ex;
396
397     LIBVLC_TRY;
398     libvlc_media_player_stop( LIBVLC_MEDIAPLAYER(self), &ex);
399     LIBVLC_EXCEPT;
400     Py_INCREF( Py_None );
401     return Py_None;
402 }
403
404 static PyObject *
405 vlcMediaPlayer_set_xwindow( PyObject *self, PyObject *args )
406 {
407     libvlc_exception_t ex;
408     uint32_t i_drawable;
409
410     if( !PyArg_ParseTuple( args, "i", &i_drawable ) )
411         return NULL;
412
413     LIBVLC_TRY;
414     libvlc_media_player_set_xwindow( LIBVLC_MEDIAPLAYER(self), i_drawable, &ex );
415     LIBVLC_EXCEPT;
416
417     Py_INCREF( Py_None );
418     return Py_None;
419 }
420
421 static PyObject *
422 vlcMediaPlayer_get_xwindow( PyObject *self, PyObject *args )
423 {
424     uint32_t i_ret;
425
426     i_ret = libvlc_media_player_get_xwindow( LIBVLC_MEDIAPLAYER(self));
427     return Py_BuildValue( "i", i_ret );
428 }
429
430 static PyObject *
431 vlcMediaPlayer_set_hwnd( PyObject *self, PyObject *args )
432 {
433     libvlc_exception_t ex;
434     void* i_drawable;
435
436     if( !PyArg_ParseTuple( args, "l", &i_drawable ) )
437         return NULL;
438
439     LIBVLC_TRY;
440     libvlc_media_player_set_hwnd( LIBVLC_MEDIAPLAYER(self), (void*) i_drawable, &ex );
441     LIBVLC_EXCEPT;
442
443     Py_INCREF( Py_None );
444     return Py_None;
445 }
446
447 static PyObject *
448 vlcMediaPlayer_get_hwnd( PyObject *self, PyObject *args )
449 {
450     void* i_ret;
451
452     i_ret = libvlc_media_player_get_hwnd( LIBVLC_MEDIAPLAYER(self));
453     return Py_BuildValue( "l", i_ret );
454 }
455
456 static PyObject *
457 vlcMediaPlayer_set_agl( PyObject *self, PyObject *args )
458 {
459     libvlc_exception_t ex;
460     uint32_t i_drawable;
461
462     if( !PyArg_ParseTuple( args, "i", &i_drawable ) )
463         return NULL;
464
465     LIBVLC_TRY;
466     libvlc_media_player_set_agl( LIBVLC_MEDIAPLAYER(self), i_drawable, &ex );
467     LIBVLC_EXCEPT;
468
469     Py_INCREF( Py_None );
470     return Py_None;
471 }
472
473 static PyObject *
474 vlcMediaPlayer_get_agl( PyObject *self, PyObject *args )
475 {
476     uint32_t i_ret;
477
478     i_ret = libvlc_media_player_get_agl( LIBVLC_MEDIAPLAYER(self));
479     return Py_BuildValue( "i", i_ret );
480 }
481
482 static PyObject *
483 vlcMediaPlayer_set_nsobject( PyObject *self, PyObject *args )
484 {
485     libvlc_exception_t ex;
486     void* i_drawable;
487
488     if( !PyArg_ParseTuple( args, "l", &i_drawable ) )
489         return NULL;
490
491     LIBVLC_TRY;
492     libvlc_media_player_set_nsobject( LIBVLC_MEDIAPLAYER(self), (void*) i_drawable, &ex );
493     LIBVLC_EXCEPT;
494
495     Py_INCREF( Py_None );
496     return Py_None;
497 }
498
499 static PyObject *
500 vlcMediaPlayer_get_nsobject( PyObject *self, PyObject *args )
501 {
502     void* i_ret;
503
504     i_ret = libvlc_media_player_get_nsobject( LIBVLC_MEDIAPLAYER(self));
505     return Py_BuildValue( "l", i_ret );
506 }
507
508 static PyObject *
509 vlcMediaPlayer_set_media( PyObject *self, PyObject *args )
510 {
511     libvlc_exception_t ex;
512     PyObject* py_param = NULL;
513
514     if( !PyArg_ParseTuple( args, "O", &py_param ) )
515         return NULL;
516     if( PyObject_TypeCheck( py_param, &vlcMedia_Type ) == 1 )
517     {
518         LIBVLC_TRY;
519         libvlc_media_player_set_media( LIBVLC_MEDIAPLAYER(self), ((vlcMedia*)py_param)->p_media, &ex );
520         LIBVLC_EXCEPT;
521     }
522     else
523     {
524         PyObject *py_exc = vlc_Exception;
525         PyErr_SetString( py_exc, "vlc.Media parameter needed" );
526         return NULL;
527     }
528     return NULL;
529 }
530
531 static PyObject *
532 vlcMediaPlayer_get_media( PyObject *self, PyObject *args )
533 {
534     libvlc_exception_t ex;
535     libvlc_media_t *p_media;
536     vlcMedia *p_ret;
537
538     LIBVLC_TRY;
539     p_media = libvlc_media_player_get_media( LIBVLC_MEDIAPLAYER(self), &ex );
540     LIBVLC_EXCEPT;
541
542     if( !p_media )
543     {
544         Py_INCREF( Py_None );
545         return Py_None;
546     }
547     else
548     {
549         p_ret = PyObject_New( vlcMedia, &vlcMedia_Type );
550         p_ret->p_media = p_media;
551         Py_INCREF( p_ret ); /* Ah bon ? */
552         return ( PyObject * )p_ret;
553     }
554 }
555
556 static PyObject *
557 vlcMediaPlayer_get_spu( PyObject *self, PyObject *args )
558 {
559     libvlc_exception_t ex;
560     int i_ret;
561     LIBVLC_TRY;
562     i_ret = libvlc_video_get_spu( LIBVLC_MEDIAPLAYER(self), &ex);
563     LIBVLC_EXCEPT;
564     return Py_BuildValue( "i", i_ret );
565 }
566
567 static PyObject *
568 vlcMediaPlayer_set_spu( PyObject *self, PyObject *args )
569 {
570     libvlc_exception_t ex;
571     int i_spu;
572
573     if( !PyArg_ParseTuple( args, "i", &i_spu ) )
574         return NULL;
575
576     LIBVLC_TRY;
577     libvlc_video_set_spu( LIBVLC_MEDIAPLAYER(self), i_spu, &ex);
578     LIBVLC_EXCEPT;
579     Py_INCREF( Py_None );
580     return Py_None;
581 }
582
583
584 static PyMethodDef vlcMediaPlayer_methods[] =
585 {
586     { "get_length", vlcMediaPlayer_get_length, METH_VARARGS,
587       "get_length() -> long    " },
588     { "get_time", vlcMediaPlayer_get_time, METH_VARARGS,
589       "get_time() -> long" },
590     { "set_time", vlcMediaPlayer_set_time, METH_VARARGS,
591       "set_time(long)" },
592     { "get_position", vlcMediaPlayer_get_position, METH_VARARGS,
593       "get_position() -> float" },
594     { "set_position", vlcMediaPlayer_set_position, METH_VARARGS,
595       "set_position(float)" },
596     { "will_play", vlcMediaPlayer_will_play, METH_VARARGS,
597       "will_play() -> int" },
598     { "is_seekable", vlcMediaPlayer_is_seekable, METH_VARARGS,
599       "is_seekable() -> int" },
600     { "can_pause", vlcMediaPlayer_can_pause, METH_VARARGS,
601       "can_pause() -> int" },
602     { "get_rate", vlcMediaPlayer_get_rate, METH_VARARGS,
603       "get_rate() -> float" },
604     { "set_rate", vlcMediaPlayer_set_rate, METH_VARARGS,
605       "set_rate(float)" },
606     { "get_state", vlcMediaPlayer_get_state, METH_VARARGS,
607       "get_state() -> int" },
608     { "has_vout", vlcMediaPlayer_has_vout, METH_VARARGS,
609       "has_vout() -> int" },
610     { "get_fps", vlcMediaPlayer_get_fps, METH_VARARGS,
611       "get_fps() -> float" },
612     { "audio_get_track", vlcMediaPlayer_audio_get_track, METH_VARARGS,
613       "audio_get_track() -> int    Get current audio track" },
614     { "audio_set_track", vlcMediaPlayer_audio_set_track, METH_VARARGS,
615       "audio_set_track(int)        Set current audio track" },
616     { "toggle_fullscreen", vlcMediaPlayer_toggle_fullscreen, METH_VARARGS,
617       "toggle_fullscreen()    Toggle fullscreen status on video output" },
618     { "set_fullscreen", vlcMediaPlayer_set_fullscreen, METH_VARARGS,
619       "set_fullscreen(bool)    Enable or disable fullscreen on a video output" },
620     { "get_fullscreen", vlcMediaPlayer_get_fullscreen, METH_VARARGS,
621       "get_fullscreen() -> bool    Get current fullscreen status" },
622     { "get_height", vlcMediaPlayer_get_height, METH_VARARGS,
623       "get_height() -> int           Get current video height" },
624     { "get_width", vlcMediaPlayer_get_width, METH_VARARGS,
625       "get_width() -> int           Get current video width" },
626     { "get_aspect_ratio", vlcMediaPlayer_get_aspect_ratio, METH_VARARGS,
627       "get_aspect_ratio() -> str    Get current video aspect ratio" },
628     { "set_aspect_ratio", vlcMediaPlayer_set_aspect_ratio, METH_VARARGS,
629       "set_aspect_ratio(str)        Set new video aspect ratio" },
630     { "video_take_snapshot", vlcMediaPlayer_video_take_snapshot, METH_VARARGS,
631       "video_take_snapshot(filename=str)        Take a snapshot of the current video window" },
632
633     { "play", vlcMediaPlayer_play, METH_VARARGS,
634       "play()    Play the media instance" },
635     { "pause", vlcMediaPlayer_pause, METH_VARARGS,
636       "pause()   Pause the media instance" },
637     { "stop", vlcMediaPlayer_stop, METH_VARARGS,
638       "stop()    Stop the media instance" },
639
640     { "set_xwindow", vlcMediaPlayer_set_xwindow, METH_VARARGS,
641       "set_xwindow()    Set the X-Window id" },
642     { "set_nsobject", vlcMediaPlayer_set_nsobject, METH_VARARGS,
643       "set_nsobject()    Set the NSObject" },
644     { "set_agl", vlcMediaPlayer_set_agl, METH_VARARGS,
645       "set_agl()    Set the AGL" },
646     { "set_hwnd", vlcMediaPlayer_set_hwnd, METH_VARARGS,
647       "set_hwndl()    Set the HWND" },
648
649     { "get_xwindow", vlcMediaPlayer_get_xwindow, METH_VARARGS,
650       "get_xwindow()    Set the X-Window id" },
651     { "get_nsobject", vlcMediaPlayer_get_nsobject, METH_VARARGS,
652       "get_nsobject()    Set the NSObject" },
653     { "get_agl", vlcMediaPlayer_get_agl, METH_VARARGS,
654       "get_agl()    Set the AGL" },
655     { "get_hwnd", vlcMediaPlayer_get_hwnd, METH_VARARGS,
656       "get_hwndl()    Set the HWND" },
657
658     { "get_chapter", vlcMediaPlayer_get_chapter, METH_VARARGS,
659       "get_chapter() -> int    Get current chapter" },
660     { "set_chapter", vlcMediaPlayer_set_chapter, METH_VARARGS,
661       "set_chapter(int)        Set current chapter" },
662     { "get_chapter_count", vlcMediaPlayer_get_chapter_count, METH_VARARGS,
663       "get_chapter_count() -> int    Get current chapter count" },
664
665     { "set_media", vlcMediaPlayer_set_media, METH_VARARGS,
666       "set_media(vlc.Media)        Set the media that will be used by the media_player" },
667     { "get_media", vlcMediaPlayer_get_media, METH_VARARGS,
668       "get_media() -> vlc.Media    Get the media used by the media_player (if any)." },
669
670     { "get_spu", vlcMediaPlayer_get_spu, METH_VARARGS,
671       "get_spu() -> int   Get current video subtitle" },
672     { "set_spu", vlcMediaPlayer_set_spu, METH_VARARGS,
673       "set_spu(int)      Set new video subtitle" },
674
675     { NULL }  /* Sentinel */
676 };
677
678 static PyTypeObject vlcMediaPlayer_Type =
679 {
680     PyObject_HEAD_INIT( NULL )
681     0,                         /*ob_size*/
682     "vlc.MediaPlayer",            /*tp_name*/
683     sizeof( vlcMediaPlayer_Type ),   /*tp_basicsize*/
684     0,                         /*tp_itemsize*/
685     0,                         /*tp_dealloc*/
686     0,                         /*tp_print*/
687     0,                         /*tp_getattr*/
688     0,                         /*tp_setattr*/
689     0,                         /*tp_compare*/
690     0,                         /*tp_repr*/
691     0,                         /*tp_as_number*/
692     0,                         /*tp_as_sequence*/
693     0,                         /*tp_as_mapping*/
694     0,                         /*tp_hash */
695     0,                         /*tp_call*/
696     0,                         /*tp_str*/
697     0,                         /*tp_getattro*/
698     0,                         /*tp_setattro*/
699     0,                         /*tp_as_buffer*/
700     Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
701     "vlc.MediaPlayer object\n\nIt cannot be instantiated standalone, it must be obtained from an existing vlc.Instance object",  /* tp_doc */
702     0,                        /* tp_traverse */
703     0,                        /* tp_clear */
704     0,                         /* tp_richcompare */
705     0,                         /* tp_weaklistoffset */
706     0,                         /* tp_iter */
707     0,                          /* tp_iternext */
708     vlcMediaPlayer_methods,          /* tp_methods */
709     0,                         /* tp_members */
710     0,                         /* tp_getset */
711     0,                         /* tp_base */
712     0,                         /* tp_dict */
713     0,                         /* tp_descr_get */
714     0,                         /* tp_descr_set */
715     0,                         /* tp_dictoffset */
716     0,                         /* tp_init */
717     0,                         /* tp_alloc */
718     0,                         /* tp_new */
719 };
720