]> git.sesse.net Git - vlc/blobdiff - bindings/python/vlc_instance.c
Python: Fix misspelling of media_instance.
[vlc] / bindings / python / vlc_instance.c
index 6bf3e9ed96c49264a406c625decf49f40fa6b472..e46d6da449b8ddd101512b027a8ef027b4aae918 100644 (file)
@@ -2,7 +2,7 @@
  * vlc_instance.c: vlc.Instance binding
  *****************************************************************************
  * Copyright (C) 2006 the VideoLAN team
- * $Id$
+ * $Id$
  *
  * Authors: Olivier Aubert <oaubert at bat710.univ-lyon1.fr>
  *
 #include "vlcglue.h"
 
 /* Helper functions */
-static int
+static Py_ssize_t
 pyoptions_to_args(PyObject *py_options, char*** pppsz_args)
 {
-    int i_size;
-    int i_index;
+    Py_ssize_t i_size;
+    Py_ssize_t  i_index;
     char** ppsz_args = *pppsz_args;
     
     ppsz_args = NULL;
@@ -82,9 +82,6 @@ vlcInstance_new( PyTypeObject *type, PyObject *args, PyObject *kwds )
     char** ppsz_args = NULL;
     int i_size = 0;
 
-    self = PyObject_New( vlcInstance, &vlcInstance_Type );
-
-
     if( PyArg_ParseTuple( args, "O", &py_list ) )
     {
         i_size = pyoptions_to_args( py_list, &ppsz_args );
@@ -98,6 +95,8 @@ vlcInstance_new( PyTypeObject *type, PyObject *args, PyObject *kwds )
         PyErr_Clear( );
     }
 
+    self = PyObject_New( vlcInstance, &vlcInstance_Type );
+
     Py_BEGIN_ALLOW_THREADS
     LIBVLC_TRY
     LIBVLC_INSTANCE->p_instance = libvlc_new( i_size, ppsz_args, &ex );
@@ -114,7 +113,7 @@ vlcInstance_dealloc( PyObject *self )
 {
     libvlc_exception_t ex;
     libvlc_destroy( LIBVLC_INSTANCE->p_instance, &ex );
-    PyMem_DEL( self );
+    PyObject_DEL( self );
 }
 
 static PyObject *
@@ -319,15 +318,15 @@ static PyObject *
 vlcInstance_playlist_get_input( PyObject *self, PyObject *args )
 {
     libvlc_exception_t ex;
-    libvlc_input_t *p_input;
+    libvlc_media_instance_t *p_md;
     vlcInput *p_ret;
 
     LIBVLC_TRY;
-    p_input = libvlc_playlist_get_input( LIBVLC_INSTANCE->p_instance, &ex );
+    p_md = libvlc_playlist_get_media_instance( LIBVLC_INSTANCE->p_instance, &ex );
     LIBVLC_EXCEPT;
 
     p_ret = PyObject_New( vlcInput, &vlcInput_Type );
-    p_ret->p_input = p_input;
+    p_ret->p_md = p_md;
     Py_INCREF( p_ret ); /* Ah bon ? */
     return ( PyObject * )p_ret;
 }
@@ -428,7 +427,7 @@ vlcInstance_audio_set_volume( PyObject *self, PyObject *args )
         return NULL;
 
     LIBVLC_TRY;
-    libvlc_audio_set_mute( LIBVLC_INSTANCE->p_instance, i_volume, &ex );
+    libvlc_audio_set_volume( LIBVLC_INSTANCE->p_instance, i_volume, &ex );
     LIBVLC_EXCEPT;
     Py_INCREF( Py_None );
     return Py_None;
@@ -438,28 +437,25 @@ static PyObject *
 vlcInstance_audio_get_channel( PyObject *self, PyObject *args )
 {
     libvlc_exception_t ex;
-    char* psz_ret;
-    PyObject* o_ret;
+    int i_ret;
 
     LIBVLC_TRY;
-    psz_ret = libvlc_audio_get_channel( LIBVLC_INSTANCE->p_instance, &ex );
+    i_ret = libvlc_audio_get_channel( LIBVLC_INSTANCE->p_instance, &ex );
     LIBVLC_EXCEPT;
-    o_ret=Py_BuildValue( "s", psz_ret );
-    free( psz_ret );
-    return o_ret;
+    return Py_BuildValue( "i", i_ret );
 }
 
 static PyObject *
 vlcInstance_audio_set_channel( PyObject *self, PyObject *args )
 {
     libvlc_exception_t ex;
-    char* psz_channel;
+    int i_channel;
 
-    if( !PyArg_ParseTuple( args, "s", &psz_channel ) )
+    if( !PyArg_ParseTuple( args, "i", &i_channel ) )
         return NULL;
 
     LIBVLC_TRY;
-    libvlc_audio_set_channel( LIBVLC_INSTANCE->p_instance, psz_channel, &ex );
+    libvlc_audio_set_channel( LIBVLC_INSTANCE->p_instance, i_channel, &ex );
     LIBVLC_EXCEPT;
     Py_INCREF( Py_None );
     return Py_None;