[vlc-devel] [PATCH] demux:mkv: make sure b_(fast)seekable is always set and const
Steve Lhomme
robux4 at ycbcr.xyz
Fri Jan 5 09:10:28 CET 2018
CID #1463444
---
modules/demux/mkv/demux.hpp | 14 ++++++++++++--
modules/demux/mkv/mkv.cpp | 4 ----
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/modules/demux/mkv/demux.hpp b/modules/demux/mkv/demux.hpp
index bb90912dcb..905781df92 100644
--- a/modules/demux/mkv/demux.hpp
+++ b/modules/demux/mkv/demux.hpp
@@ -331,6 +331,8 @@ struct demux_sys_t
public:
demux_sys_t( demux_t & demux )
:demuxer(demux)
+ ,b_seekable(CanSeekMode( demux, STREAM_CAN_SEEK ))
+ ,b_fastseekable(CanSeekMode( demux, STREAM_CAN_FASTSEEK ))
,i_pts(VLC_TS_INVALID)
,i_pcr(VLC_TS_INVALID)
,i_start_pts(VLC_TS_0)
@@ -350,8 +352,8 @@ public:
/* current data */
demux_t & demuxer;
- bool b_seekable;
- bool b_fastseekable;
+ const bool b_seekable;
+ const bool b_fastseekable;
mtime_t i_pts;
mtime_t i_pcr;
@@ -399,6 +401,14 @@ public:
/* event */
event_thread_t *p_ev;
+
+private:
+ static bool CanSeekMode(demux_t & demux, enum stream_query_e mode)
+ {
+ bool b_seekable;
+ vlc_stream_Control( demux.s, mode, &b_seekable );
+ return b_seekable;
+ }
};
diff --git a/modules/demux/mkv/mkv.cpp b/modules/demux/mkv/mkv.cpp
index 69a4454e14..577bd683b2 100644
--- a/modules/demux/mkv/mkv.cpp
+++ b/modules/demux/mkv/mkv.cpp
@@ -112,10 +112,6 @@ 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