Commit 22f86cc3 authored by JP Dinger's avatar JP Dinger Committed by Olivier Aubert

More macro parametrization.

Signed-off-by: default avatarOlivier Aubert <olivier.aubert@liris.cnrs.fr>
parent b1def0f0
......@@ -110,10 +110,10 @@ static PyObject
static PyObject *
vlcObject_release( PyObject *self, PyObject *p_args )
{
if( VLCSELF->b_released == 0 )
if( (vlcObject*)self->b_released == 0 )
{
vlc_object_release( VLCSELF->p_object );
VLCSELF->b_released = 1;
vlc_object_release( VLCOBJ(self) );
(vlcObject*)self->b_released = 1;
}
Py_INCREF( Py_None );
return Py_None;
......@@ -239,7 +239,7 @@ vlcObject_find_object( PyObject *self, PyObject *args )
return Py_None;
}
p_obj = vlc_object_find( VLCSELF->p_object, i_object_type, FIND_ANYWHERE );
p_obj = vlc_object_find( VLCOBJ(self), i_object_type, FIND_ANYWHERE );
if( !p_obj )
{
......@@ -264,7 +264,7 @@ vlcObject_find_name( PyObject *self, PyObject *args )
if( !PyArg_ParseTuple( args, "s", &psz_name ) )
return NULL;
p_obj = vlc_object_find_name( VLCSELF->p_object, psz_name, FIND_ANYWHERE );
p_obj = vlc_object_find_name( VLCOBJ(self), psz_name, FIND_ANYWHERE );
if( !p_obj )
{
......@@ -286,7 +286,7 @@ vlcObject_info( PyObject *self, PyObject *args )
vlc_object_t *p_obj;
vlc_object_internals_t *p_priv;
p_obj = VLCSELF->p_object;
p_obj = VLCOBJ(self);
p_priv = vlc_internals( p_obj );
/* Return information about the object as a dict. */
......@@ -344,14 +344,14 @@ vlcObject_var_get( PyObject *self, PyObject *args )
if( !PyArg_ParseTuple( args, "s", &psz_name ) )
return NULL;
if( var_Get( VLCSELF->p_object, psz_name, &value ) != VLC_SUCCESS )
if( var_Get( VLCOBJ(self), psz_name, &value ) != VLC_SUCCESS )
{
PyErr_SetString( PyExc_StandardError,
"Error: variable does not exist.\n" );
return NULL;
}
i_type = var_Type ( VLCSELF->p_object, psz_name );
i_type = var_Type ( VLCOBJ(self), psz_name );
switch ( i_type )
{
......@@ -410,7 +410,7 @@ vlcObject_var_type( PyObject *self, PyObject *args )
if( !PyArg_ParseTuple( args, "s", &psz_name ) )
return NULL;
i_type = var_Type( VLCSELF->p_object, psz_name );
i_type = var_Type( VLCOBJ(self), psz_name );
switch ( i_type )
{
......@@ -475,7 +475,7 @@ vlcObject_var_set( PyObject *self, PyObject *args )
if( !PyArg_ParseTuple( args, "sO", &psz_name, &py_value ) )
return NULL;
p_obj = VLCSELF->p_object;
p_obj = VLCOBJ(self);
i_type = var_Type( p_obj, psz_name );
switch ( i_type )
......@@ -530,7 +530,7 @@ vlcObject_var_list( PyObject *self, PyObject *args )
Py_ssize_t i_index;
vlc_object_internals_t *p_priv;
p_priv = vlc_internals( VLCSELF->p_object );
p_priv = vlc_internals( VLCOBJ(self) );
i_size = p_priv->i_vars;
p_retval = PyTuple_New( i_size );
......@@ -556,7 +556,7 @@ vlcObject_config_get( PyObject *self, PyObject *args )
if( !PyArg_ParseTuple( args, "s", &psz_name ) )
return NULL;
p_config = config_FindConfig( VLCSELF->p_object, psz_name );
p_config = config_FindConfig( VLCOBJ(self), psz_name );
if( !p_config )
{
......@@ -614,7 +614,7 @@ vlcObject_config_set( PyObject *self, PyObject *args )
if( !PyArg_ParseTuple( args, "sO", &psz_name, &py_value ) )
return NULL;
p_obj = VLCSELF->p_object;
p_obj = VLCOBJ(self);
p_config = config_FindConfig( p_obj, psz_name );
/* sanity checks */
if( !p_config )
......@@ -652,14 +652,13 @@ vlcObject_children( PyObject *self, PyObject *args )
Py_ssize_t i_size;
Py_ssize_t i_index;
i_size = VLCSELF->p_object->i_children;
i_size = VLCOBJ(self)->i_children;
p_retval = PyTuple_New( i_size );
for ( i_index = 0 ; i_index < i_size ; i_index++ )
{
PyTuple_SetItem( p_retval, i_index,
Py_BuildValue( "i",
VLCSELF->p_object->pp_children[i_index]->i_object_id ) );
PyTuple_SetItem( p_retval, i_index, Py_BuildValue( "i",
VLCOBJ(self)->pp_children[i_index]->i_object_id ) );
}
return p_retval;
......
......@@ -46,7 +46,7 @@ typedef int Py_ssize_t;
/**********************************************************************
* VLC Object
**********************************************************************/
#define VLCSELF ( ( vlcObject* )self )
#define VLCOBJ(self) (((vlcObject*)self)->p_object)
/**********************************************************************
* VLCObject Object
......
......@@ -97,7 +97,7 @@ MediaControl_new( PyTypeObject *type, PyObject *args, PyObject *kwds )
{
self->mc = mediacontrol_new( i_size, ppsz_args, exception );
self->vlc_instance = PyObject_New( vlcInstance, &vlcInstance_Type );
self->vlc_instance->p_instance = mediacontrol_get_libvlc_instance( SELF->mc );
self->vlc_instance->p_instance = mediacontrol_get_libvlc_instance( LIBVLC_MC(self) );
}
MC_EXCEPT;
Py_END_ALLOW_THREADS
......@@ -110,7 +110,7 @@ static void
MediaControl_dealloc( PyObject *self )
{
fprintf(stderr, "MC dealloc\n");
Py_DECREF( SELF->vlc_instance );
Py_DECREF( ((MediaControl*)self)->vlc_instance );
PyObject_DEL( self );
}
......@@ -119,7 +119,7 @@ MediaControl_get_vlc_instance( PyObject *self, PyObject *args )
{
vlcInstance *p_ret;
p_ret = SELF->vlc_instance;
p_ret = ((MediaControl*)self)->vlc_instance;
Py_INCREF( p_ret );
return ( PyObject * )p_ret;
}
......@@ -130,7 +130,7 @@ MediaControl_get_mediaplayer( PyObject *self, PyObject *args )
vlcMediaPlayer *p_ret;
p_ret = PyObject_New( vlcMediaPlayer, &vlcMediaPlayer_Type );
p_ret->p_mp = mediacontrol_get_media_player( SELF->mc );
p_ret->p_mp = mediacontrol_get_media_player( LIBVLC_MC(self) );
Py_INCREF( p_ret );
return ( PyObject * )p_ret;
}
......@@ -159,7 +159,7 @@ MediaControl_get_media_position( PyObject *self, PyObject *args )
Py_BEGIN_ALLOW_THREADS
MC_TRY;
pos = mediacontrol_get_media_position( SELF->mc, origin, key, exception );
pos = mediacontrol_get_media_position( LIBVLC_MC(self), origin, key, exception );
Py_END_ALLOW_THREADS
MC_EXCEPT;
......@@ -188,7 +188,7 @@ MediaControl_set_media_position( PyObject *self, PyObject *args )
Py_BEGIN_ALLOW_THREADS
MC_TRY;
mediacontrol_set_media_position( SELF->mc, a_position, exception );
mediacontrol_set_media_position( LIBVLC_MC(self), a_position, exception );
free( a_position );
Py_END_ALLOW_THREADS
MC_EXCEPT;
......@@ -216,7 +216,7 @@ MediaControl_start( PyObject *self, PyObject *args )
Py_BEGIN_ALLOW_THREADS
MC_TRY;
mediacontrol_start( SELF->mc, a_position, exception );
mediacontrol_start( LIBVLC_MC(self), a_position, exception );
free( a_position );
Py_END_ALLOW_THREADS
MC_EXCEPT;
......@@ -232,7 +232,7 @@ MediaControl_pause( PyObject *self, PyObject *args )
Py_BEGIN_ALLOW_THREADS
MC_TRY;
mediacontrol_pause( SELF->mc, exception );
mediacontrol_pause( LIBVLC_MC(self), exception );
Py_END_ALLOW_THREADS
MC_EXCEPT;
......@@ -247,7 +247,7 @@ MediaControl_resume( PyObject *self, PyObject *args )
Py_BEGIN_ALLOW_THREADS
MC_TRY;
mediacontrol_resume( SELF->mc, exception );
mediacontrol_resume( LIBVLC_MC(self), exception );
Py_END_ALLOW_THREADS
MC_EXCEPT;
......@@ -262,7 +262,7 @@ MediaControl_stop( PyObject *self, PyObject *args )
Py_BEGIN_ALLOW_THREADS
MC_TRY;
mediacontrol_stop( SELF->mc, exception );
mediacontrol_stop( LIBVLC_MC(self), exception );
Py_END_ALLOW_THREADS
MC_EXCEPT;
......@@ -273,7 +273,7 @@ MediaControl_stop( PyObject *self, PyObject *args )
static PyObject *
MediaControl_exit( PyObject *self, PyObject *args )
{
mediacontrol_exit( SELF->mc );
mediacontrol_exit( LIBVLC_MC(self) );
Py_INCREF( Py_None );
return Py_None;
}
......@@ -289,7 +289,7 @@ MediaControl_set_mrl( PyObject *self, PyObject *args )
Py_BEGIN_ALLOW_THREADS
MC_TRY;
mediacontrol_set_mrl( SELF->mc, psz_file, exception );
mediacontrol_set_mrl( LIBVLC_MC(self), psz_file, exception );
Py_END_ALLOW_THREADS
MC_EXCEPT;
......@@ -306,7 +306,7 @@ MediaControl_get_mrl( PyObject *self, PyObject *args )
Py_BEGIN_ALLOW_THREADS
MC_TRY;
psz_file = mediacontrol_get_mrl( SELF->mc, exception );
psz_file = mediacontrol_get_mrl( LIBVLC_MC(self), exception );
Py_END_ALLOW_THREADS
MC_EXCEPT;
......@@ -331,7 +331,7 @@ MediaControl_snapshot( PyObject *self, PyObject *args )
Py_BEGIN_ALLOW_THREADS
MC_TRY;
p_retval = mediacontrol_snapshot( SELF->mc, a_position, exception );
p_retval = mediacontrol_snapshot( LIBVLC_MC(self), a_position, exception );
free( a_position );
Py_END_ALLOW_THREADS
MC_EXCEPT;
......@@ -378,7 +378,7 @@ MediaControl_display_text( PyObject *self, PyObject *args )
Py_BEGIN_ALLOW_THREADS
MC_TRY;
mediacontrol_display_text( SELF->mc, message, begin, end, exception );
mediacontrol_display_text( LIBVLC_MC(self), message, begin, end, exception );
Py_END_ALLOW_THREADS
MC_EXCEPT;
......@@ -399,7 +399,7 @@ MediaControl_get_stream_information( PyObject *self, PyObject *args )
Py_BEGIN_ALLOW_THREADS
MC_TRY;
retval = mediacontrol_get_stream_information(
SELF->mc, mediacontrol_MediaTime, exception );
LIBVLC_MC(self), mediacontrol_MediaTime, exception );
Py_END_ALLOW_THREADS
MC_EXCEPT;
......@@ -431,7 +431,7 @@ MediaControl_sound_set_volume( PyObject *self, PyObject *args )
Py_BEGIN_ALLOW_THREADS
MC_TRY;
mediacontrol_sound_set_volume( SELF->mc, volume, exception );
mediacontrol_sound_set_volume( LIBVLC_MC(self), volume, exception );
Py_END_ALLOW_THREADS
MC_EXCEPT;
......@@ -448,7 +448,7 @@ MediaControl_sound_get_volume( PyObject *self, PyObject *args )
Py_BEGIN_ALLOW_THREADS
MC_TRY;
volume = mediacontrol_sound_get_volume( SELF->mc, exception );
volume = mediacontrol_sound_get_volume( LIBVLC_MC(self), exception );
Py_END_ALLOW_THREADS
MC_EXCEPT;
......@@ -467,7 +467,7 @@ MediaControl_set_rate( PyObject *self, PyObject *args )
Py_BEGIN_ALLOW_THREADS
MC_TRY;
mediacontrol_set_rate( SELF->mc, rate, exception );
mediacontrol_set_rate( LIBVLC_MC(self), rate, exception );
Py_END_ALLOW_THREADS
MC_EXCEPT;
......@@ -484,7 +484,7 @@ MediaControl_get_rate( PyObject *self, PyObject *args )
Py_BEGIN_ALLOW_THREADS
MC_TRY;
rate = mediacontrol_get_rate( SELF->mc, exception );
rate = mediacontrol_get_rate( LIBVLC_MC(self), exception );
Py_END_ALLOW_THREADS
MC_EXCEPT;
......@@ -503,7 +503,7 @@ MediaControl_set_fullscreen( PyObject *self, PyObject *args )
Py_BEGIN_ALLOW_THREADS
MC_TRY;
mediacontrol_set_fullscreen( SELF->mc, fs, exception );
mediacontrol_set_fullscreen( LIBVLC_MC(self), fs, exception );
Py_END_ALLOW_THREADS
MC_EXCEPT;
......@@ -520,7 +520,7 @@ MediaControl_get_fullscreen( PyObject *self, PyObject *args )
Py_BEGIN_ALLOW_THREADS
MC_TRY;
fs = mediacontrol_get_fullscreen( SELF->mc, exception );
fs = mediacontrol_get_fullscreen( LIBVLC_MC(self), exception );
Py_END_ALLOW_THREADS
MC_EXCEPT;
......@@ -539,7 +539,7 @@ MediaControl_set_visual( PyObject *self, PyObject *args )
Py_BEGIN_ALLOW_THREADS
MC_TRY;
mediacontrol_set_visual( SELF->mc, visual, exception );
mediacontrol_set_visual( LIBVLC_MC(self), visual, exception );
Py_END_ALLOW_THREADS
MC_EXCEPT;
......
......@@ -40,7 +40,6 @@ typedef int Py_ssize_t;
#define PY_SSIZE_T_MIN INT_MIN
#endif
#define SELF ((MediaControl*)self)
/**********************************************************************
* Exceptions handling
......@@ -138,6 +137,7 @@ staticforward PyTypeObject vlcMedia_Type;
#define LIBVLC_INSTANCE(self) (((vlcInstance*)self)->p_instance)
#define LIBVLC_MEDIAPLAYER(self) (((vlcMediaPlayer*)self)->p_mp)
#define LIBVLC_MEDIA(self) (((vlcMedia*)self)->p_media)
#define LIBVLC_MC(self) (((MediaControl*)self)->mc)
#define LIBVLC_TRY libvlc_exception_init( &ex );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment