vlc | branch: master | Denis Charmet <[email protected]> | Tue Sep 4 13:53:36 2012 +0200| [df0b9f55b263a422a560efd10e33bd31f5569c35] | committer: Jean-Baptiste Kempf
MKV: Handle multi-editions as different titles Close #7401 Signed-off-by: Jean-Baptiste Kempf <[email protected]> > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=df0b9f55b263a422a560efd10e33bd31f5569c35 --- modules/demux/mkv/demux.cpp | 25 ++++++++++++------------- modules/demux/mkv/mkv.cpp | 14 +++++++++----- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/modules/demux/mkv/demux.cpp b/modules/demux/mkv/demux.cpp index 87ae968..8b60a7d 100644 --- a/modules/demux/mkv/demux.cpp +++ b/modules/demux/mkv/demux.cpp @@ -653,18 +653,19 @@ bool demux_sys_t::PreloadLinked() p_seg = used_segments[i]; if ( p_seg->Editions() != NULL ) { - input_title_t *p_title = vlc_input_title_New(); - p_seg->i_sys_title = i; - int i_chapters; - - // TODO use a name for each edition, let the TITLE deal with a codec name for ( j=0; j<p_seg->Editions()->size(); j++ ) { + input_title_t *p_title = vlc_input_title_New(); + int i_chapters; + + // TODO use a name for each edition, let the TITLE deal with a codec name if ( p_title->psz_name == NULL ) { const char* psz_tmp = (*p_seg->Editions())[j]->GetMainName().c_str(); if( *psz_tmp != '\0' ) p_title->psz_name = strdup( psz_tmp ); + else if( asprintf(&(p_title->psz_name), "%s %d", N_("Segment"), (int)i) == -1 ) + p_title->psz_name = NULL; } i_chapters = 0; @@ -672,17 +673,11 @@ bool demux_sys_t::PreloadLinked() // Input duration into i_length p_title->i_length = ( *p_seg->Editions() )[j]->i_duration; - } - // create a name if there is none - if ( p_title->psz_name == NULL ) - { - if( asprintf(&(p_title->psz_name), "%s %d", N_("Segment"), (int)i) == -1 ) - p_title->psz_name = NULL; + titles.push_back( p_title ); } - - titles.push_back( p_title ); } + p_seg->i_sys_title = p_seg->i_current_edition; } // TODO decide which segment should be first used (VMG for DVD) @@ -719,6 +714,10 @@ bool demux_sys_t::PreparePlayback( virtual_segment_c *p_new_segment ) p_current_segment->CurrentSegment()->InformationCreate( ); p_current_segment->CurrentSegment()->Select( 0 ); + /* Seek to the beginning */ + p_current_segment->Seek(p_current_segment->CurrentSegment()->sys.demuxer, + 0, 0, NULL, -1); + return true; } diff --git a/modules/demux/mkv/mkv.cpp b/modules/demux/mkv/mkv.cpp index 90736e2..ba9b835 100644 --- a/modules/demux/mkv/mkv.cpp +++ b/modules/demux/mkv/mkv.cpp @@ -355,19 +355,23 @@ static int Control( demux_t *p_demux, int i_query, va_list args ) *ppp_title = (input_title_t**)malloc( sizeof( input_title_t**) * p_sys->titles.size() ); for( size_t i = 0; i < p_sys->titles.size(); i++ ) - { (*ppp_title)[i] = vlc_input_title_Duplicate( p_sys->titles[i] ); - } return VLC_SUCCESS; } return VLC_EGENERIC; case DEMUX_SET_TITLE: - /* TODO handle editions as titles */ + /* handle editions as titles */ i_idx = (int)va_arg( args, int ); - if( i_idx < p_sys->used_segments.size() ) + if(i_idx < p_sys->titles.size() && p_sys->titles[i_idx]->i_seekpoint) { - p_sys->JumpTo( *p_sys->used_segments[i_idx], NULL ); + p_sys->p_current_segment->i_current_edition = i_idx; + p_sys->i_current_title = i_idx; + p_sys->p_current_segment->p_current_chapter = p_sys->p_current_segment->editions[p_sys->p_current_segment->i_current_edition]->getChapterbyTimecode(0); + + Seek( p_demux, (int64_t)p_sys->titles[i_idx]->seekpoint[0]->i_time_offset, -1, NULL); + p_demux->info.i_seekpoint |= INPUT_UPDATE_SEEKPOINT; + p_demux->info.i_seekpoint = 0; return VLC_SUCCESS; } return VLC_EGENERIC; _______________________________________________ vlc-commits mailing list [email protected] http://mailman.videolan.org/listinfo/vlc-commits
