vlc | branch: master | Laurent Aimar <[email protected]> | Wed Aug 11 23:08:31 2010 +0200| [6759cca26487f2edf4e27afe1b9ba4483f6b84bf] | committer: Laurent Aimar
Display the title length (when known) in Playback->Title/Navigation. It closes #4021 at the core level. The access_demux/demux need to set input_title_t::i_length to actually change something. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6759cca26487f2edf4e27afe1b9ba4483f6b84bf --- src/input/var.c | 16 +++++++++++++--- 1 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/input/var.c b/src/input/var.c index 92e738f..764f916 100644 --- a/src/input/var.c +++ b/src/input/var.c @@ -308,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 ); _______________________________________________ vlc-commits mailing list [email protected] http://mailman.videolan.org/listinfo/vlc-commits
