Changeset 315f9cd4ce80636011fb55c510a0633ddcb9201f

Show
Ignore:
Timestamp:
22/11/04 10:57:50 (4 years ago)
Author:
Laurent Aimar <fenrir@videolan.org>
git-committer:
Laurent Aimar <fenrir@videolan.org> 1101117470 +0000
git-parent:

[8abeccdfe628d295c204ba18a00a0b0e86e4aed2]

git-author:
Laurent Aimar <fenrir@videolan.org> 1101117470 +0000
Message:

all: implemented INPUT_ADD_SLAVE.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/input/control.c

    r24b9dd1 r315f9cd  
    6464    int64_t i_64, *pi_64; 
    6565 
     66    char *psz; 
     67    vlc_value_t val; 
     68 
    6669    switch( i_query ) 
    6770    { 
     
    280283 
    281284            return VLC_SUCCESS; 
    282             break; 
    283285 
    284286        case INPUT_CHANGE_BOOKMARK: 
     
    309311 
    310312            return VLC_SUCCESS; 
    311             break; 
    312313 
    313314        case INPUT_DEL_BOOKMARK: 
     
    343344 
    344345            return VLC_EGENERIC; 
    345             break; 
    346346 
    347347        case INPUT_GET_BOOKMARKS: 
     
    397397 
    398398            return VLC_SUCCESS; 
    399             break; 
    400399 
    401400        case INPUT_SET_BOOKMARK: 
     
    470469 
    471470            return VLC_SUCCESS; 
    472             break; 
    473471        } 
    474472 
     
    478476                stream_Tell( p_input->input.p_stream ); 
    479477            return VLC_SUCCESS; 
    480             break; 
    481478 
    482479        case INPUT_SET_BYTE_SIZE: 
     
    485482                stream_Size( p_input->input.p_stream ); 
    486483            return VLC_SUCCESS; 
    487             break; 
     484 
     485        case INPUT_ADD_SLAVE: 
     486            psz = (char*)va_arg( args, char * ); 
     487            if( psz && *psz ) 
     488            { 
     489                val.psz_string = strdup( psz ); 
     490                input_ControlPush( p_input, INPUT_CONTROL_ADD_SLAVE, &val ); 
     491            } 
     492            return VLC_SUCCESS; 
    488493 
    489494        default: 
  • src/input/input.c

    r3a9b48d r315f9cd  
    14061406            break; 
    14071407 
     1408        case INPUT_CONTROL_ADD_SLAVE: 
     1409            if( val.psz_string ) 
     1410            { 
     1411                input_source_t *slave = InputSourceNew( p_input ); 
     1412 
     1413                if( !InputSourceInit( p_input, slave, val.psz_string, NULL ) ) 
     1414                { 
     1415                    vlc_meta_t *p_meta_new = NULL; 
     1416                    vlc_meta_t *p_meta; 
     1417                    int64_t i_time; 
     1418 
     1419                    /* Add the slave */ 
     1420                    msg_Dbg( p_input, "adding %s as slave on the fly", 
     1421                             val.psz_string ); 
     1422 
     1423                    /* Set position */ 
     1424                    if( demux2_Control( p_input->input.p_demux, 
     1425                                        DEMUX_GET_TIME, &i_time ) ) 
     1426                    { 
     1427                        msg_Err( p_input, "demux doesn't like DEMUX_GET_TIME" ); 
     1428                        InputSourceClean( p_input, slave ); 
     1429                        free( slave ); 
     1430                        break; 
     1431                    } 
     1432                    if( demux2_Control( slave->p_demux, 
     1433                                        DEMUX_SET_TIME, i_time ) ) 
     1434                    { 
     1435                        msg_Err( p_input, "seek failed for new slave" ); 
     1436                        InputSourceClean( p_input, slave ); 
     1437                        free( slave ); 
     1438                        break; 
     1439                    } 
     1440 
     1441 
     1442                    /* Get meta (access and demux) */ 
     1443                    if( access2_Control( slave->p_access, 
     1444                                          ACCESS_GET_META, &p_meta_new ) ) 
     1445                        p_meta_new = NULL; 
     1446                    if( !demux2_Control( slave->p_demux, 
     1447                                         DEMUX_GET_META, &p_meta ) ) 
     1448                    { 
     1449                        if( p_meta_new ) 
     1450                        { 
     1451                            vlc_meta_Merge( p_meta_new, p_meta ); 
     1452                            vlc_meta_Delete( p_meta ); 
     1453                        } 
     1454                        else 
     1455                        { 
     1456                            p_meta_new = p_meta; 
     1457                        } 
     1458                    } 
     1459                    /* Update meta */ 
     1460                    if( p_meta_new ) 
     1461                    { 
     1462                        if( p_input->p_meta ) 
     1463                        { 
     1464                            vlc_meta_Merge( p_input->p_meta, p_meta_new ); 
     1465                            vlc_meta_Delete( p_meta_new ); 
     1466                        } 
     1467                        else 
     1468                        { 
     1469                            p_input->p_meta = p_meta_new; 
     1470                        } 
     1471                        UpdateMeta( p_input ); 
     1472                    } 
     1473 
     1474                    TAB_APPEND( p_input->i_slave, p_input->slave, slave ); 
     1475                } 
     1476                else 
     1477                { 
     1478                    msg_Warn( p_input, "failed to add %s as slave", 
     1479                              val.psz_string ); 
     1480                } 
     1481 
     1482                free( val.psz_string ); 
     1483            } 
     1484            break; 
     1485 
    14081486        case INPUT_CONTROL_SET_BOOKMARK: 
    14091487        default: 
  • src/input/input_internal.h

    rc33b49c r315f9cd  
    5757    INPUT_CONTROL_SET_AUDIO_DELAY, 
    5858    INPUT_CONTROL_SET_SPU_DELAY, 
     59 
     60    INPUT_CONTROL_ADD_SLAVE, 
    5961}; 
    6062