[vlc-commits] demux: avi: remove header from QNAP codecs

Francois Cartegnie git at videolan.org
Mon Jul 8 16:32:56 CEST 2019


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Jul  8 15:38:48 2019 +0200| [62d9193dcd958445a9fa4ef1049a046e4c7b02f6] | committer: Francois Cartegnie

demux: avi: remove header from QNAP codecs

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=62d9193dcd958445a9fa4ef1049a046e4c7b02f6
---

 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 2dfe4f4ff5..373793c6f1 100644
--- a/modules/demux/avi/avi.c
+++ b/modules/demux/avi/avi.c
@@ -243,6 +243,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
  *****************************************************************************/
@@ -898,6 +918,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