[vlc-commits] demux: avi: remove header from QNAP codecs
Francois Cartegnie
git at videolan.org
Mon Jul 15 17:04:20 CEST 2019
vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Jul 8 15:38:48 2019 +0200| [813c3159de2d9ea3fc7df0e613e76533b4e74b49] | committer: Francois Cartegnie
demux: avi: remove header from QNAP codecs
(cherry picked from commit 62d9193dcd958445a9fa4ef1049a046e4c7b02f6)
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=813c3159de2d9ea3fc7df0e613e76533b4e74b49
---
modules/demux/avi/avi.c | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/modules/demux/avi/avi.c b/modules/demux/avi/avi.c
index e75105bbb5..5cbcd0ff8f 100644
--- a/modules/demux/avi/avi.c
+++ b/modules/demux/avi/avi.c
@@ -248,6 +248,26 @@ static int AVI_TrackStopFinishedStreams( demux_t *);
- to complete....
*/
+#define QNAP_HEADER_SIZE 56
+static bool IsQNAPCodec(vlc_fourcc_t codec)
+{
+ switch (codec)
+ {
+ case VLC_FOURCC('w', '2', '6', '4'):
+ case VLC_FOURCC('q', '2', '6', '4'):
+ case VLC_FOURCC('Q', '2', '6', '4'):
+ case VLC_FOURCC('w', 'M', 'P', '4'):
+ case VLC_FOURCC('q', 'M', 'P', '4'):
+ case VLC_FOURCC('Q', 'M', 'P', '4'):
+ case VLC_FOURCC('w', 'I', 'V', 'G'):
+ case VLC_FOURCC('q', 'I', 'V', 'G'):
+ case VLC_FOURCC('Q', 'I', 'V', 'G'):
+ return true;
+ default:
+ return false;
+ }
+}
+
/*****************************************************************************
* Close: frees unused data
*****************************************************************************/
@@ -1027,6 +1047,19 @@ static void AVI_SendFrame( demux_t *p_demux, avi_track_t *tk, block_t *p_frame )
if( tk->i_dv_audio_rate )
AVI_DvHandleAudio( p_demux, tk, p_frame );
+ /* Strip QNAP header */
+ if( IsQNAPCodec( tk->fmt.i_codec ) )
+ {
+ if( p_frame->i_buffer <= QNAP_HEADER_SIZE )
+ {
+ block_Release( p_frame );
+ return;
+ }
+
+ p_frame->i_buffer -= QNAP_HEADER_SIZE;
+ p_frame->p_buffer += QNAP_HEADER_SIZE;
+ }
+
if( tk->i_next_block_flags )
{
p_frame->i_flags = tk->i_next_block_flags;
More information about the vlc-commits
mailing list