[vlc-commits] [Git][videolan/vlc][master] demux: avi: add tag index keyframe for H26x

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri Nov 4 08:44:59 UTC 2022



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
284e3f6a by Francois Cartegnie at 2022-11-04T08:22:03+00:00
demux: avi: add tag index keyframe for H26x

- - - - -


1 changed file:

- modules/demux/avi/avi.c


Changes:

=====================================
modules/demux/avi/avi.c
=====================================
@@ -46,6 +46,8 @@
 #include "libavi.h"
 #include "../rawdv.h"
 #include "bitmapinfoheader.h"
+#include "../packetizer/h264_nal.h"
+#include "../packetizer/hevc_nal.h"
 
 /*****************************************************************************
  * Module descriptor
@@ -2127,6 +2129,33 @@ static int AVI_GetKeyFlag( const avi_track_t *tk, const uint8_t *p_byte )
             }
             return p_byte[4] & 0xC0 ? 0 : AVIIF_KEYFRAME;
 
+        case VLC_CODEC_H264:
+        {
+            uint32_t bytes = GetDWBE( p_byte );
+            enum h264_nal_unit_type_e i_nal_type;
+            if( bytes == 0x00000001 )
+                i_nal_type = h264_getNALType( &p_byte[4] );
+            else if( (bytes & 0xFFFFFF00) == 0x00000100 )
+                i_nal_type = h264_getNALType( &p_byte[3] );
+            else
+                return i_nal_type = 0;
+            return (i_nal_type == H264_NAL_SLICE_IDR) ? AVIIF_KEYFRAME : 0;
+        }
+
+        case VLC_CODEC_HEVC:
+        {
+            uint32_t bytes = GetDWBE( p_byte );
+            uint8_t i_nal_type;
+            if( bytes == 0x00000001 )
+                i_nal_type = hevc_getNALType( &p_byte[4] );
+            else if( (bytes & 0xFFFFFF00) == 0x00000100 )
+                i_nal_type = hevc_getNALType( &p_byte[3] );
+            else
+                i_nal_type = 0;
+            return (i_nal_type >= HEVC_NAL_IDR_W_RADL &&
+                    i_nal_type <= HEVC_NAL_CRA) ? AVIIF_KEYFRAME : 0;
+        }
+
         default:
             /* I can't do it, so say yes */
             return AVIIF_KEYFRAME;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/284e3f6a8eb3e4cc358641283a68a13c942c1d36

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/284e3f6a8eb3e4cc358641283a68a13c942c1d36
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list