X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=bindings%2Fpython%2Fvlc_module.c;h=b8a6348d0e3752138328fabc62983fa3d826d310;hb=7a73b990d2127ca7b643cc383a207ad3b481ab5b;hp=ba2fd32c50aeaef7a581309f92fba2731a6ccd64;hpb=07a52db97ca6689ecc846818cfb681dd9b3c02e3;p=vlc diff --git a/bindings/python/vlc_module.c b/bindings/python/vlc_module.c index ba2fd32c50..b8a6348d0e 100644 --- a/bindings/python/vlc_module.c +++ b/bindings/python/vlc_module.c @@ -1,10 +1,10 @@ /***************************************************************************** * vlc_module.c: vlc python binding module ***************************************************************************** - * Copyright (C) 2006 the VideoLAN team - * $Id: $ + * Copyright (C) 2006,2007,2008,2009 the VideoLAN team + * $Id$ * - * Authors: Olivier Aubert + * Authors: Olivier Aubert * * 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 @@ -21,10 +21,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ -/* We need to access some internal features of VLC (for vlc_object) */ -#define __VLC__ - - #include "vlcglue.h" /************************************************************************** @@ -51,11 +47,13 @@ initvlc( void ) { PyObject* p_module; - PyPosition_Type.tp_new = PyType_GenericNew; - PyPosition_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; - vlcInput_Type.tp_new = PyType_GenericNew; - vlcInput_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." ); @@ -67,11 +65,11 @@ initvlc( void ) return; if( PyType_Ready( &MediaControl_Type ) < 0 ) return; - if( PyType_Ready( &vlcObject_Type ) < 0 ) - return; if( PyType_Ready( &vlcInstance_Type ) < 0 ) return; - if( PyType_Ready( &vlcInput_Type ) < 0 ) + if( PyType_Ready( &vlcMediaPlayer_Type ) < 0 ) + return; + if( PyType_Ready( &vlcMedia_Type ) < 0 ) return; /* Exceptions */ @@ -106,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 ); @@ -121,15 +119,17 @@ initvlc( void ) PyModule_AddObject( p_module, "MediaControl", ( PyObject * )&MediaControl_Type ); - Py_INCREF( &vlcObject_Type ); - PyModule_AddObject( p_module, "Object", - ( PyObject * )&vlcObject_Type ); Py_INCREF( &vlcInstance_Type ); PyModule_AddObject( p_module, "Instance", ( PyObject * )&vlcInstance_Type ); - Py_INCREF( &vlcInput_Type ); - PyModule_AddObject( p_module, "Input", - ( PyObject * )&vlcInput_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", @@ -145,38 +145,29 @@ initvlc( void ) mediacontrol_SampleCount ); PyModule_AddIntConstant( p_module, "MediaTime", mediacontrol_MediaTime ); + PyModule_AddIntConstant( p_module, "PlayingStatus", mediacontrol_PlayingStatus ); PyModule_AddIntConstant( p_module, "PauseStatus", mediacontrol_PauseStatus ); - PyModule_AddIntConstant( p_module, "ForwardStatus", - mediacontrol_ForwardStatus ); - PyModule_AddIntConstant( p_module, "BackwardStatus", - mediacontrol_BackwardStatus ); PyModule_AddIntConstant( p_module, "InitStatus", mediacontrol_InitStatus ); PyModule_AddIntConstant( p_module, "EndStatus", mediacontrol_EndStatus ); PyModule_AddIntConstant( p_module, "UndefinedStatus", mediacontrol_UndefinedStatus ); -} - -/* 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 - the recommended way to forward declare types in python is + the recommended way to forward declared types in python is static... I am sorting the mess but in the meantime, this will produce a working python module. */ #include "vlc_mediacontrol.c" #include "vlc_position.c" #include "vlc_instance.c" -#include "vlc_input.c" -#include "vlc_object.c" +#include "vlc_mediaplayer.c" +#include "vlc_media.c"