[vlc-devel] [PATCH 17/34] mkv: renamed matroska_segment_c::{Select, UnSelect}

Filip Roséen filip at videolabs.io
Fri May 6 19:08:56 CEST 2016


matroska_segment_c::Select and matroska_segment_c::Unselect are used to
create/destroy ESs, with that said they are better named ESCreate and
ESDestroy.

Given their name and functionality there is no need (or reason) to send
ES_OUT_SET_NEXT_DISPLAY_TIME from the creator, nor is it necessary to
jump to some particular file-offset (since this is handled by a call to
code that invokes seek in the relevant places).
---
 modules/demux/mkv/demux.cpp            |  5 +++--
 modules/demux/mkv/matroska_segment.cpp | 11 ++---------
 modules/demux/mkv/matroska_segment.hpp |  4 ++--
 modules/demux/mkv/mkv.cpp              |  2 +-
 modules/demux/mkv/virtual_segment.cpp  |  2 +-
 5 files changed, 9 insertions(+), 15 deletions(-)

diff --git a/modules/demux/mkv/demux.cpp b/modules/demux/mkv/demux.cpp
index 78ebd61..aeb707c 100644
--- a/modules/demux/mkv/demux.cpp
+++ b/modules/demux/mkv/demux.cpp
@@ -781,9 +781,10 @@ bool demux_sys_t::PreparePlayback( virtual_segment_c & new_vsegment, mtime_t i_m
     if ( p_current_vsegment != &new_vsegment )
     {
         if ( p_current_vsegment->CurrentSegment() != NULL )
-            p_current_vsegment->CurrentSegment()->UnSelect();
+            p_current_vsegment->CurrentSegment()->ESDestroy();
 
         p_current_vsegment = &new_vsegment;
+        p_current_vsegment->CurrentSegment()->ESCreate();
         i_current_title = p_current_vsegment->i_sys_title;
     }
     if( !p_current_vsegment->CurrentSegment() )
@@ -795,7 +796,7 @@ bool demux_sys_t::PreparePlayback( virtual_segment_c & new_vsegment, mtime_t i_m
 
     /* add information */
     p_current_vsegment->CurrentSegment()->InformationCreate( );
-    p_current_vsegment->CurrentSegment()->Select( i_mk_date );
+    p_current_vsegment->CurrentSegment()->ESCreate( );
 
     /* Seek to the beginning */
     p_current_vsegment->Seek(p_current_vsegment->CurrentSegment()->sys.demuxer,
diff --git a/modules/demux/mkv/matroska_segment.cpp b/modules/demux/mkv/matroska_segment.cpp
index 97ac1c0..dbcdf65 100644
--- a/modules/demux/mkv/matroska_segment.cpp
+++ b/modules/demux/mkv/matroska_segment.cpp
@@ -1151,7 +1151,7 @@ void matroska_segment_c::EnsureDuration()
     es.I_O().setFilePointer( i_current_position, seek_beginning );
 }
 
-bool matroska_segment_c::Select( mtime_t i_mk_start_time )
+bool matroska_segment_c::ESCreate()
 {
     /* add all es */
     msg_Dbg( &sys.demuxer, "found %d es", static_cast<int>( tracks.size() ) );
@@ -1181,18 +1181,11 @@ bool matroska_segment_c::Select( mtime_t i_mk_start_time )
             es_out_Control( sys.demuxer.out, ES_OUT_SET_ES_DEFAULT, track.p_es );
         }
     }
-    es_out_Control( sys.demuxer.out, ES_OUT_SET_NEXT_DISPLAY_TIME, i_mk_start_time );
-
-    sys.i_start_pts = i_mk_start_time + VLC_TS_0;
-    // reset the stream reading to the first cluster of the segment used
-    es.I_O().setFilePointer( i_start_pos );
-
-    ep->reconstruct( &es, segment, &sys.demuxer );
 
     return true;
 }
 
-void matroska_segment_c::UnSelect( )
+void matroska_segment_c::ESDestroy( )
 {
     sys.p_ev->ResetPci();
 
diff --git a/modules/demux/mkv/matroska_segment.hpp b/modules/demux/mkv/matroska_segment.hpp
index b312a0d..14498b7 100644
--- a/modules/demux/mkv/matroska_segment.hpp
+++ b/modules/demux/mkv/matroska_segment.hpp
@@ -140,10 +140,10 @@ public:
     int BlockFindTrackIndex( size_t *pi_track,
                              const KaxBlock *, const KaxSimpleBlock * );
 
-    bool Select( mtime_t i_mk_start_time );
-    void UnSelect();
 
 
+    bool ESCreate( );
+    void ESDestroy( );
 
     static bool CompareSegmentUIDs( const matroska_segment_c * item_a, const matroska_segment_c * item_b );
 
diff --git a/modules/demux/mkv/mkv.cpp b/modules/demux/mkv/mkv.cpp
index 7323b42..ad90cc6 100644
--- a/modules/demux/mkv/mkv.cpp
+++ b/modules/demux/mkv/mkv.cpp
@@ -282,7 +282,7 @@ static void Close( vlc_object_t *p_this )
     {
         matroska_segment_c *p_segment = p_vsegment->CurrentSegment();
         if( p_segment )
-            p_segment->UnSelect();
+            p_segment->ESDestroy();
     }
 
     delete p_sys;
diff --git a/modules/demux/mkv/virtual_segment.cpp b/modules/demux/mkv/virtual_segment.cpp
index 6b2138c..f655333 100644
--- a/modules/demux/mkv/virtual_segment.cpp
+++ b/modules/demux/mkv/virtual_segment.cpp
@@ -535,7 +535,7 @@ void virtual_segment_c::Seek( demux_t & demuxer, mtime_t i_mk_date,
             if ( p_current_vchapter )
             {
                 KeepTrackSelection( p_current_vchapter->segment, p_vchapter->segment );
-                p_current_vchapter->segment.UnSelect();
+                p_current_vchapter->segment.ESDestroy();
             }
             msg_Dbg( &demuxer, "SWITCH CHAPTER uid=%" PRId64, p_vchapter->p_chapter ? p_vchapter->p_chapter->i_uid : 0 );
             p_current_vchapter = p_vchapter;
-- 
2.8.2



More information about the vlc-devel mailing list