vlc | branch: master | Thomas Guillem <[email protected]> | Tue Jun 7 13:44:09 2016 +0200| [c34d719fb430f4dd441ddf3a645cdaa29aa138ba] | committer: Thomas Guillem
input/input: handle the "input-slave" option in LoadSlaves > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c34d719fb430f4dd441ddf3a645cdaa29aa138ba --- src/input/input.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/input/input.c b/src/input/input.c index 240cb8a..e421b33 100644 --- a/src/input/input.c +++ b/src/input/input.c @@ -989,12 +989,16 @@ static void SetSubtitlesOptions( input_thread_t *p_input ) var_SetInteger( p_input, "spu-delay", (mtime_t)i_delay * 100000 ); } -static void LoadVarSlaves( input_thread_t *p_input ) +static void GetVarSlaves( input_thread_t *p_input, + input_item_slave_t ***ppp_slaves, int *p_slaves ) { char *psz = var_GetNonEmptyString( p_input, "input-slave" ); if( !psz ) return; + input_item_slave_t **pp_slaves = *ppp_slaves; + int i_slaves = *p_slaves; + char *psz_org = psz; while( psz && *psz ) { @@ -1013,14 +1017,19 @@ static void LoadVarSlaves( input_thread_t *p_input ) psz = psz_delim; if( uri == NULL ) continue; - msg_Dbg( p_input, "adding slave input '%s'", uri ); - input_source_t *p_slave = InputSourceNew( p_input, uri, NULL, false ); - if( p_slave ) - TAB_APPEND( p_input->p->i_slave, p_input->p->slave, p_slave ); + input_item_slave_t *p_slave = + input_item_slave_New( uri, SLAVE_TYPE_AUDIO, SLAVE_PRIORITY_USER ); free( uri ); + + if( unlikely( p_slave == NULL ) ) + break; + INSERT_ELEM( pp_slaves, i_slaves, i_slaves, p_slave ); } free( psz_org ); + + *ppp_slaves = pp_slaves; /* in case of realloc */ + *p_slaves = i_slaves; } static void LoadSlaves( input_thread_t *p_input ) @@ -1092,6 +1101,9 @@ static void LoadSlaves( input_thread_t *p_input ) } TAB_CLEAN( p_item->i_slaves, p_item->pp_slaves ); + /* Add slaves from the "input-slave" option */ + GetVarSlaves( p_input, &pp_slaves, &i_slaves ); + if( i_slaves > 0 ) { qsort( pp_slaves, i_slaves, sizeof (input_item_slave_t*), @@ -1312,7 +1324,6 @@ static int Init( input_thread_t * p_input ) StartTitle( p_input ); SetSubtitlesOptions( p_input ); LoadSlaves( p_input ); - LoadVarSlaves( p_input ); InitPrograms( p_input ); double f_rate = var_InheritFloat( p_input, "rate" ); _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
