/*****************************************************************************
* vlc_mediaplayer.c: vlc.MediaPlayer binding
*****************************************************************************
- * Copyright (C) 2006 the VideoLAN team
+ * Copyright (C) 2006,2007,2008,2009 the VideoLAN team
* $Id$
*
- * Authors: Olivier Aubert <oaubert at bat710.univ-lyon1.fr>
+ * Authors: Olivier Aubert <olivier.aubert at liris.cnrs.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
vlcMediaPlayer_get_length( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
- vlc_int64_t i_ret;
+ int64_t i_ret;
LIBVLC_TRY;
- i_ret = libvlc_media_player_get_length( LIBVLC_MEDIAPLAYER->p_mp, &ex);
+ i_ret = libvlc_media_player_get_length( LIBVLC_MEDIAPLAYER(self), &ex);
LIBVLC_EXCEPT;
return Py_BuildValue( "L", i_ret );
}
vlcMediaPlayer_get_time( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
- vlc_int64_t i_ret;
+ int64_t i_ret;
LIBVLC_TRY;
- i_ret = libvlc_media_player_get_time( LIBVLC_MEDIAPLAYER->p_mp, &ex);
+ i_ret = libvlc_media_player_get_time( LIBVLC_MEDIAPLAYER(self), &ex);
LIBVLC_EXCEPT;
return Py_BuildValue( "L", i_ret );
}
vlcMediaPlayer_set_time( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
- vlc_int64_t i_time;
+ int64_t i_time;
if( !PyArg_ParseTuple( args, "L", &i_time ) )
return NULL;
LIBVLC_TRY;
- libvlc_media_player_set_time( LIBVLC_MEDIAPLAYER->p_mp, i_time, &ex);
+ libvlc_media_player_set_time( LIBVLC_MEDIAPLAYER(self), i_time, &ex);
LIBVLC_EXCEPT;
Py_INCREF( Py_None );
return Py_None;
libvlc_exception_t ex;
float f_ret;
LIBVLC_TRY;
- f_ret = libvlc_media_player_get_position( LIBVLC_MEDIAPLAYER->p_mp, &ex);
+ f_ret = libvlc_media_player_get_position( LIBVLC_MEDIAPLAYER(self), &ex);
LIBVLC_EXCEPT;
return Py_BuildValue( "f", f_ret );
}
return NULL;
LIBVLC_TRY;
- libvlc_media_player_set_position( LIBVLC_MEDIAPLAYER->p_mp, f_pos, &ex);
+ libvlc_media_player_set_position( LIBVLC_MEDIAPLAYER(self), f_pos, &ex);
LIBVLC_EXCEPT;
Py_INCREF( Py_None );
return Py_None;
libvlc_exception_t ex;
int i_ret;
LIBVLC_TRY;
- i_ret = libvlc_media_player_will_play( LIBVLC_MEDIAPLAYER->p_mp, &ex);
+ i_ret = libvlc_media_player_will_play( LIBVLC_MEDIAPLAYER(self), &ex);
LIBVLC_EXCEPT;
return Py_BuildValue( "i", i_ret );
}
libvlc_exception_t ex;
float f_ret;
LIBVLC_TRY;
- f_ret = libvlc_media_player_get_rate( LIBVLC_MEDIAPLAYER->p_mp, &ex);
+ f_ret = libvlc_media_player_get_rate( LIBVLC_MEDIAPLAYER(self), &ex);
LIBVLC_EXCEPT;
return Py_BuildValue( "f", f_ret );
}
return NULL;
LIBVLC_TRY;
- libvlc_media_player_set_rate( LIBVLC_MEDIAPLAYER->p_mp, f_rate, &ex);
+ libvlc_media_player_set_rate( LIBVLC_MEDIAPLAYER(self), f_rate, &ex);
LIBVLC_EXCEPT;
Py_INCREF( Py_None );
return Py_None;
libvlc_exception_t ex;
int i_ret;
LIBVLC_TRY;
- i_ret = libvlc_media_player_get_state( LIBVLC_MEDIAPLAYER->p_mp, &ex);
+ i_ret = libvlc_media_player_get_state( LIBVLC_MEDIAPLAYER(self), &ex);
LIBVLC_EXCEPT;
return Py_BuildValue( "i", i_ret );
}
libvlc_exception_t ex;
int i_ret;
LIBVLC_TRY;
- i_ret = libvlc_media_player_has_vout( LIBVLC_MEDIAPLAYER->p_mp, &ex);
+ i_ret = libvlc_media_player_has_vout( LIBVLC_MEDIAPLAYER(self), &ex);
LIBVLC_EXCEPT;
return Py_BuildValue( "i", i_ret );
}
libvlc_exception_t ex;
float f_ret;
LIBVLC_TRY;
- f_ret = libvlc_media_player_get_fps( LIBVLC_MEDIAPLAYER->p_mp, &ex);
+ f_ret = libvlc_media_player_get_fps( LIBVLC_MEDIAPLAYER(self), &ex);
LIBVLC_EXCEPT;
return Py_BuildValue( "f", f_ret );
}
int i_ret;
LIBVLC_TRY;
- i_ret = libvlc_audio_get_track( LIBVLC_MEDIAPLAYER->p_mp, &ex );
+ i_ret = libvlc_audio_get_track( LIBVLC_MEDIAPLAYER(self), &ex );
LIBVLC_EXCEPT;
return Py_BuildValue( "i", i_ret );
}
return NULL;
LIBVLC_TRY;
- libvlc_audio_set_track( LIBVLC_MEDIAPLAYER->p_mp, i_track, &ex );
+ libvlc_audio_set_track( LIBVLC_MEDIAPLAYER(self), i_track, &ex );
LIBVLC_EXCEPT;
Py_INCREF( Py_None );
return Py_None;
int i_ret;
LIBVLC_TRY;
- i_ret = libvlc_media_player_get_chapter( LIBVLC_MEDIAPLAYER->p_mp, &ex );
+ i_ret = libvlc_media_player_get_chapter( LIBVLC_MEDIAPLAYER(self), &ex );
LIBVLC_EXCEPT;
return Py_BuildValue( "i", i_ret );
}
int i_ret;
LIBVLC_TRY;
- i_ret = libvlc_media_player_get_chapter_count( LIBVLC_MEDIAPLAYER->p_mp, &ex );
+ i_ret = libvlc_media_player_get_chapter_count( LIBVLC_MEDIAPLAYER(self), &ex );
LIBVLC_EXCEPT;
return Py_BuildValue( "i", i_ret );
}
return NULL;
LIBVLC_TRY;
- libvlc_media_player_set_chapter( LIBVLC_MEDIAPLAYER->p_mp, i_chapter, &ex );
+ libvlc_media_player_set_chapter( LIBVLC_MEDIAPLAYER(self), i_chapter, &ex );
LIBVLC_EXCEPT;
Py_INCREF( Py_None );
return Py_None;
libvlc_exception_t ex;
LIBVLC_TRY;
- libvlc_toggle_fullscreen( LIBVLC_MEDIAPLAYER->p_mp, &ex);
+ libvlc_toggle_fullscreen( LIBVLC_MEDIAPLAYER(self), &ex);
LIBVLC_EXCEPT;
Py_INCREF( Py_None );
return Py_None;
return NULL;
LIBVLC_TRY;
- libvlc_set_fullscreen( LIBVLC_MEDIAPLAYER->p_mp, i_fullscreen, &ex);
+ libvlc_set_fullscreen( LIBVLC_MEDIAPLAYER(self), i_fullscreen, &ex);
LIBVLC_EXCEPT;
Py_INCREF( Py_None );
return Py_None;
int i_ret;
LIBVLC_TRY;
- i_ret = libvlc_get_fullscreen( LIBVLC_MEDIAPLAYER->p_mp, &ex);
+ i_ret = libvlc_get_fullscreen( LIBVLC_MEDIAPLAYER(self), &ex);
LIBVLC_EXCEPT;
return Py_BuildValue( "i", i_ret );
}
int i_ret;
LIBVLC_TRY;
- i_ret = libvlc_video_get_height( LIBVLC_MEDIAPLAYER->p_mp, &ex);
+ i_ret = libvlc_video_get_height( LIBVLC_MEDIAPLAYER(self), &ex);
LIBVLC_EXCEPT;
return Py_BuildValue( "i", i_ret );
}
int i_ret;
LIBVLC_TRY;
- i_ret = libvlc_video_get_width( LIBVLC_MEDIAPLAYER->p_mp, &ex);
+ i_ret = libvlc_video_get_width( LIBVLC_MEDIAPLAYER(self), &ex);
LIBVLC_EXCEPT;
return Py_BuildValue( "i", i_ret );
}
PyObject* o_ret;
LIBVLC_TRY;
- psz_ret = libvlc_video_get_aspect_ratio( LIBVLC_MEDIAPLAYER->p_mp, &ex);
+ psz_ret = libvlc_video_get_aspect_ratio( LIBVLC_MEDIAPLAYER(self), &ex);
LIBVLC_EXCEPT;
o_ret=Py_BuildValue( "s", psz_ret );
free( psz_ret );
return NULL;
LIBVLC_TRY;
- libvlc_video_set_aspect_ratio( LIBVLC_MEDIAPLAYER->p_mp, psz_ratio, &ex);
+ libvlc_video_set_aspect_ratio( LIBVLC_MEDIAPLAYER(self), psz_ratio, &ex);
LIBVLC_EXCEPT;
free( psz_ratio );
Py_INCREF( Py_None );
return NULL;
LIBVLC_TRY;
- libvlc_video_take_snapshot( LIBVLC_MEDIAPLAYER->p_mp, psz_filename, 0, 0, &ex);
+ libvlc_video_take_snapshot( LIBVLC_MEDIAPLAYER(self), psz_filename, 0, 0, &ex);
LIBVLC_EXCEPT;
Py_INCREF( Py_None );
return Py_None;
}
static PyObject *
-vlcMediaPlayer_video_resize( PyObject *self, PyObject *args )
+vlcMediaPlayer_is_seekable( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
- int i_width;
- int i_height;
-
- if( !PyArg_ParseTuple( args, "ii", &i_width, &i_height ) )
- return NULL;
-
+ int i_ret;
LIBVLC_TRY;
- libvlc_video_resize( LIBVLC_MEDIAPLAYER->p_mp, i_width, i_height, &ex);
+ i_ret = libvlc_media_player_is_seekable( LIBVLC_MEDIAPLAYER(self), &ex);
LIBVLC_EXCEPT;
- Py_INCREF( Py_None );
- return Py_None;
+ return Py_BuildValue( "i", i_ret );
}
static PyObject *
-vlcMediaPlayer_video_reparent( PyObject *self, PyObject *args )
+vlcMediaPlayer_can_pause( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
- WINDOWHANDLE i_visual;
int i_ret;
-
- if( !PyArg_ParseTuple( args, "i", &i_visual ) )
- return NULL;
-
LIBVLC_TRY;
- i_ret = libvlc_video_reparent( LIBVLC_MEDIAPLAYER->p_mp, i_visual, &ex);
+ i_ret = libvlc_media_player_can_pause( LIBVLC_MEDIAPLAYER(self), &ex);
LIBVLC_EXCEPT;
return Py_BuildValue( "i", i_ret );
}
static PyObject *
-vlcMediaPlayer_is_seekable( PyObject *self, PyObject *args )
+vlcMediaPlayer_play( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
- int i_ret;
+
LIBVLC_TRY;
- i_ret = libvlc_media_player_is_seekable( LIBVLC_MEDIAPLAYER->p_mp, &ex);
+ libvlc_media_player_play( LIBVLC_MEDIAPLAYER(self), &ex);
LIBVLC_EXCEPT;
- return Py_BuildValue( "i", i_ret );
+ Py_INCREF( Py_None );
+ return Py_None;
}
static PyObject *
-vlcMediaPlayer_can_pause( PyObject *self, PyObject *args )
+vlcMediaPlayer_pause( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
- int i_ret;
+
LIBVLC_TRY;
- i_ret = libvlc_media_player_can_pause( LIBVLC_MEDIAPLAYER->p_mp, &ex);
+ libvlc_media_player_pause( LIBVLC_MEDIAPLAYER(self), &ex);
LIBVLC_EXCEPT;
- return Py_BuildValue( "i", i_ret );
+ Py_INCREF( Py_None );
+ return Py_None;
}
static PyObject *
-vlcMediaPlayer_play( PyObject *self, PyObject *args )
+vlcMediaPlayer_stop( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
LIBVLC_TRY;
- libvlc_media_player_play( LIBVLC_MEDIAPLAYER->p_mp, &ex);
+ libvlc_media_player_stop( LIBVLC_MEDIAPLAYER(self), &ex);
LIBVLC_EXCEPT;
Py_INCREF( Py_None );
return Py_None;
}
static PyObject *
-vlcMediaPlayer_pause( PyObject *self, PyObject *args )
+vlcMediaPlayer_set_xwindow( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
+ uint32_t i_drawable;
+
+ if( !PyArg_ParseTuple( args, "i", &i_drawable ) )
+ return NULL;
LIBVLC_TRY;
- libvlc_media_player_pause( LIBVLC_MEDIAPLAYER->p_mp, &ex);
+ libvlc_media_player_set_xwindow( LIBVLC_MEDIAPLAYER(self), i_drawable, &ex );
LIBVLC_EXCEPT;
+
Py_INCREF( Py_None );
return Py_None;
}
static PyObject *
-vlcMediaPlayer_stop( PyObject *self, PyObject *args )
+vlcMediaPlayer_get_xwindow( PyObject *self, PyObject *args )
+{
+ uint32_t i_ret;
+
+ i_ret = libvlc_media_player_get_xwindow( LIBVLC_MEDIAPLAYER(self));
+ return Py_BuildValue( "i", i_ret );
+}
+
+static PyObject *
+vlcMediaPlayer_set_hwnd( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
+ void* i_drawable;
+
+ if( !PyArg_ParseTuple( args, "l", &i_drawable ) )
+ return NULL;
LIBVLC_TRY;
- libvlc_media_player_stop( LIBVLC_MEDIAPLAYER->p_mp, &ex);
+ libvlc_media_player_set_hwnd( LIBVLC_MEDIAPLAYER(self), (void*) i_drawable, &ex );
LIBVLC_EXCEPT;
+
Py_INCREF( Py_None );
return Py_None;
}
static PyObject *
-vlcMediaPlayer_set_drawable( PyObject *self, PyObject *args )
+vlcMediaPlayer_get_hwnd( PyObject *self, PyObject *args )
+{
+ void* i_ret;
+
+ i_ret = libvlc_media_player_get_hwnd( LIBVLC_MEDIAPLAYER(self));
+ return Py_BuildValue( "l", i_ret );
+}
+
+static PyObject *
+vlcMediaPlayer_set_agl( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
- int i_drawable;
+ uint32_t i_drawable;
if( !PyArg_ParseTuple( args, "i", &i_drawable ) )
return NULL;
LIBVLC_TRY;
- libvlc_media_player_set_drawable( LIBVLC_MEDIAPLAYER->p_mp, (libvlc_drawable_t) i_drawable, &ex );
+ libvlc_media_player_set_agl( LIBVLC_MEDIAPLAYER(self), i_drawable, &ex );
+ LIBVLC_EXCEPT;
+
+ Py_INCREF( Py_None );
+ return Py_None;
+}
+
+static PyObject *
+vlcMediaPlayer_get_agl( PyObject *self, PyObject *args )
+{
+ uint32_t i_ret;
+
+ i_ret = libvlc_media_player_get_agl( LIBVLC_MEDIAPLAYER(self));
+ return Py_BuildValue( "i", i_ret );
+}
+
+static PyObject *
+vlcMediaPlayer_set_nsobject( PyObject *self, PyObject *args )
+{
+ libvlc_exception_t ex;
+ void* i_drawable;
+
+ if( !PyArg_ParseTuple( args, "l", &i_drawable ) )
+ return NULL;
+
+ LIBVLC_TRY;
+ libvlc_media_player_set_nsobject( LIBVLC_MEDIAPLAYER(self), (void*) i_drawable, &ex );
LIBVLC_EXCEPT;
Py_INCREF( Py_None );
return Py_None;
}
+static PyObject *
+vlcMediaPlayer_get_nsobject( PyObject *self, PyObject *args )
+{
+ void* i_ret;
+
+ i_ret = libvlc_media_player_get_nsobject( LIBVLC_MEDIAPLAYER(self));
+ return Py_BuildValue( "l", i_ret );
+}
+
static PyObject *
vlcMediaPlayer_set_media( PyObject *self, PyObject *args )
{
if( PyObject_TypeCheck( py_param, &vlcMedia_Type ) == 1 )
{
LIBVLC_TRY;
- libvlc_media_player_set_media( LIBVLC_MEDIAPLAYER->p_mp, ((vlcMedia*)py_param)->p_media, &ex );
+ libvlc_media_player_set_media( LIBVLC_MEDIAPLAYER(self), ((vlcMedia*)py_param)->p_media, &ex );
LIBVLC_EXCEPT;
}
else
vlcMedia *p_ret;
LIBVLC_TRY;
- p_media = libvlc_media_player_get_media( LIBVLC_MEDIAPLAYER->p_mp, &ex );
+ p_media = libvlc_media_player_get_media( LIBVLC_MEDIAPLAYER(self), &ex );
LIBVLC_EXCEPT;
if( !p_media )
libvlc_exception_t ex;
int i_ret;
LIBVLC_TRY;
- i_ret = libvlc_video_get_spu( LIBVLC_MEDIAPLAYER->p_mp, &ex);
+ i_ret = libvlc_video_get_spu( LIBVLC_MEDIAPLAYER(self), &ex);
LIBVLC_EXCEPT;
return Py_BuildValue( "i", i_ret );
}
return NULL;
LIBVLC_TRY;
- libvlc_video_set_spu( LIBVLC_MEDIAPLAYER->p_mp, i_spu, &ex);
+ libvlc_video_set_spu( LIBVLC_MEDIAPLAYER(self), i_spu, &ex);
LIBVLC_EXCEPT;
Py_INCREF( Py_None );
return Py_None;
"set_aspect_ratio(str) Set new video aspect ratio" },
{ "video_take_snapshot", vlcMediaPlayer_video_take_snapshot, METH_VARARGS,
"video_take_snapshot(filename=str) Take a snapshot of the current video window" },
- { "video_resize", vlcMediaPlayer_video_resize, METH_VARARGS,
- "video_resize(width=int, height=int) Resize the current video output window" },
- { "video_reparent", vlcMediaPlayer_video_reparent, METH_VARARGS,
- "video_reparent(visual=int) change the parent for the current video output" },
{ "play", vlcMediaPlayer_play, METH_VARARGS,
"play() Play the media instance" },
"pause() Pause the media instance" },
{ "stop", vlcMediaPlayer_stop, METH_VARARGS,
"stop() Stop the media instance" },
- { "set_drawable", vlcMediaPlayer_set_drawable, METH_VARARGS,
- "set_drawable() Set the drawable id" },
+
+ { "set_xwindow", vlcMediaPlayer_set_xwindow, METH_VARARGS,
+ "set_xwindow() Set the X-Window id" },
+ { "set_nsobject", vlcMediaPlayer_set_nsobject, METH_VARARGS,
+ "set_nsobject() Set the NSObject" },
+ { "set_agl", vlcMediaPlayer_set_agl, METH_VARARGS,
+ "set_agl() Set the AGL" },
+ { "set_hwnd", vlcMediaPlayer_set_hwnd, METH_VARARGS,
+ "set_hwndl() Set the HWND" },
+
+ { "get_xwindow", vlcMediaPlayer_get_xwindow, METH_VARARGS,
+ "get_xwindow() Set the X-Window id" },
+ { "get_nsobject", vlcMediaPlayer_get_nsobject, METH_VARARGS,
+ "get_nsobject() Set the NSObject" },
+ { "get_agl", vlcMediaPlayer_get_agl, METH_VARARGS,
+ "get_agl() Set the AGL" },
+ { "get_hwnd", vlcMediaPlayer_get_hwnd, METH_VARARGS,
+ "get_hwndl() Set the HWND" },
{ "get_chapter", vlcMediaPlayer_get_chapter, METH_VARARGS,
"get_chapter() -> int Get current chapter" },
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
- "vlc.MediaPlayer object\n\nIt cannot be instanciated standalone, it must be obtained from an existing vlc.Instance object", /* tp_doc */
+ "vlc.MediaPlayer object\n\nIt cannot be instantiated standalone, it must be obtained from an existing vlc.Instance object", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */