X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Finput%2Fvar.c;h=764f916953f585c531d169b46b666f74f53ae309;hb=99bb249f66bba2da58eb2d286bca1614464f4045;hp=93b967a348f361914bc369925086b76720279cd5;hpb=f7c9f8329d7b5aa5fb313d1a0409512db8eaa09f;p=vlc diff --git a/src/input/var.c b/src/input/var.c index 93b967a348..764f916953 100644 --- a/src/input/var.c +++ b/src/input/var.c @@ -178,7 +178,7 @@ void input_ControlVarInit ( input_thread_t *p_input ) var_Change( p_input, "program", VLC_VAR_SETTEXT, &text, NULL ); /* Programs */ - var_Create( p_input, "programs", VLC_VAR_LIST | VLC_VAR_DOINHERIT ); + var_Create( p_input, "programs", VLC_VAR_STRING | VLC_VAR_DOINHERIT ); text.psz_string = _("Programs"); var_Change( p_input, "programs", VLC_VAR_SETTEXT, &text, NULL ); @@ -220,8 +220,6 @@ void input_ControlVarInit ( input_thread_t *p_input ) text.psz_string = _("Subtitles Track"); var_Change( p_input, "spu-es", VLC_VAR_SETTEXT, &text, NULL ); - var_Create( p_input, "sub-margin", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT ); - /* Special read only objects variables for intf */ var_Create( p_input, "bookmarks", VLC_VAR_STRING | VLC_VAR_DOINHERIT ); @@ -310,16 +308,26 @@ void input_ControlVarNavigation( input_thread_t *p_input ) var_AddCallback( p_input, val.psz_string, NavigationCallback, (void *)(intptr_t)i ); + char psz_length[MSTRTIME_MAX_SIZE + sizeof(" []")] = ""; + if( p_input->p->title[i]->i_length > 0 ) + { + strcpy( psz_length, " [" ); + secstotimestr( &psz_length[2], p_input->p->title[i]->i_length / CLOCK_FREQ ); + strcat( psz_length, "]" ); + } + if( p_input->p->title[i]->psz_name == NULL || *p_input->p->title[i]->psz_name == '\0' ) { - if( asprintf( &text.psz_string, _("Title %i"), - i + p_input->p->i_title_offset ) == -1 ) + if( asprintf( &text.psz_string, _("Title %i%s"), + i + p_input->p->i_title_offset, psz_length ) == -1 ) continue; } else { - text.psz_string = strdup( p_input->p->title[i]->psz_name ); + if( asprintf( &text.psz_string, "%s%s", + p_input->p->title[i]->psz_name, psz_length ) == -1 ) + continue; } var_Change( p_input, "navigation", VLC_VAR_ADDCHOICE, &val, &text );