[vlc-devel] [PATCH 05/11] demux:mkv: store the seekable states on startup

Steve Lhomme robux4 at ycbcr.xyz
Tue Jan 2 16:38:12 CET 2018


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

diff --git a/modules/demux/mkv/demux.hpp b/modules/demux/mkv/demux.hpp
index f5b0b0d9db..bb90912dcb 100644
--- a/modules/demux/mkv/demux.hpp
+++ b/modules/demux/mkv/demux.hpp
@@ -350,6 +350,8 @@ public:
 
     /* current data */
     demux_t                 & demuxer;
+    bool                    b_seekable;
+    bool                    b_fastseekable;
 
     mtime_t                 i_pts;
     mtime_t                 i_pcr;
diff --git a/modules/demux/mkv/matroska_segment.cpp b/modules/demux/mkv/matroska_segment.cpp
index bd7cc3202c..681a166936 100644
--- a/modules/demux/mkv/matroska_segment.cpp
+++ b/modules/demux/mkv/matroska_segment.cpp
@@ -1002,10 +1002,7 @@ void matroska_segment_c::EnsureDuration()
 
     i_duration = -1;
 
-    bool b_seekable;
-
-    if( vlc_stream_Control( sys.demuxer.s, STREAM_CAN_FASTSEEK, &b_seekable ) ||
-        !b_seekable )
+    if( !sys.b_fastseekable )
     {
         msg_Warn( &sys.demuxer, "could not look for the segment duration" );
         return;
diff --git a/modules/demux/mkv/matroska_segment_parse.cpp b/modules/demux/mkv/matroska_segment_parse.cpp
index aba61b06d5..0b7967d48b 100644
--- a/modules/demux/mkv/matroska_segment_parse.cpp
+++ b/modules/demux/mkv/matroska_segment_parse.cpp
@@ -86,12 +86,10 @@ static inline char * ToUTF8( const UTFstring &u )
 void matroska_segment_c::ParseSeekHead( KaxSeekHead *seekhead )
 {
     EbmlElement *l;
-    bool b_seekable;
 
     i_seekhead_count++;
 
-    vlc_stream_Control( sys.demuxer.s, STREAM_CAN_SEEK, &b_seekable );
-    if( !b_seekable )
+    if( !sys.b_seekable )
         return;
 
     EbmlParser eparser ( &es, seekhead, &sys.demuxer,
diff --git a/modules/demux/mkv/mkv.cpp b/modules/demux/mkv/mkv.cpp
index 577bd683b2..69a4454e14 100644
--- a/modules/demux/mkv/mkv.cpp
+++ b/modules/demux/mkv/mkv.cpp
@@ -112,6 +112,10 @@ static int Open( vlc_object_t * p_this )
     p_demux->pf_control = Control;
     p_demux->p_sys      = p_sys = new demux_sys_t( *p_demux );
 
+    vlc_stream_Control( p_demux->s, STREAM_CAN_SEEK, &p_sys->b_seekable );
+    if ( vlc_stream_Control( p_demux->s, STREAM_CAN_FASTSEEK, &p_sys->b_fastseekable ) )
+        p_sys->b_fastseekable = false;
+
     p_io_callback = new vlc_stream_io_callback( p_demux->s, false );
     p_io_stream = new (std::nothrow) EbmlStream( *p_io_callback );
 
-- 
2.14.2



More information about the vlc-devel mailing list