Commit 241b2280 authored by Olivier Aubert's avatar Olivier Aubert

python bindings: update to the new libvlc and mediacontrol API.

Objects have been renamed (vlc.MediaPlayer/vlc.Media) to match the current API.
parent 66fc0016
This diff is collapsed.
This diff is collapsed.
/*****************************************************************************
* vlc_mediadescriptor.c: vlc.MediaDescriptor binding
* vlc_media.c: vlc.Media binding
*****************************************************************************
* Copyright (C) 2007 the VideoLAN team
* $Id$
......@@ -23,18 +23,26 @@
#include "vlcglue.h"
/***********************************************************************
* vlc.MediaDescriptor
* vlc.Media
***********************************************************************/
static PyObject *
vlcMedia_new( PyTypeObject *type, PyObject *args, PyObject *kwds )
{
fprintf(stderr, "vlcMedia_new called\n");
PyErr_SetString( PyExc_TypeError, "vlc.Media can be instanciated by itself. You should use vlc.Instance().media_new(mrl)." );
return NULL;
}
static void
vlcMediaDescriptor_dealloc( PyObject *self )
vlcMedia_dealloc( PyObject *self )
{
libvlc_media_release( LIBVLC_MEDIADESCRIPTOR->p_md );
libvlc_media_release( LIBVLC_MEDIA->p_media );
PyObject_DEL( self );
}
static PyObject *
vlcMediaDescriptor_add_option( PyObject *self, PyObject *args )
vlcMedia_add_option( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
char* psz_options = NULL;
......@@ -43,21 +51,21 @@ vlcMediaDescriptor_add_option( PyObject *self, PyObject *args )
return NULL;
LIBVLC_TRY;
libvlc_media_add_option( LIBVLC_MEDIADESCRIPTOR->p_md, psz_options, &ex);
libvlc_media_add_option( LIBVLC_MEDIA->p_media, psz_options, &ex);
LIBVLC_EXCEPT;
Py_INCREF( Py_None );
return Py_None;
}
static PyObject *
vlcMediaDescriptor_get_mrl( PyObject *self, PyObject *args )
vlcMedia_get_mrl( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
char * psz_mrl;
PyObject * o_ret;
LIBVLC_TRY;
psz_mrl = libvlc_media_get_mrl( LIBVLC_MEDIADESCRIPTOR->p_md, &ex);
psz_mrl = libvlc_media_get_mrl( LIBVLC_MEDIA->p_media, &ex);
LIBVLC_EXCEPT;
o_ret = Py_BuildValue( "s", psz_mrl );
......@@ -66,109 +74,59 @@ vlcMediaDescriptor_get_mrl( PyObject *self, PyObject *args )
}
static PyObject *
vlcMediaDescriptor_get_state( PyObject *self, PyObject *args )
vlcMedia_get_state( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
libvlc_state_t i_state;
LIBVLC_TRY;
i_state = libvlc_media_get_state( LIBVLC_MEDIADESCRIPTOR->p_md, &ex);
i_state = libvlc_media_get_state( LIBVLC_MEDIA->p_media, &ex);
LIBVLC_EXCEPT;
/* FIXME: return the defined state constant */
return Py_BuildValue( "i", i_state );
}
static PyObject *
vlcMediaDescriptor_add_tag( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
char* psz_key;
char* psz_tag;
if( !PyArg_ParseTuple( args, "ss", &psz_key, &psz_tag ) )
return NULL;
LIBVLC_TRY;
libvlc_media_add_tag( LIBVLC_MEDIADESCRIPTOR->p_md, psz_key, ( libvlc_tag_t )psz_tag, &ex );
LIBVLC_EXCEPT;
Py_INCREF( Py_None );
return Py_None;
}
static PyObject *
vlcMediaDescriptor_remove_tag( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
char* psz_key;
char* psz_tag;
if( !PyArg_ParseTuple( args, "ss", &psz_key, &psz_tag ) )
return NULL;
LIBVLC_TRY;
libvlc_media_remove_tag( LIBVLC_MEDIADESCRIPTOR->p_md, psz_key, ( libvlc_tag_t )psz_tag, &ex );
LIBVLC_EXCEPT;
Py_INCREF( Py_None );
return Py_None;
}
static PyObject *
vlcMediaDescriptor_tags_count_for_key( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
char* psz_tag;
int i_ret;
if( !PyArg_ParseTuple( args, "s", &psz_tag ) )
return NULL;
LIBVLC_TRY;
i_ret=libvlc_media_tags_count_for_key( LIBVLC_MEDIADESCRIPTOR->p_md, psz_tag, &ex );
LIBVLC_EXCEPT;
return Py_BuildValue( "i", i_ret );
}
static PyObject *
vlcMediaDescriptor_get_duration( PyObject *self, PyObject *args )
vlcMedia_get_duration( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
libvlc_time_t i_ret;
LIBVLC_TRY;
i_ret = libvlc_media_get_duration( LIBVLC_MEDIADESCRIPTOR->p_md, &ex);
i_ret = libvlc_media_get_duration( LIBVLC_MEDIA->p_media, &ex);
LIBVLC_EXCEPT;
return Py_BuildValue( "L", i_ret );
}
static PyObject *
vlcMediaDescriptor_media_player_new( PyObject *self, PyObject *args )
vlcMedia_media_player_new( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
libvlc_media_player_t *p_mi;
vlcMediaInstance *p_ret;
libvlc_media_player_t *p_mp;
vlcMediaPlayer *p_ret;
LIBVLC_TRY;
p_mi = libvlc_media_player_new_from_media( LIBVLC_MEDIADESCRIPTOR->p_md, &ex);
p_mp = libvlc_media_player_new_from_media( LIBVLC_MEDIA->p_media, &ex);
LIBVLC_EXCEPT;
p_ret = PyObject_New( vlcMediaInstance, &vlcMediaInstance_Type );
p_ret->p_mi = p_mi;
p_ret = PyObject_New( vlcMediaPlayer, &vlcMediaPlayer_Type );
p_ret->p_mp = p_mp;
Py_INCREF( p_ret ); /* Ah bon ? */
return ( PyObject * )p_ret;
}
static PyObject *
vlcMediaDescriptor_is_preparsed( PyObject *self, PyObject *args )
vlcMedia_is_preparsed( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
int i_ret;
LIBVLC_TRY;
i_ret = libvlc_media_is_preparsed( LIBVLC_MEDIADESCRIPTOR->p_md, &ex);
i_ret = libvlc_media_is_preparsed( LIBVLC_MEDIA->p_media, &ex);
LIBVLC_EXCEPT;
return Py_BuildValue( "L", i_ret );
}
static PyObject *
vlcMediaDescriptor_get_meta( PyObject *self, PyObject *args )
vlcMedia_get_meta( PyObject *self, PyObject *args )
{
libvlc_exception_t ex;
char * psz_meta = NULL;
......@@ -197,7 +155,7 @@ vlcMediaDescriptor_get_meta( PyObject *self, PyObject *args )
}
LIBVLC_TRY;
psz_ret = libvlc_media_get_meta( LIBVLC_MEDIADESCRIPTOR->p_md, i_index, &ex);
psz_ret = libvlc_media_get_meta( LIBVLC_MEDIA->p_media, i_index, &ex);
LIBVLC_EXCEPT;
o_ret = Py_BuildValue( "s", psz_ret );
......@@ -205,40 +163,34 @@ vlcMediaDescriptor_get_meta( PyObject *self, PyObject *args )
return o_ret;
}
static PyMethodDef vlcMediaDescriptor_methods[] =
static PyMethodDef vlcMedia_methods[] =
{
{ "add_option", vlcMediaDescriptor_add_option, METH_VARARGS,
"add_option(str) Add an option to the media descriptor." },
{ "get_mrl", vlcMediaDescriptor_get_mrl, METH_VARARGS,
{ "add_option", vlcMedia_add_option, METH_VARARGS,
"add_option(str) Add an option to the media." },
{ "get_mrl", vlcMedia_get_mrl, METH_VARARGS,
"get_mrl() -> str" },
{ "get_state", vlcMediaDescriptor_get_state, METH_VARARGS,
{ "get_state", vlcMedia_get_state, METH_VARARGS,
"get_state() -> int" },
{ "add_tag", vlcMediaDescriptor_add_tag, METH_VARARGS,
"add_tag(key=str, tag=str) Add tag to the media descriptor." },
{ "remove_tag", vlcMediaDescriptor_remove_tag, METH_VARARGS,
"remove_tag(key=str, tag=str) Remove tag from the media descriptor." },
{ "tags_count_for_key", vlcMediaDescriptor_tags_count_for_key, METH_VARARGS,
"tags_count_for_key(str) ." },
{ "get_duration", vlcMediaDescriptor_get_duration, METH_VARARGS,
{ "get_duration", vlcMedia_get_duration, METH_VARARGS,
"get_duration() -> int" },
{ "mediainstance_new", vlcMediaDescriptor_media_player_new, METH_VARARGS,
"mediainstance_new() -> vlc.MediaInstance Create a Media Instance object from a Media Descriptor" },
{ "is_preparsed", vlcMediaDescriptor_is_preparsed, METH_VARARGS,
{ "mediaplayer_new", vlcMedia_media_player_new, METH_VARARGS,
"mediaplayer_new() -> vlc.MediaPlayer Create a MediaPlayer object from a Media" },
{ "is_preparsed", vlcMedia_is_preparsed, METH_VARARGS,
"is_preparsed() -> int" },
{ "get_meta", vlcMediaDescriptor_get_meta, METH_VARARGS,
"get_meta(str) -> str Read the meta of the media descriptor." },
{ "get_meta", vlcMedia_get_meta, METH_VARARGS,
"get_meta(str) -> str Read the meta of the media." },
{ NULL } /* Sentinel */
};
static PyTypeObject vlcMediaDescriptor_Type =
static PyTypeObject vlcMedia_Type =
{
PyObject_HEAD_INIT( NULL )
0, /*ob_size*/
"vlc.MediaDescriptor", /*tp_name*/
sizeof( vlcMediaDescriptor_Type ), /*tp_basicsize*/
"vlc.Media", /*tp_name*/
sizeof( vlcMedia_Type ), /*tp_basicsize*/
0, /*tp_itemsize*/
vlcMediaDescriptor_dealloc, /*tp_dealloc*/
vlcMedia_dealloc, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
......@@ -254,14 +206,14 @@ static PyTypeObject vlcMediaDescriptor_Type =
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
"vlc.MediaDescriptor object.", /* tp_doc */
"vlc.Media object.", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
vlcMediaDescriptor_methods, /* tp_methods */
vlcMedia_methods, /* tp_methods */
0, /* tp_members */
0, /* tp_getset */
0, /* tp_base */
......@@ -271,6 +223,6 @@ static PyTypeObject vlcMediaDescriptor_Type =
0, /* tp_dictoffset */
0, /* tp_init */
0, /* tp_alloc */
0, /* tp_new */
vlcMedia_new, /* tp_new */
};
......@@ -40,6 +40,7 @@ MediaControl_new( PyTypeObject *type, PyObject *args, PyObject *kwds )
self = PyObject_New( MediaControl, &MediaControl_Type );
fprintf (stderr, "Instanciating mediacontrol\n");
if( PyArg_ParseTuple( args, "O", &py_param ) )
{
if( PyObject_TypeCheck( py_param, &vlcInstance_Type ) == 1 )
......@@ -108,6 +109,7 @@ MediaControl_new( PyTypeObject *type, PyObject *args, PyObject *kwds )
static void
MediaControl_dealloc( PyObject *self )
{
fprintf(stderr, "MC dealloc\n");
Py_DECREF( SELF->vlc_instance );
PyObject_DEL( self );
}
......@@ -122,6 +124,17 @@ MediaControl_get_vlc_instance( PyObject *self, PyObject *args )
return ( PyObject * )p_ret;
}
static PyObject *
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 );
Py_INCREF( p_ret );
return ( PyObject * )p_ret;
}
/**
* Return the current position in the stream. The returned value can
be relative or absolute ( according to PositionOrigin ) and the unit
......@@ -215,24 +228,11 @@ MediaControl_start( PyObject *self, PyObject *args )
static PyObject *
MediaControl_pause( PyObject *self, PyObject *args )
{
mediacontrol_Position *a_position;
mediacontrol_Exception *exception = NULL;
PyObject *py_pos;
if( !PyArg_ParseTuple( args, "O", &py_pos ) )
{
/* No argument. Use a default 0 value. */
PyErr_Clear( );
py_pos = NULL;
}
a_position = position_py_to_c( py_pos );
if( !a_position )
return NULL;
Py_BEGIN_ALLOW_THREADS
MC_TRY;
mediacontrol_pause( SELF->mc, a_position, exception );
free( a_position );
mediacontrol_pause( SELF->mc, exception );
Py_END_ALLOW_THREADS
MC_EXCEPT;
......@@ -243,24 +243,11 @@ MediaControl_pause( PyObject *self, PyObject *args )
static PyObject *
MediaControl_resume( PyObject *self, PyObject *args )
{
mediacontrol_Position *a_position;
mediacontrol_Exception *exception = NULL;
PyObject *py_pos;
if( !PyArg_ParseTuple( args, "O", &py_pos ) )
{
/* No argument. Use a default 0 value. */
PyErr_Clear( );
py_pos = NULL;
}
a_position = position_py_to_c( py_pos );
if( !a_position )
return NULL;
Py_BEGIN_ALLOW_THREADS
MC_TRY;
mediacontrol_start( SELF->mc, a_position, exception );
free( a_position );
mediacontrol_resume( SELF->mc, exception );
Py_END_ALLOW_THREADS
MC_EXCEPT;
......@@ -271,24 +258,11 @@ MediaControl_resume( PyObject *self, PyObject *args )
static PyObject *
MediaControl_stop( PyObject *self, PyObject *args )
{
mediacontrol_Position *a_position;
mediacontrol_Exception *exception = NULL;
PyObject *py_pos;
if( !PyArg_ParseTuple( args, "O", &py_pos ) )
{
/* No argument. Use a default 0 value. */
PyErr_Clear( );
py_pos = NULL;
}
a_position = position_py_to_c( py_pos );
if( !a_position )
return NULL;
Py_BEGIN_ALLOW_THREADS
MC_TRY;
mediacontrol_stop( SELF->mc, a_position, exception );
free( a_position );
mediacontrol_stop( SELF->mc, exception );
Py_END_ALLOW_THREADS
MC_EXCEPT;
......@@ -305,7 +279,7 @@ MediaControl_exit( PyObject *self, PyObject *args )
}
static PyObject *
MediaControl_playlist_add_item( PyObject *self, PyObject *args )
MediaControl_set_mrl( PyObject *self, PyObject *args )
{
char *psz_file;
mediacontrol_Exception *exception = NULL;
......@@ -315,7 +289,7 @@ MediaControl_playlist_add_item( PyObject *self, PyObject *args )
Py_BEGIN_ALLOW_THREADS
MC_TRY;
mediacontrol_playlist_add_item( SELF->mc, psz_file, exception );
mediacontrol_set_mrl( SELF->mc, psz_file, exception );
Py_END_ALLOW_THREADS
MC_EXCEPT;
......@@ -324,50 +298,23 @@ MediaControl_playlist_add_item( PyObject *self, PyObject *args )
}
static PyObject *
MediaControl_playlist_clear( PyObject *self, PyObject *args )
{
mediacontrol_Exception *exception = NULL;
Py_BEGIN_ALLOW_THREADS
MC_TRY;
mediacontrol_playlist_clear( SELF->mc, exception );
Py_END_ALLOW_THREADS
MC_EXCEPT;
Py_INCREF( Py_None );
return Py_None;
}
static PyObject *
MediaControl_playlist_get_list( PyObject *self, PyObject *args )
MediaControl_get_mrl( PyObject *self, PyObject *args )
{
PyObject *py_retval;
char* psz_file;
mediacontrol_Exception *exception = NULL;
mediacontrol_PlaylistSeq* pl;
Py_ssize_t i_index;
Py_ssize_t i_playlist_size;
Py_BEGIN_ALLOW_THREADS
MC_TRY;
pl = mediacontrol_playlist_get_list( SELF->mc, exception );
psz_file = mediacontrol_get_mrl( SELF->mc, exception );
Py_END_ALLOW_THREADS
MC_EXCEPT;
i_playlist_size = pl->size;
py_retval = PyList_New( i_playlist_size );
for ( i_index = 0 ; i_index < i_playlist_size ; i_index++ )
{
PyList_SetItem( py_retval, i_index,
Py_BuildValue( "s", pl->data[i_index] ) );
}
mediacontrol_PlaylistSeq__free( pl );
py_retval = Py_BuildValue( "s", psz_file );
free( psz_file );
return py_retval;
}
static PyObject *
MediaControl_snapshot( PyObject *self, PyObject *args )
{
......@@ -603,7 +550,9 @@ MediaControl_set_visual( PyObject *self, PyObject *args )
static PyMethodDef MediaControl_methods[] =
{
{ "get_vlc_instance", MediaControl_get_vlc_instance, METH_VARARGS,
"get_vlc_instance( ) -> Instance Get matching vlc.Instance." },
"get_vlc_instance( ) -> Instance Get embedded vlc.Instance." },
{ "get_mediaplayer", MediaControl_get_mediaplayer, METH_VARARGS,
"get_mediaplayer( ) -> MediaPlayer Get embedded vlc.MediaPlayer." },
{ "get_media_position", MediaControl_get_media_position, METH_VARARGS,
"get_media_position( origin, key ) -> Position Get current media position." },
{ "set_media_position", MediaControl_set_media_position, METH_VARARGS,
......@@ -618,12 +567,10 @@ static PyMethodDef MediaControl_methods[] =
"stop( Position ) Stop the player" },
{ "exit", MediaControl_exit, METH_VARARGS,
"exit( ) Exit the player" },
{ "playlist_add_item", MediaControl_playlist_add_item, METH_VARARGS,
"playlist_add_item( str ) Add an item to the playlist" },
{ "playlist_get_list", MediaControl_playlist_get_list, METH_VARARGS,
"playlist_get_list( ) -> list Get the contents of the playlist" },
{ "playlist_clear", MediaControl_playlist_clear, METH_VARARGS,
"clear( ) Clear the playlist." },
{ "set_mrl", MediaControl_set_mrl, METH_VARARGS,
"set_mrl( str ) Set the file to be played" },
{ "get_mrl", MediaControl_get_mrl, METH_VARARGS,
"get_mrl( ) -> str Get the played file" },
{ "snapshot", MediaControl_snapshot, METH_VARARGS,
"snapshot( Position ) -> dict Take a snapshot" },
{ "display_text", MediaControl_display_text, METH_VARARGS,
......
This diff is collapsed.
......@@ -47,10 +47,13 @@ initvlc( void )
{
PyObject* p_module;
vlcMediaInstance_Type.tp_new = PyType_GenericNew;
vlcMediaInstance_Type.tp_alloc = PyType_GenericAlloc;
vlcMediaDescriptor_Type.tp_new = PyType_GenericNew;
vlcMediaDescriptor_Type.tp_alloc = PyType_GenericAlloc;
/* vlcMediaPlayer_Type.tp_new = PyType_GenericNew; */
vlcMediaPlayer_Type.tp_alloc = PyType_GenericAlloc;
/* vlcMedia_Type.tp_new = PyType_GenericNew; */
vlcMedia_Type.tp_alloc = PyType_GenericAlloc;
vlcInstance_Type.tp_alloc = PyType_GenericAlloc;
MediaControl_Type.tp_alloc = PyType_GenericAlloc;
p_module = Py_InitModule3( "vlc", vlc_methods,
"VLC media player embedding module." );
......@@ -64,9 +67,9 @@ initvlc( void )
return;
if( PyType_Ready( &vlcInstance_Type ) < 0 )
return;
if( PyType_Ready( &vlcMediaInstance_Type ) < 0 )
if( PyType_Ready( &vlcMediaPlayer_Type ) < 0 )
return;
if( PyType_Ready( &vlcMediaDescriptor_Type ) < 0 )
if( PyType_Ready( &vlcMedia_Type ) < 0 )
return;
/* Exceptions */
......@@ -101,11 +104,11 @@ initvlc( void )
MediaControl_PlaylistException );
/* Exceptions */
vlcInstance_Exception =
vlc_Exception =
PyErr_NewException( "vlc.InstanceException", NULL, NULL );
Py_INCREF( vlcInstance_Exception );
Py_INCREF( vlc_Exception );
PyModule_AddObject( p_module, "InstanceException",
vlcInstance_Exception );
vlc_Exception );
/* Types */
Py_INCREF( &PyPosition_Type );
......@@ -119,12 +122,14 @@ initvlc( void )
Py_INCREF( &vlcInstance_Type );
PyModule_AddObject( p_module, "Instance",
( PyObject * )&vlcInstance_Type );
Py_INCREF( &vlcMediaInstance_Type );
PyModule_AddObject( p_module, "MediaInstance",
( PyObject * )&vlcMediaInstance_Type );
Py_INCREF( &vlcMediaDescriptor_Type );
PyModule_AddObject( p_module, "MediaDescriptor",
( PyObject * )&vlcMediaDescriptor_Type );
Py_INCREF( &vlcMediaPlayer_Type );
PyModule_AddObject( p_module, "MediaPlayer",
( PyObject * )&vlcMediaPlayer_Type );
Py_INCREF( &vlcMedia_Type );
PyModule_AddObject( p_module, "Media",
( PyObject * )&vlcMedia_Type );
/* Constants */
PyModule_AddIntConstant( p_module, "AbsolutePosition",
......@@ -158,13 +163,6 @@ initvlc( void )
}
/* Make libpostproc happy... */
void * fast_memcpy( void * to, const void * from, size_t len )
{
return memcpy( to, from, len );
}
/* Horrible hack... Please do not look. Temporary workaround for the
forward declaration mess of python types (cf vlcglue.h). If we do a
separate compilation, we have to declare some types as extern. But
......@@ -175,5 +173,5 @@ void * fast_memcpy( void * to, const void * from, size_t len )
#include "vlc_mediacontrol.c"
#include "vlc_position.c"
#include "vlc_instance.c"
#include "vlc_input.c"
#include "vlc_mediadescriptor.c"
#include "vlc_mediaplayer.c"
#include "vlc_media.c"
......@@ -78,7 +78,7 @@ PyObject *MediaControl_PositionKeyNotSupported;
PyObject *MediaControl_PositionOriginNotSupported;
PyObject *MediaControl_InvalidPosition;
PyObject *MediaControl_PlaylistException;
PyObject *vlcInstance_Exception;
PyObject *vlc_Exception;
/**********************************************************************
* vlc.Instance Object
......@@ -113,38 +113,38 @@ typedef struct
} PyPosition;
/**********************************************************************
* vlc.MediaInstance Object
* vlc.MediaPlayer Object
**********************************************************************/
typedef struct
{
PyObject_HEAD
libvlc_media_player_t* p_mi;
} vlcMediaInstance;
libvlc_media_player_t* p_mp;
} vlcMediaPlayer;
/**********************************************************************
* vlc.MediaDescriptor Object
* vlc.Media Object
**********************************************************************/
typedef struct
{
PyObject_HEAD
libvlc_media_t* p_md;
} vlcMediaDescriptor;
libvlc_media_t* p_media;
} vlcMedia;
/* Forward declarations */
staticforward PyTypeObject MediaControl_Type;
staticforward PyTypeObject PyPosition_Type;
staticforward PyTypeObject vlcInstance_Type;
staticforward PyTypeObject vlcMediaInstance_Type;
staticforward PyTypeObject vlcMediaDescriptor_Type;
staticforward PyTypeObject vlcMediaPlayer_Type;
staticforward PyTypeObject vlcMedia_Type;
#define LIBVLC_INSTANCE ((vlcInstance*)self)
#define LIBVLC_MEDIAINSTANCE ((vlcMediaInstance*)self)
#define LIBVLC_MEDIADESCRIPTOR ((vlcMediaDescriptor*)self)
#define LIBVLC_MEDIAPLAYER ((vlcMediaPlayer*)self)
#define LIBVLC_MEDIA ((vlcMedia*)self)
#define LIBVLC_TRY libvlc_exception_init( &ex );
#define LIBVLC_EXCEPT if( libvlc_exception_raised( &ex ) ) { \
PyObject *py_exc = vlcInstance_Exception; \
PyObject *py_exc = vlc_Exception; \
PyErr_SetString( py_exc, libvlc_exception_get_message( &ex ) ); \
return NULL; \
}
......
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