Commit 74c4a79a authored by Antoine Cellerier's avatar Antoine Cellerier

Allow using an object's psz_object_name as id for the libvlc_global commands...

Allow using an object's psz_object_name as id for the libvlc_global commands "tree" and "vars". Example use:
./vlc -I rc --sub-filter marq@test --no-audio ~/media/redefined-nintendo.mpg
vars test
(instead of "vars 376" ... or whatever the integer id is) 
parent 6dcadb73
......@@ -805,7 +805,30 @@ static int DumpCommand( vlc_object_t *p_this, char const *psz_cmd,
if( *newval.psz_string )
{
p_object = vlc_object_get( p_this, atoi(newval.psz_string) );
char *end;
int i_id = strtol( newval.psz_string, &end, 0 );
if( end != newval.psz_string )
p_object = vlc_object_get( p_this, i_id );
else
{
/* try using the object's name to find it */
vlc_object_t *p_libvlc = vlc_object_get( p_this, 1 );
if( p_libvlc )
{
/* Look in p_libvlc's children tree */
p_object = vlc_object_find_name( p_libvlc,
newval.psz_string,
FIND_CHILD );
vlc_object_release( p_libvlc );
}
if( !p_object )
{
/* If it's not in libvlc, look in libvlc_global (== p_this) */
p_object = vlc_object_find_name( p_this,
newval.psz_string,
FIND_CHILD );
}
}
if( !p_object )
{
......
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