[vlc-devel] [PATCH] do not read the whole Cluster data when seeking

Steve Lhomme robux4 at gmail.com
Fri Feb 20 14:39:35 CET 2015


Looks like Thunderbird is reformating the text coming from git... Here is
the right patch code.

---
 modules/demux/mkv/matroska_segment.cpp       | 4 ++--
 modules/demux/mkv/matroska_segment.hpp       | 2 +-
 modules/demux/mkv/matroska_segment_parse.cpp | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/modules/demux/mkv/matroska_segment.cpp
b/modules/demux/mkv/matroska_segment.cpp
index 904a12f..76459c9 100644
--- a/modules/demux/mkv/matroska_segment.cpp
+++ b/modules/demux/mkv/matroska_segment.cpp
@@ -706,7 +706,7 @@ bool matroska_segment_c::Preload( )
             cluster = (KaxCluster*)el;

             i_cluster_pos = i_start_pos = cluster->GetElementPosition();
-            ParseCluster( );
+            ParseCluster( cluster );

             ep->Down();
             /* stop pre-parsing the stream */
@@ -887,7 +887,7 @@ void matroska_segment_c::Seek( mtime_t i_date, mtime_t
i_time_offset, int64_t i_
                     ( i_index > 0 &&
                       p_indexes[i_index - 1].i_position <
(int64_t)cluster->GetElementPosition() ) )
                 {
-                    ParseCluster(false);
+                    ParseCluster( cluster, false, SCOPE_NO_DATA );
                     IndexAppendCluster( cluster );
                 }
                 if( es.I_O().getFilePointer() >= (unsigned)
i_global_position )
diff --git a/modules/demux/mkv/matroska_segment.hpp
b/modules/demux/mkv/matroska_segment.hpp
index 9245c58..3ef8e37 100644
--- a/modules/demux/mkv/matroska_segment.hpp
+++ b/modules/demux/mkv/matroska_segment.hpp
@@ -158,7 +158,7 @@ private:
     void ParseTracks( KaxTracks *tracks );
     void ParseChapterAtom( int i_level, KaxChapterAtom *ca, chapter_item_c
& chapters );
     void ParseTrackEntry( KaxTrackEntry *m );
-    void ParseCluster( bool b_update_start_time = true );
+    void ParseCluster( KaxCluster *cluster, bool b_update_start_time =
true, ScopeMode read_fully = SCOPE_ALL_DATA );
     SimpleTag * ParseSimpleTags( KaxTagSimple *tag, int level = 50 );
     void IndexAppendCluster( KaxCluster *cluster );
     int32_t TrackInit( mkv_track_t * p_tk );
diff --git a/modules/demux/mkv/matroska_segment_parse.cpp
b/modules/demux/mkv/matroska_segment_parse.cpp
index d4a065c..751c824 100644
--- a/modules/demux/mkv/matroska_segment_parse.cpp
+++ b/modules/demux/mkv/matroska_segment_parse.cpp
@@ -1237,7 +1237,7 @@ void matroska_segment_c::ParseChapters( KaxChapters
*chapters )
     }
 }

-void matroska_segment_c::ParseCluster( bool b_update_start_time )
+void matroska_segment_c::ParseCluster( KaxCluster *cluster, bool
b_update_start_time, ScopeMode read_fully )
 {
     EbmlElement *el;
     EbmlMaster  *m;
@@ -1252,7 +1252,7 @@ void matroska_segment_c::ParseCluster( bool
b_update_start_time )
     }
     try
     {
-        m->Read( es, EBML_CONTEXT(cluster), i_upper_level, el, true );
+        m->Read( es, EBML_CONTEXT(cluster), i_upper_level, el, true,
read_fully );
     }
     catch(...)
     {
-- 
1.9.5.msysgit.0



On Fri, Feb 20, 2015 at 2:36 PM, Steve Lhomme <robux4 at gmail.com> wrote:

> Also pass the cluster to parse, because I will need this interface change
> for an upcoming patch.
>
> ---
> modules/demux/mkv/matroska_segment.cpp | 4 ++--
> modules/demux/mkv/matroska_segment.hpp | 2 +-
> modules/demux/mkv/matroska_segment_parse.cpp | 4 ++--
> 3 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/modules/demux/mkv/matroska_segment.cpp
> b/modules/demux/mkv/matroska_segment.cpp
> index 904a12f..76459c9 100644
> --- a/modules/demux/mkv/matroska_segment.cpp
> +++ b/modules/demux/mkv/matroska_segment.cpp
> @@ -706,7 +706,7 @@ bool matroska_segment_c::Preload( )
> cluster = (KaxCluster*)el;
>
> i_cluster_pos = i_start_pos = cluster->GetElementPosition();
> - ParseCluster( );
> + ParseCluster( cluster );
>
> ep->Down();
> /* stop pre-parsing the stream */
> @@ -887,7 +887,7 @@ void matroska_segment_c::Seek( mtime_t i_date, mtime_t
> i_time_offset, int64_t i_
> ( i_index > 0 &&
> p_indexes[i_index - 1].i_position < (int64_t)cluster->GetElementPosition()
> ) )
> {
> - ParseCluster(false);
> + ParseCluster( cluster, false, SCOPE_NO_DATA );
> IndexAppendCluster( cluster );
> }
> if( es.I_O().getFilePointer() >= (unsigned) i_global_position )
> diff --git a/modules/demux/mkv/matroska_segment.hpp
> b/modules/demux/mkv/matroska_segment.hpp
> index 9245c58..3ef8e37 100644
> --- a/modules/demux/mkv/matroska_segment.hpp
> +++ b/modules/demux/mkv/matroska_segment.hpp
> @@ -158,7 +158,7 @@ private:
> void ParseTracks( KaxTracks *tracks );
> void ParseChapterAtom( int i_level, KaxChapterAtom *ca, chapter_item_c &
> chapters );
> void ParseTrackEntry( KaxTrackEntry *m );
> - void ParseCluster( bool b_update_start_time = true );
> + void ParseCluster( KaxCluster *cluster, bool b_update_start_time = true,
> ScopeMode read_fully = SCOPE_ALL_DATA );
> SimpleTag * ParseSimpleTags( KaxTagSimple *tag, int level = 50 );
> void IndexAppendCluster( KaxCluster *cluster );
> int32_t TrackInit( mkv_track_t * p_tk );
> diff --git a/modules/demux/mkv/matroska_segment_parse.cpp
> b/modules/demux/mkv/matroska_segment_parse.cpp
> index d4a065c..751c824 100644
> --- a/modules/demux/mkv/matroska_segment_parse.cpp
> +++ b/modules/demux/mkv/matroska_segment_parse.cpp
> @@ -1237,7 +1237,7 @@ void matroska_segment_c::ParseChapters( KaxChapters
> *chapters )
> }
> }
>
> -void matroska_segment_c::ParseCluster( bool b_update_start_time )
> +void matroska_segment_c::ParseCluster( KaxCluster *cluster, bool
> b_update_start_time, ScopeMode read_fully )
> {
> EbmlElement *el;
> EbmlMaster *m;
> @@ -1252,7 +1252,7 @@ void matroska_segment_c::ParseCluster( bool
> b_update_start_time )
> }
> try
> {
> - m->Read( es, EBML_CONTEXT(cluster), i_upper_level, el, true );
> + m->Read( es, EBML_CONTEXT(cluster), i_upper_level, el, true, read_fully
> );
> }
> catch(...)
> {
> --
> 1.9.5.msysgit.0
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20150220/5eef6d6c/attachment.html>


More information about the vlc-devel mailing list