]> git.sesse.net Git - vlc/blobdiff - bindings/python/vlcglue.h
python: use new function libvlc_errmsg (reported by Xitij Patel <xitij.patel@xitijpat...
[vlc] / bindings / python / vlcglue.h
index d0eb18728dd8837fb65cd6c1fb855fe87f156c8f..521164572935a1a59df17ae3881c100be3b118c0 100644 (file)
@@ -4,7 +4,7 @@
  * Copyright (C) 1998-2004 the VideoLAN team
  * $Id$
  *
- * Authors: Olivier Aubert <oaubert at bat710.univ-lyon1.fr>
+ * Authors: Olivier Aubert <olivier.aubert at liris.cnrs.fr>
  *          ClĂ©ment Stenac <zorglub@videolan.org>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -40,7 +40,6 @@ typedef int Py_ssize_t;
 #define PY_SSIZE_T_MIN INT_MIN
 #endif
 
-#define SELF ((MediaControl*)self)
 
 /**********************************************************************
  * Exceptions handling
@@ -78,7 +77,7 @@ PyObject *MediaControl_PositionKeyNotSupported;
 PyObject *MediaControl_PositionOriginNotSupported;
 PyObject *MediaControl_InvalidPosition;
 PyObject *MediaControl_PlaylistException;
-PyObject *vlcInstance_Exception;
+PyObject *vlc_Exception;
 
 /**********************************************************************
  * vlc.Instance Object
@@ -89,8 +88,6 @@ typedef struct
     libvlc_instance_t* p_instance;
 } vlcInstance;
 
-#define LIBVLC_INSTANCE ((vlcInstance*)self)
-
 /**********************************************************************
  * MediaControl Object
  **********************************************************************/
@@ -113,27 +110,40 @@ typedef struct
 } PyPosition;
 
 /**********************************************************************
- * vlc.Input Object
+ * vlc.MediaPlayer Object
+ **********************************************************************/
+typedef struct
+{
+    PyObject_HEAD
+    libvlc_media_player_t* p_mp;
+} vlcMediaPlayer;
+
+/**********************************************************************
+ * vlc.Media Object
  **********************************************************************/
 typedef struct
 {
     PyObject_HEAD
-    libvlc_media_instance_t* p_md;
-} vlcInput;
+    libvlc_media_t* p_media;
+} vlcMedia;
 
 /* Forward declarations */
 staticforward PyTypeObject MediaControl_Type;
 staticforward PyTypeObject PyPosition_Type;
 staticforward PyTypeObject vlcInstance_Type;
-staticforward PyTypeObject vlcInput_Type;
+staticforward PyTypeObject vlcMediaPlayer_Type;
+staticforward PyTypeObject vlcMedia_Type;
 
-#define LIBVLC_INPUT ((vlcInput*)self)
+#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 );
 
 #define LIBVLC_EXCEPT if( libvlc_exception_raised( &ex ) ) { \
-    PyObject *py_exc = vlcInstance_Exception; \
-    PyErr_SetString( py_exc, libvlc_exception_get_message( &ex ) ); \
+    PyObject *py_exc = vlc_Exception; \
+    PyErr_SetString( py_exc, libvlc_errmsg() );        \
     return NULL; \
   }