vlc | branch: master | Francois Cartegnie <[email protected]> | Wed Aug 8 12:26:04 2018 +0200| [5263fc9d720681ea361a313f0ef31017a5b9f183] | committer: Francois Cartegnie
demux: es: add support for RE4 CCTV recordings > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5263fc9d720681ea361a313f0ef31017a5b9f183 --- modules/demux/mpeg/es.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/modules/demux/mpeg/es.c b/modules/demux/mpeg/es.c index c1355aaa51..90980d9226 100644 --- a/modules/demux/mpeg/es.c +++ b/modules/demux/mpeg/es.c @@ -289,22 +289,25 @@ static int OpenVideo( vlc_object_t *p_this ) /* Only m4v is supported for the moment */ bool b_m4v_ext = demux_IsPathExtension( p_demux, ".m4v" ); + bool b_re4_ext = !b_m4v_ext && demux_IsPathExtension( p_demux, ".re4" ); bool b_m4v_forced = demux_IsForced( p_demux, "m4v" ) || demux_IsForced( p_demux, "mp4v" ); - if( !b_m4v_ext && !b_m4v_forced ) + + if( !b_m4v_ext && !b_m4v_forced && !b_re4_ext ) return VLC_EGENERIC; + ssize_t i_off = b_re4_ext ? 220 : 0; const uint8_t *p_peek; - if( vlc_stream_Peek( p_demux->s, &p_peek, 4 ) < 4 ) + if( vlc_stream_Peek( p_demux->s, &p_peek, i_off + 4 ) < i_off + 4 ) return VLC_EGENERIC; - if( p_peek[0] != 0x00 || p_peek[1] != 0x00 || p_peek[2] != 0x01 ) + if( p_peek[i_off + 0] != 0x00 || p_peek[i_off + 1] != 0x00 || p_peek[i_off + 2] != 0x01 ) { if( !b_m4v_forced) return VLC_EGENERIC; msg_Warn( p_demux, "this doesn't look like an MPEG ES stream, continuing anyway" ); } - return OpenCommon( p_demux, VIDEO_ES, &codec_m4v, 0 ); + return OpenCommon( p_demux, VIDEO_ES, &codec_m4v, i_off ); } /***************************************************************************** * Demux: reads and demuxes data packets _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
