[vlc-devel] [PATCH] demux:mkv: make sure b_(fast)seekable is always set and const
Tristan Matthews
tmatth at videolan.org
Fri Jan 5 18:35:39 CET 2018
Hi,
On Fri, Jan 5, 2018 at 3:51 AM, Steve Lhomme <robux4 at ycbcr.xyz> wrote:
>
> Also STREAM_CAN_FASTSEEK cannot fail
>
> Replaces https://patches.videolan.org/patch/19338/
> - rebased
> ---
> modules/demux/mkv/demux.hpp | 16 ++++++++++++----
> modules/demux/mkv/mkv.cpp | 4 ----
> 2 files changed, 12 insertions(+), 8 deletions(-)
>
> diff --git a/modules/demux/mkv/demux.hpp b/modules/demux/mkv/demux.hpp
> index f139a58854..3ae6df35af 100644
> --- a/modules/demux/mkv/demux.hpp
> +++ b/modules/demux/mkv/demux.hpp
> @@ -331,8 +331,8 @@ struct demux_sys_t
> public:
> demux_sys_t( demux_t & demux )
> :demuxer(demux)
> - ,b_seekable(false)
> - ,b_fastseekable(false)
> + ,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)
> @@ -353,8 +353,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;
> @@ -403,6 +403,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 99967c67aa..b813e99ece 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
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
LGTM.
Best,
-t
More information about the vlc-devel
mailing list