[vlc-commits] packetizer: hevc: add get_profile_level

Francois Cartegnie git at videolan.org
Tue Jul 12 10:19:39 CEST 2016


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Jul 12 10:16:53 2016 +0200| [d086f97d5418cd0f5a2bc339480d1008b7e59537] | committer: Francois Cartegnie

packetizer: hevc: add get_profile_level

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

 modules/packetizer/hevc_nal.c |   20 ++++++++++++++++++++
 modules/packetizer/hevc_nal.h |    4 ++++
 2 files changed, 24 insertions(+)

diff --git a/modules/packetizer/hevc_nal.c b/modules/packetizer/hevc_nal.c
index 8be77d9..7f89b6c 100644
--- a/modules/packetizer/hevc_nal.c
+++ b/modules/packetizer/hevc_nal.c
@@ -1173,3 +1173,23 @@ bool hevc_get_slice_type( const hevc_slice_segment_header_t *p_sli, enum hevc_sl
     }
     return false;
 }
+
+bool hevc_get_profile_level(const es_format_t *p_fmt, uint8_t *pi_profile,
+                            uint8_t *pi_level, uint8_t *pi_nal_length_size)
+{
+    const uint8_t *p = (const uint8_t*)p_fmt->p_extra;
+    if(p_fmt->i_extra < 23 || p[0] != 1)
+        return false;
+
+    /* HEVCDecoderConfigurationRecord */
+    if(pi_profile)
+        *pi_profile = p[1] & 0x1F;
+
+    if(pi_level)
+        *pi_level = p[12];
+
+    if (pi_nal_length_size)
+        *pi_nal_length_size = 1 + (p[21]&0x03);
+
+    return true;
+}
diff --git a/modules/packetizer/hevc_nal.h b/modules/packetizer/hevc_nal.h
index 2dca630..c8f1fbe 100644
--- a/modules/packetizer/hevc_nal.h
+++ b/modules/packetizer/hevc_nal.h
@@ -182,4 +182,8 @@ bool hevc_get_colorimetry( const hevc_sequence_parameter_set_t *p_sps,
                            bool *p_full_range );
 bool hevc_get_slice_type( const hevc_slice_segment_header_t *, enum hevc_slice_type_e * );
 
+/* Get level and Profile from DecoderConfigurationRecord */
+bool hevc_get_profile_level(const es_format_t *p_fmt, uint8_t *pi_profile,
+                            uint8_t *pi_level, uint8_t *pi_nal_length_size);
+
 #endif /* HEVC_NAL_H */



More information about the vlc-commits mailing list