/*****************************************************************************
* vlc_instance.c: vlc.Instance 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
char** ppsz_args = NULL;
int i_size = 0;
- fprintf(stderr, "Instancianting\n");
+ fprintf(stderr, "Instantiating\n");
if( PyArg_ParseTuple( args, "|O", &py_list ) )
{
i_size = pyoptions_to_args( py_list, &ppsz_args );
Py_BEGIN_ALLOW_THREADS
LIBVLC_TRY
- LIBVLC_INSTANCE->p_instance = libvlc_new( i_size, ppsz_args, &ex );
+ LIBVLC_INSTANCE(self) = libvlc_new( i_size, ppsz_args, &ex );
free_args( i_size, ppsz_args );
LIBVLC_EXCEPT
Py_END_ALLOW_THREADS
static void
vlcInstance_dealloc( PyObject *self )
{
- libvlc_release( LIBVLC_INSTANCE->p_instance );
+ libvlc_release( LIBVLC_INSTANCE(self) );
PyObject_DEL( self );
}
-static PyObject *
-vlcInstance_get_vlc_id( PyObject *self, PyObject *args )
-{
- return Py_BuildValue( "i", libvlc_get_vlc_id( LIBVLC_INSTANCE->p_instance ) );
-}
-
static PyObject *
vlcInstance_new_media_player( PyObject *self, PyObject *args )
{
vlcMediaPlayer *p_ret;
LIBVLC_TRY;
- p_mp = libvlc_media_player_new( LIBVLC_INSTANCE->p_instance, &ex );
+ p_mp = libvlc_media_player_new( LIBVLC_INSTANCE(self), &ex );
LIBVLC_EXCEPT;
p_ret = PyObject_New( vlcMediaPlayer, &vlcMediaPlayer_Type );
return ( PyObject * )p_ret;
}
-static PyObject *
-vlcInstance_video_set_parent( PyObject *self, PyObject *args )
-{
- libvlc_exception_t ex;
- int i_drawable;
-
- if( !PyArg_ParseTuple( args, "i", &i_drawable ) )
- return NULL;
-
- LIBVLC_TRY;
- libvlc_video_set_parent( LIBVLC_INSTANCE->p_instance, (libvlc_drawable_t) i_drawable, &ex );
- LIBVLC_EXCEPT;
-
- Py_INCREF( Py_None );
- return Py_None;
-}
-
-static PyObject *
-vlcInstance_video_get_parent( PyObject *self, PyObject *args )
-{
- libvlc_exception_t ex;
- libvlc_drawable_t i_ret;
-
- LIBVLC_TRY;
- i_ret = libvlc_video_get_parent( LIBVLC_INSTANCE->p_instance, &ex );
- LIBVLC_EXCEPT;
-
- return Py_BuildValue( "L", i_ret );
-}
-
-static PyObject *
-vlcInstance_video_set_size( 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;
-
- LIBVLC_TRY;
- libvlc_video_set_size( LIBVLC_INSTANCE->p_instance, i_width, i_height, &ex );
- LIBVLC_EXCEPT;
-
- Py_INCREF( Py_None );
- return Py_None;
-}
-
static PyObject *
vlcInstance_audio_toggle_mute( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
LIBVLC_TRY;
- libvlc_audio_toggle_mute( LIBVLC_INSTANCE->p_instance, &ex );
+ libvlc_audio_toggle_mute( LIBVLC_INSTANCE(self), &ex );
LIBVLC_EXCEPT;
Py_INCREF( Py_None );
return Py_None;
int i_ret;
LIBVLC_TRY;
- i_ret = libvlc_audio_get_mute( LIBVLC_INSTANCE->p_instance, &ex );
+ i_ret = libvlc_audio_get_mute( LIBVLC_INSTANCE(self), &ex );
LIBVLC_EXCEPT;
return Py_BuildValue( "i", i_ret );
}
return NULL;
LIBVLC_TRY;
- libvlc_audio_set_mute( LIBVLC_INSTANCE->p_instance, i_mute, &ex );
+ libvlc_audio_set_mute( LIBVLC_INSTANCE(self), i_mute, &ex );
LIBVLC_EXCEPT;
Py_INCREF( Py_None );
return Py_None;
int i_ret;
LIBVLC_TRY;
- i_ret = libvlc_audio_get_volume( LIBVLC_INSTANCE->p_instance, &ex );
+ i_ret = libvlc_audio_get_volume( LIBVLC_INSTANCE(self), &ex );
LIBVLC_EXCEPT;
return Py_BuildValue( "i", i_ret );
}
return NULL;
LIBVLC_TRY;
- libvlc_audio_set_volume( LIBVLC_INSTANCE->p_instance, i_volume, &ex );
+ libvlc_audio_set_volume( LIBVLC_INSTANCE(self), i_volume, &ex );
LIBVLC_EXCEPT;
Py_INCREF( Py_None );
return Py_None;
int i_ret;
LIBVLC_TRY;
- i_ret = libvlc_audio_get_channel( LIBVLC_INSTANCE->p_instance, &ex );
+ i_ret = libvlc_audio_get_channel( LIBVLC_INSTANCE(self), &ex );
LIBVLC_EXCEPT;
return Py_BuildValue( "i", i_ret );
}
return NULL;
LIBVLC_TRY;
- libvlc_audio_set_channel( LIBVLC_INSTANCE->p_instance, i_channel, &ex );
+ libvlc_audio_set_channel( LIBVLC_INSTANCE(self), i_channel, &ex );
LIBVLC_EXCEPT;
Py_INCREF( Py_None );
return Py_None;
&psz_input, &psz_output,
&py_options, &i_enable, &i_loop ) )
return NULL;
-
+
if( py_options )
{
i_size = pyoptions_to_args( py_options, &ppsz_args );
}
-
+
LIBVLC_TRY;
- libvlc_vlm_add_broadcast( LIBVLC_INSTANCE->p_instance,
+ libvlc_vlm_add_broadcast( LIBVLC_INSTANCE(self),
psz_name, psz_input, psz_output,
i_size, ppsz_args, i_enable, i_loop, &ex);
free_args( i_size, ppsz_args );
return NULL;
LIBVLC_TRY;
- libvlc_vlm_del_media( LIBVLC_INSTANCE->p_instance, psz_name, &ex);
+ libvlc_vlm_del_media( LIBVLC_INSTANCE(self), psz_name, &ex);
LIBVLC_EXCEPT;
Py_INCREF( Py_None );
return Py_None;
libvlc_exception_t ex;
char* psz_name;
int i_enabled;
-
+
if( !PyArg_ParseTuple( args, "si", &psz_name, &i_enabled ) )
return NULL;
LIBVLC_TRY;
- libvlc_vlm_set_enabled( LIBVLC_INSTANCE->p_instance, psz_name, i_enabled, &ex);
+ libvlc_vlm_set_enabled( LIBVLC_INSTANCE(self), psz_name, i_enabled, &ex);
LIBVLC_EXCEPT;
Py_INCREF( Py_None );
return Py_None;
libvlc_exception_t ex;
char* psz_name;
char* psz_output;
-
+
if( !PyArg_ParseTuple( args, "ss", &psz_name, &psz_output ) )
return NULL;
LIBVLC_TRY;
- libvlc_vlm_set_output( LIBVLC_INSTANCE->p_instance, psz_name, psz_output, &ex);
+ libvlc_vlm_set_output( LIBVLC_INSTANCE(self), psz_name, psz_output, &ex);
LIBVLC_EXCEPT;
Py_INCREF( Py_None );
return Py_None;
libvlc_exception_t ex;
char* psz_name;
char* psz_input;
-
+
if( !PyArg_ParseTuple( args, "ss", &psz_name, &psz_input ) )
return NULL;
LIBVLC_TRY;
- libvlc_vlm_set_input( LIBVLC_INSTANCE->p_instance, psz_name, psz_input, &ex);
+ libvlc_vlm_set_input( LIBVLC_INSTANCE(self), psz_name, psz_input, &ex);
LIBVLC_EXCEPT;
Py_INCREF( Py_None );
return Py_None;
libvlc_exception_t ex;
char* psz_name;
char* psz_input;
-
+
if( !PyArg_ParseTuple( args, "ss", &psz_name, &psz_input ) )
return NULL;
LIBVLC_TRY;
- libvlc_vlm_add_input( LIBVLC_INSTANCE->p_instance, psz_name, psz_input, &ex);
+ libvlc_vlm_add_input( LIBVLC_INSTANCE(self), psz_name, psz_input, &ex);
LIBVLC_EXCEPT;
Py_INCREF( Py_None );
return Py_None;
libvlc_exception_t ex;
char* psz_name;
int i_loop;
-
+
if( !PyArg_ParseTuple( args, "si", &psz_name, &i_loop ) )
return NULL;
LIBVLC_TRY;
- libvlc_vlm_set_loop( LIBVLC_INSTANCE->p_instance, psz_name, i_loop, &ex);
+ libvlc_vlm_set_loop( LIBVLC_INSTANCE(self), psz_name, i_loop, &ex);
LIBVLC_EXCEPT;
Py_INCREF( Py_None );
return Py_None;
&psz_input, &psz_output,
&py_options, &i_enable, &i_loop ) )
return NULL;
-
+
if( py_options )
{
i_size = pyoptions_to_args( py_options, &ppsz_args );
}
-
+
LIBVLC_TRY;
- libvlc_vlm_change_media( LIBVLC_INSTANCE->p_instance,
+ libvlc_vlm_change_media( LIBVLC_INSTANCE(self),
psz_name, psz_input, psz_output,
i_size, ppsz_args, i_enable, i_loop, &ex);
free_args( i_size, ppsz_args );
{
libvlc_exception_t ex;
char* psz_name;
-
+
if( !PyArg_ParseTuple( args, "s", &psz_name ) )
return NULL;
LIBVLC_TRY;
- libvlc_vlm_play_media( LIBVLC_INSTANCE->p_instance, psz_name, &ex);
+ libvlc_vlm_play_media( LIBVLC_INSTANCE(self), psz_name, &ex);
LIBVLC_EXCEPT;
Py_INCREF( Py_None );
return Py_None;
return NULL;
LIBVLC_TRY;
- libvlc_vlm_stop_media( LIBVLC_INSTANCE->p_instance, psz_name, &ex);
+ libvlc_vlm_stop_media( LIBVLC_INSTANCE(self), psz_name, &ex);
LIBVLC_EXCEPT;
Py_INCREF( Py_None );
return Py_None;
{
libvlc_exception_t ex;
char* psz_name;
-
+
if( !PyArg_ParseTuple( args, "s", &psz_name ) )
return NULL;
LIBVLC_TRY;
- libvlc_vlm_pause_media( LIBVLC_INSTANCE->p_instance, psz_name, &ex);
+ libvlc_vlm_pause_media( LIBVLC_INSTANCE(self), psz_name, &ex);
LIBVLC_EXCEPT;
Py_INCREF( Py_None );
return Py_None;
libvlc_exception_t ex;
char* psz_name;
float f_percentage;
-
+
if( !PyArg_ParseTuple( args, "sf", &psz_name, &f_percentage ) )
return NULL;
LIBVLC_TRY;
- libvlc_vlm_seek_media( LIBVLC_INSTANCE->p_instance, psz_name, f_percentage, &ex);
+ libvlc_vlm_seek_media( LIBVLC_INSTANCE(self), psz_name, f_percentage, &ex);
LIBVLC_EXCEPT;
Py_INCREF( Py_None );
return Py_None;
if( !PyArg_ParseTuple( args, "s", &psz_name ) )
return NULL;
LIBVLC_TRY;
- psz_ret = libvlc_vlm_show_media( LIBVLC_INSTANCE->p_instance, psz_name, &ex );
+ psz_ret = libvlc_vlm_show_media( LIBVLC_INSTANCE(self), psz_name, &ex );
LIBVLC_EXCEPT;
o_ret = Py_BuildValue( "s", psz_ret );
free( psz_ret );
return NULL;
LIBVLC_TRY;
- p_media = libvlc_media_new( LIBVLC_INSTANCE->p_instance, psz_mrl, &ex );
+ p_media = libvlc_media_new( LIBVLC_INSTANCE(self), psz_mrl, &ex );
LIBVLC_EXCEPT;
p_ret = PyObject_New( vlcMedia, &vlcMedia_Type );
{
{ "get_vlc_id", vlcInstance_get_vlc_id, METH_NOARGS,
"get_vlc_id( ) -> int Get the instance id."},
- { "video_set_parent", vlcInstance_video_set_parent, METH_VARARGS,
- "video_set_parent(xid=int) Set the parent xid/HWND/CGrafPort"},
- { "video_get_parent", vlcInstance_video_get_parent, METH_NOARGS,
- "video_get_parent() -> int Get the parent xid/HWND/CGrafPort"},
- { "video_set_size", vlcInstance_video_set_size, METH_VARARGS,
- "video_set_size(width=int, height=int) Set the video width and height"},
{ "audio_toggle_mute", vlcInstance_audio_toggle_mute, METH_NOARGS,
"audio_toggle_mute() Toggle the mute state"},
{ "audio_get_mute", vlcInstance_audio_get_mute, METH_NOARGS,