[vlc-devel] [PATCH 08/14] mkv: replaced reallocation of EbmlParser with EbmlParser::reconstruct

Filip Roséen filip at videolabs.io
Wed Mar 9 12:50:03 CET 2016


---
 modules/demux/mkv/matroska_segment.cpp | 23 ++++++++---------------
 1 file changed, 8 insertions(+), 15 deletions(-)

diff --git a/modules/demux/mkv/matroska_segment.cpp b/modules/demux/mkv/matroska_segment.cpp
index c5d3db6..568e1f8 100644
--- a/modules/demux/mkv/matroska_segment.cpp
+++ b/modules/demux/mkv/matroska_segment.cpp
@@ -767,9 +767,8 @@ void matroska_segment_c::Seek( mtime_t i_mk_date, mtime_t i_mk_time_offset, int6
         else
             es.I_O().setFilePointer( prev_index().i_position,
                                      seek_beginning );
-        delete ep;
-        ep = new EbmlParser( &es, segment, &sys.demuxer,
-                             var_InheritBool( &sys.demuxer, "mkv-use-dummy" ) );
+
+        ep->reconstruct( &es, segment, &sys.demuxer );
         cluster = NULL;
 
         while( ( el = ep->Get() ) != NULL )
@@ -799,9 +798,8 @@ void matroska_segment_c::Seek( mtime_t i_mk_date, mtime_t i_mk_time_offset, int6
                         INT64_C(0) );
         es.I_O().setFilePointer( i_start_pos );
 
-        delete ep;
-        ep = new EbmlParser( &es, segment, &sys.demuxer,
-                             var_InheritBool( &sys.demuxer, "mkv-use-dummy" ) );
+        ep->reconstruct( &es, segment, &sys.demuxer );
+
         cluster = NULL;
         sys.i_start_pts = VLC_TS_0;
         sys.i_pcr = sys.i_pts = VLC_TS_INVALID;
@@ -839,9 +837,8 @@ void matroska_segment_c::Seek( mtime_t i_mk_date, mtime_t i_mk_time_offset, int6
 
     es.I_O().setFilePointer( i_seek_position, seek_beginning );
 
-    delete ep;
-    ep = new EbmlParser( &es, segment, &sys.demuxer,
-                         var_InheritBool( &sys.demuxer, "mkv-use-dummy" ) );
+    ep->reconstruct( &es, segment, &sys.demuxer );
+
     cluster = NULL;
 
     sys.i_start_pts = i_mk_date + VLC_TS_0;
@@ -935,9 +932,7 @@ void matroska_segment_c::Seek( mtime_t i_mk_date, mtime_t i_mk_time_offset, int6
         index_it--;
         i_mk_pts = 0;
         es.I_O().setFilePointer( index_it->i_position );
-        delete ep;
-        ep = new EbmlParser( &es, segment, &sys.demuxer,
-                             var_InheritBool( &sys.demuxer, "mkv-use-dummy" ) );
+        ep->reconstruct( &es, segment, &sys.demuxer );
         cluster = NULL;
     }
 
@@ -1178,9 +1173,7 @@ bool matroska_segment_c::Select( mtime_t i_mk_start_time )
     // reset the stream reading to the first cluster of the segment used
     es.I_O().setFilePointer( i_start_pos );
 
-    delete ep;
-    ep = new EbmlParser( &es, segment, &sys.demuxer,
-                         var_InheritBool( &sys.demuxer, "mkv-use-dummy" ) );
+    ep->reconstruct( &es, segment, &sys.demuxer );
 
     return true;
 }
-- 
2.7.2



More information about the vlc-devel mailing list