Changeset 74c4a79a0a74ac86c01092133ff028cf60944fea

Show
Ignore:
Timestamp:
24/03/07 18:13:40 (2 years ago)
Author:
Antoine Cellerier <dionoea@videolan.org>
git-committer:
Antoine Cellerier <dionoea@videolan.org> 1174756420 +0000
git-parent:

[6dcadb7383893d390c5623161fce72c9ce16b893]

git-author:
Antoine Cellerier <dionoea@videolan.org> 1174756420 +0000
Message:

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)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/misc/objects.c

    r79c1ddf r74c4a79  
    806806        if( *newval.psz_string ) 
    807807        { 
    808             p_object = vlc_object_get( p_this, atoi(newval.psz_string) ); 
     808            char *end; 
     809            int i_id = strtol( newval.psz_string, &end, 0 ); 
     810            if( end != newval.psz_string ) 
     811                p_object = vlc_object_get( p_this, i_id ); 
     812            else 
     813            { 
     814                /* try using the object's name to find it */ 
     815                vlc_object_t *p_libvlc = vlc_object_get( p_this, 1 ); 
     816                if( p_libvlc ) 
     817                { 
     818                    /* Look in p_libvlc's children tree */ 
     819                    p_object = vlc_object_find_name( p_libvlc, 
     820                                                     newval.psz_string, 
     821                                                     FIND_CHILD ); 
     822                    vlc_object_release( p_libvlc ); 
     823                } 
     824                if( !p_object ) 
     825                { 
     826                    /* If it's not in libvlc, look in libvlc_global (== p_this) */ 
     827                    p_object = vlc_object_find_name( p_this, 
     828                                                     newval.psz_string, 
     829                                                     FIND_CHILD ); 
     830                } 
     831            } 
    809832 
    810833            if( !p_object )