*****************************************************************************/
#include "vlc_internal.h"
+#include "../../src/libvlc.h"
/**************************************************************************
* VLC Module
vlcObject_dealloc( PyObject *self )
{
vlcObject_release( self, NULL );
- PyMem_DEL( self );
+ PyObject_DEL( self );
}
static PyObject *
return ( PyObject * )p_retval;
}
+static PyObject *
+vlcObject_find_name( PyObject *self, PyObject *args )
+{
+ vlcObject *p_retval;
+ vlc_object_t *p_obj;
+ char *psz_name;
+
+ if( !PyArg_ParseTuple( args, "s", &psz_name ) )
+ return NULL;
+
+ p_obj = vlc_object_find_name( VLCSELF->p_object, psz_name, FIND_ANYWHERE );
+
+ if( !p_obj )
+ {
+ Py_INCREF( Py_None );
+ return Py_None;
+ }
+
+ p_retval = PyObject_New( vlcObject, &vlcObject_Type );
+
+ p_retval->p_object = p_obj;
+
+ return ( PyObject * )p_retval;
+}
+
static PyObject *
vlcObject_info( PyObject *self, PyObject *args )
{
PyObject *p_retval;
vlc_object_t *p_obj;
-
+ vlc_object_internals_t *p_priv;
+
p_obj = VLCSELF->p_object;
+ p_priv = vlc_internals( p_obj );
/* Return information about the object as a dict. */
p_retval = PyDict_New();
PyDict_SetItemString( p_retval, "object-name",
Py_BuildValue( "s", p_obj->psz_object_name ) );
PyDict_SetItemString( p_retval, "thread",
- PyBool_FromLong( p_obj->b_thread ) );
+ PyBool_FromLong( p_priv->b_thread ) );
PyDict_SetItemString( p_retval, "thread-id",
- PyLong_FromLongLong( p_obj->thread_id ) );
+ PyLong_FromLongLong( p_priv->thread_id ) );
PyDict_SetItemString( p_retval, "refcount",
- PyInt_FromLong( p_obj->i_refcount ) );
-
+ PyInt_FromLong( p_priv->i_refcount ) );
return p_retval;
}
PyObject *p_retval;
Py_ssize_t i_size;
Py_ssize_t i_index;
+ vlc_object_internals_t *p_priv;
- i_size = VLCSELF->p_object->i_vars;
+ p_priv = vlc_internals( VLCSELF->p_object );
+ i_size = p_priv->i_vars;
p_retval = PyTuple_New( i_size );
+
for ( i_index = 0 ; i_index < i_size ; i_index++ )
{
PyTuple_SetItem( p_retval, i_index,
- Py_BuildValue( "s", VLCSELF->p_object->p_vars[i_index].psz_name ) );
+ Py_BuildValue( "s", p_priv->p_vars[i_index].psz_name ) );
}
return p_retval;
"find_object( str ) -> Object Find the object of a given type.\n\nAvailable types are : aout, decoder, input, httpd, intf, playlist, root, vlc, vout"},
{ "find_id", vlcObject_find_id, METH_VARARGS,
"find_id( int ) -> Object Find an object by id" },
+ { "find_name", vlcObject_find_name, METH_VARARGS,
+ "find_name( str ) -> Object Find an object by name" },
{ "info", vlcObject_info, METH_NOARGS,
"info( ) -> dict Return information about the object" },
{ "release", vlcObject_release, METH_NOARGS,
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
- "Expose VLC object infrastructure.\n\nConstructor: vlc.Object(object_id)", /* tp_doc */
+ "Expose VLC object internal infrastructure.\n\nConstructor: vlc.Object(object_id)\n\nPLEASE BE AWARE that accessing internal features of VLC voids the guarantee for the product and is not advised except if you know what you are doing.", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */