Changeset 45cd6d75350e2f9f3d1e7c30a7f34c119acb5ec8

Show
Ignore:
Timestamp:
26/04/05 09:17:42 (4 years ago)
Author:
Laurent Aimar <fenrir@videolan.org>
git-committer:
Laurent Aimar <fenrir@videolan.org> 1114499862 +0000
git-parent:

[973ad2a430f2edde6be39aca1bc5abfa6fe78201]

git-author:
Laurent Aimar <fenrir@videolan.org> 1114499862 +0000
Message:
  • control: added INPUT_DEL_INFO.
  • input: allow chaining of access_filter (like filter1:filter2 ...)
  • es_out: support VLC_META_NOW_PLAYING for multi-program stream.
Files:

Legend:

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

    rbfb6686 r45cd6d7  
    197197        } 
    198198        return VLC_SUCCESS; 
     199        case INPUT_DEL_INFO: 
     200        { 
     201            char *psz_cat = (char *)va_arg( args, char * ); 
     202            char *psz_name = (char *)va_arg( args, char * ); 
     203 
     204            info_category_t *p_cat = NULL; 
     205            int i; 
     206 
     207            vlc_mutex_lock( &p_input->input.p_item->lock ); 
     208            for( i = 0; i < p_input->input.p_item->i_categories; i++ ) 
     209            { 
     210                if( !strcmp( p_input->input.p_item->pp_categories[i]->psz_name, 
     211                             psz_cat ) ) 
     212                { 
     213                    p_cat = p_input->input.p_item->pp_categories[i]; 
     214                    break; 
     215                } 
     216            } 
     217            if( p_cat == NULL ) 
     218            { 
     219                vlc_mutex_unlock( &p_input->input.p_item->lock ); 
     220                return VLC_EGENERIC; 
     221            } 
     222 
     223            for( i = 0; i < p_cat->i_infos; i++ ) 
     224            { 
     225                if( !strcmp( p_cat->pp_infos[i]->psz_name, psz_name ) ) 
     226                { 
     227                    REMOVE_ELEM( p_cat->pp_infos, p_cat->i_infos, i ); 
     228                    break; 
     229                } 
     230            } 
     231            vlc_mutex_unlock( &p_input->input.p_item->lock ); 
     232 
     233            if( i >= p_cat->i_infos ) 
     234                return VLC_EGENERIC; 
     235 
     236            NotifyPlaylist( p_input ); 
     237        } 
     238        return VLC_SUCCESS; 
     239 
    199240 
    200241        case INPUT_GET_INFO: 
     
    204245            char **ppsz_value = (char **)va_arg( args, char ** ); 
    205246            int i_ret = VLC_EGENERIC; 
    206             int i; 
    207247            *ppsz_value = NULL; 
    208248 
  • src/input/es_out.c

    rfb217d8 r45cd6d7  
    5454    input_clock_t clock; 
    5555 
     56    char    *psz_now_playing; 
     57 
    5658} es_out_pgrm_t; 
    5759 
     
    239241    for( i = 0; i < p_sys->i_pgrm; i++ ) 
    240242    { 
     243        if( p_sys->pgrm[i]->psz_now_playing ) 
     244            free( p_sys->pgrm[i]->psz_now_playing ); 
    241245        free( p_sys->pgrm[i] ); 
    242246    } 
     
    442446    } 
    443447 
     448    /* Update now playing if defined per program */ 
     449    if( p_pgrm->psz_now_playing ) 
     450    { 
     451        char *psz_cat = malloc( strlen(_("Program")) + 10 ); 
     452 
     453        sprintf( psz_cat, "%s %d", _("Program"), p_pgrm->i_id ); 
     454        input_Control( p_input, INPUT_ADD_INFO, _("Meta-information"), 
     455                       VLC_META_NOW_PLAYING, "%s", p_pgrm->psz_now_playing ); 
     456        free( psz_cat ); 
     457    } 
     458 
     459 
    444460    var_SetBool( p_sys->p_input, "intf-change", VLC_TRUE ); 
    445461} 
     
    460476    p_pgrm->i_es = 0; 
    461477    p_pgrm->b_selected = VLC_FALSE; 
     478    p_pgrm->psz_now_playing = NULL; 
    462479    input_ClockInit( &p_pgrm->clock, VLC_FALSE, p_input->input.i_cr_average ); 
    463480 
     
    485502{ 
    486503    es_out_sys_t      *p_sys = out->p_sys; 
     504    es_out_pgrm_t     *p_pgrm = NULL; 
    487505    input_thread_t    *p_input = p_sys->p_input; 
    488506    char              *psz_cat = malloc( strlen(_("Program")) + 10 ); 
     507    char              *psz_name = NULL; 
     508    char              *psz_now_playing = NULL; 
     509    char              *psz_provider = NULL; 
    489510    int i; 
    490511 
     
    498519        input_Control( p_input, INPUT_ADD_INFO, psz_cat, 
    499520                      _(p_meta->name[i]), "%s", p_meta->value[i] ); 
     521        if( !strcasecmp( p_meta->name[i], "Name" ) ) 
     522            psz_name = p_meta->value[i]; 
     523        else if( !strcasecmp( p_meta->name[i], "Provider" ) ) 
     524            psz_provider = p_meta->value[i]; 
     525        else if( !strcasecmp( p_meta->name[i], VLC_META_NOW_PLAYING ) ) 
     526            psz_now_playing = p_meta->value[i]; 
     527    } 
     528 
     529    if( !psz_name && !psz_now_playing ) 
     530    { 
     531        free( psz_cat ); 
     532        return; 
     533    } 
     534 
     535    for( i = 0; i < p_sys->i_pgrm; i++ ) 
     536    { 
     537        if( p_sys->pgrm[i]->i_id == i_group ) 
     538        { 
     539            p_pgrm = p_sys->pgrm[i]; 
     540            break; 
     541        } 
     542    } 
     543 
     544    if( p_pgrm == NULL ) 
     545        p_pgrm = EsOutProgramAdd( out, i_group ); 
     546 
     547    /* Update the description text of the program */ 
     548    if( psz_name && *psz_name ) 
     549    { 
     550        vlc_value_t val; 
     551        vlc_value_t text; 
     552 
     553        /* ugly but it works */ 
     554        val.i_int = i_group; 
     555        var_Change( p_input, "program", VLC_VAR_DELCHOICE, &val, NULL ); 
     556 
     557        if( psz_provider && *psz_provider ) 
     558        { 
     559            asprintf( &text.psz_string, "%s [%s]", psz_name, psz_provider ); 
     560            var_Change( p_input, "program", VLC_VAR_ADDCHOICE, &val, &text ); 
     561            free( text.psz_string ); 
     562        } 
     563        else 
     564        { 
     565            text.psz_string = psz_name; 
     566            var_Change( p_input, "program", VLC_VAR_ADDCHOICE, &val, &text ); 
     567        } 
     568    } 
     569    if( psz_now_playing ) 
     570    { 
     571        p_pgrm->psz_now_playing = strdup(psz_now_playing); 
     572 
     573        if( p_sys->p_pgrm == p_pgrm ) 
     574        { 
     575            input_Control( p_input, INPUT_ADD_INFO, _("Meta-information"), 
     576                           VLC_META_NOW_PLAYING, "%s", psz_now_playing ); 
     577        } 
    500578    } 
    501579    free( psz_cat ); 
  • src/input/input.c

    r41c5188 r45cd6d7  
    218218        free( val.psz_string ); 
    219219    } 
     220 
     221    /* Remove 'Now playing' info as it is probably outdated */ 
     222    input_Control( p_input, INPUT_DEL_INFO, _("Meta-information"), 
     223                   VLC_META_NOW_PLAYING ); 
    220224 
    221225    /* Now we can attach our new input */ 
     
    19121916    char *psz_demux; 
    19131917    char *psz_path; 
     1918    char *psz_tmp; 
    19141919    char *psz; 
    19151920    vlc_value_t val; 
     
    19181923    if( !b_quick ) 
    19191924    { 
    1920         MRLSplit( p_input, psz_dup, &psz_access, &psz_demux, &psz_path ); 
     1925        MRLSplit( VLC_OBJECT(p_input), psz_dup, 
     1926                  &psz_access, &psz_demux, &psz_path ); 
    19211927 
    19221928        msg_Dbg( p_input, "`%s' gives access `%s' demux `%s' path `%s'", 
     
    20232029 
    20242030        /* */ 
    2025         psz = var_GetString( p_input, "access-filter" ); 
    2026         if( *psz ) 
     2031        psz_tmp = psz = var_GetString( p_input, "access-filter" ); 
     2032        while( psz && *psz ) 
    20272033        { 
    20282034            access_t *p_access = in->p_access; 
    2029  
    2030             /* TODO support chained access-filter */ 
     2035            char *end = strchr( psz, ':' ); 
     2036 
     2037            if( end ) 
     2038                *end++ = '\0'; 
     2039 
    20312040            in->p_access = access2_FilterNew( in->p_access, psz ); 
    20322041            if( in->p_access == NULL ) 
     
    20362045                          psz ); 
    20372046            } 
    2038         } 
    2039         free( psz ); 
     2047 
     2048            psz = end; 
     2049        } 
     2050        free( psz_tmp ); 
    20402051 
    20412052        /* Get infos from access */