[vlc-devel] [PATCH 1/7] demux:mkv: fix missing Enter() on the first chapter used

Steve Lhomme robux4 at videolabs.io
Tue Mar 15 08:50:19 CET 2016


---
 modules/demux/mkv/virtual_segment.cpp | 10 ++++++++++
 modules/demux/mkv/virtual_segment.hpp |  1 +
 2 files changed, 11 insertions(+)

diff --git a/modules/demux/mkv/virtual_segment.cpp b/modules/demux/mkv/virtual_segment.cpp
index fa72a10..e6973d3 100644
--- a/modules/demux/mkv/virtual_segment.cpp
+++ b/modules/demux/mkv/virtual_segment.cpp
@@ -267,6 +267,7 @@ virtual_segment_c::virtual_segment_c( std::vector<matroska_segment_c*> * p_opene
     i_current_edition = 0;
     i_sys_title = 0;
     p_current_chapter = NULL;
+    b_current_chapter_entered = false;
 
     i_current_edition = p_segment->i_default_edition;
 
@@ -410,6 +411,12 @@ bool virtual_segment_c::UpdateCurrentToChapter( demux_t & demux )
 
     bool b_has_seeked = false;
 
+    if ( !b_current_chapter_entered && p_current_chapter != NULL )
+    {
+        p_current_chapter->Enter( true );
+        b_current_chapter_entered = true;
+    }
+
     if ( sys.i_pts != VLC_TS_INVALID )
         p_cur_chapter = p_cur_edition->getChapterbyTimecode( sys.i_pts - VLC_TS_0 );
 
@@ -455,7 +462,10 @@ bool virtual_segment_c::UpdateCurrentToChapter( demux_t & demux )
             {
                 /* TODO */
                 if ( !p_cur_edition->p_edition->EnterAndLeave( p_current_chapter->p_chapter, false ) )
+                {
                     p_current_chapter = NULL;
+                    b_current_chapter_entered = false;
+                }
                 else
                     return true;
             }
diff --git a/modules/demux/mkv/virtual_segment.hpp b/modules/demux/mkv/virtual_segment.hpp
index c192b22..4d5b942 100644
--- a/modules/demux/mkv/virtual_segment.hpp
+++ b/modules/demux/mkv/virtual_segment.hpp
@@ -116,6 +116,7 @@ public:
     std::vector<virtual_edition_c*> editions;
     std::vector<virtual_edition_c*>::size_type i_current_edition;
     virtual_chapter_c               *p_current_chapter;
+    bool                            b_current_chapter_entered;
     int                             i_sys_title;
 
 
-- 
2.7.2.windows.1



More information about the vlc-devel mailing list