[vlc-commits] packetizer: hevc: move NAL unit values to header

Francois Cartegnie git at videolan.org
Tue Dec 8 17:31:45 CET 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Dec  8 11:36:07 2015 +0100| [2fc89606d172b57e9296a0b99316fc0cef1c2820] | committer: Francois Cartegnie

packetizer: hevc: move NAL unit values to header

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

 modules/packetizer/Makefile.am |    3 ++-
 modules/packetizer/hevc.c      |   38 ++------------------------------------
 modules/packetizer/hevc_nal.h  |   35 +++++++++++++++++++++++++++++++++++
 3 files changed, 39 insertions(+), 37 deletions(-)

diff --git a/modules/packetizer/Makefile.am b/modules/packetizer/Makefile.am
index b6bf074..8b911b6 100644
--- a/modules/packetizer/Makefile.am
+++ b/modules/packetizer/Makefile.am
@@ -11,7 +11,8 @@ libpacketizer_vc1_plugin_la_SOURCES = packetizer/vc1.c
 libpacketizer_mlp_plugin_la_SOURCES = packetizer/mlp.c
 libpacketizer_dirac_plugin_la_SOURCES = packetizer/dirac.c
 libpacketizer_flac_plugin_la_SOURCES = packetizer/flac.c
-libpacketizer_hevc_plugin_la_SOURCES = packetizer/hevc.c
+libpacketizer_hevc_plugin_la_SOURCES = packetizer/hevc.c \
+        packetizer/hevc_nal.h
 
 libpacketizer_avparser_plugin_la_SOURCES = packetizer/avparser.c \
 	packetizer/avparser.h \
diff --git a/modules/packetizer/hevc.c b/modules/packetizer/hevc.c
index 9c65da0..a7079c5 100644
--- a/modules/packetizer/hevc.c
+++ b/modules/packetizer/hevc.c
@@ -37,6 +37,7 @@
 #include <vlc_bits.h>
 #include <vlc_block_helper.h>
 #include "packetizer_helper.h"
+#include "hevc_nal.h"
 
 /*****************************************************************************
  * Module descriptor
@@ -72,41 +73,6 @@ struct decoder_sys_t
 
 };
 
-/* NAL types from https://www.itu.int/rec/dologin_pub.asp?lang=e&id=T-REC-H.265-201304-I!!PDF-E&type=items */
-enum nal_unit_type_e
-{
-    TRAIL_N    = 0,
-    TRAIL_R    = 1,
-    TSA_N      = 2,
-    TSA_R      = 3,
-    STSA_N     = 4,
-    STSA_R     = 5,
-    RADL_N     = 6,
-    RADL_R     = 7,
-    RASL_N     = 8,
-    RASL_R     = 9,
-    /* 10 to 15 reserved */
-    /* Key frames */
-    BLA_W_LP   = 16,
-    BLA_W_RADL = 17,
-    BLA_N_LP   = 18,
-    IDR_W_RADL = 19,
-    IDR_N_LP   = 20,
-    CRA        = 21,
-    /* 22 to 31 reserved */
-    /* Non VCL NAL*/
-    VPS        = 32,
-    SPS        = 33,
-    PPS        = 34,
-    AUD        = 35, /* Access unit delimiter */
-    EOS        = 36, /* End of sequence */
-    EOB        = 37, /* End of bitstream */
-    FD         = 38, /* Filler data*/
-    PREF_SEI   = 39, /* Prefix SEI */
-    SUFF_SEI   = 40, /* Suffix SEI */
-    UNKNOWN_NAL
-};
-
 static const uint8_t p_hevc_startcode[3] = {0x00, 0x00, 0x01};
 
 /*****************************************************************************
@@ -209,7 +175,7 @@ static block_t *PacketizeParse(void *p_private, bool *pb_ts_used, block_t *p_blo
     uint32_t nalu_type = bs_read(&bs,6);
     bs_skip(&bs, 9);
 
-    if (nalu_type < VPS)
+    if (nalu_type < HEVC_NAL_VPS)
     {
         /* NAL is a VCL NAL */
         p_sys->b_vcl = true;
diff --git a/modules/packetizer/hevc_nal.h b/modules/packetizer/hevc_nal.h
index 3203530..a4d80c6 100644
--- a/modules/packetizer/hevc_nal.h
+++ b/modules/packetizer/hevc_nal.h
@@ -28,6 +28,41 @@
 # include <vlc_common.h>
 # include <vlc_codec.h>
 
+/* NAL types from https://www.itu.int/rec/dologin_pub.asp?lang=e&id=T-REC-H.265-201304-I!!PDF-E&type=items */
+enum hevc_nal_unit_type_e
+{
+    HEVC_NAL_TRAIL_N    = 0,
+    HEVC_NAL_TRAIL_R    = 1,
+    HEVC_NAL_TSA_N      = 2,
+    HEVC_NAL_TSA_R      = 3,
+    HEVC_NAL_STSA_N     = 4,
+    HEVC_NAL_STSA_R     = 5,
+    HEVC_NAL_RADL_N     = 6,
+    HEVC_NAL_RADL_R     = 7,
+    HEVC_NAL_RASL_N     = 8,
+    HEVC_NAL_RASL_R     = 9,
+    /* 10 to 15 reserved */
+    /* Key frames */
+    HEVC_NAL_BLA_W_LP   = 16,
+    HEVC_NAL_BLA_W_RADL = 17,
+    HEVC_NAL_BLA_N_LP   = 18,
+    HEVC_NAL_IDR_W_RADL = 19,
+    HEVC_NAL_IDR_N_LP   = 20,
+    HEVC_NAL_CRA        = 21,
+    /* 22 to 31 reserved */
+    /* Non VCL NAL*/
+    HEVC_NAL_VPS        = 32,
+    HEVC_NAL_SPS        = 33,
+    HEVC_NAL_PPS        = 34,
+    HEVC_NAL_AUD        = 35, /* Access unit delimiter */
+    HEVC_NAL_EOS        = 36, /* End of sequence */
+    HEVC_NAL_EOB        = 37, /* End of bitstream */
+    HEVC_NAL_FD         = 38, /* Filler data*/
+    HEVC_NAL_PREF_SEI   = 39, /* Prefix SEI */
+    HEVC_NAL_SUFF_SEI   = 40, /* Suffix SEI */
+    HEVC_NAL_UNKNOWN
+};
+
 /* Parse the hvcC Metadata and convert it to annex b format */
 int convert_hevc_nal_units( decoder_t *p_dec, const uint8_t *p_buf,
                             uint32_t i_buf_size, uint8_t *p_out_buf,



More information about the vlc-commits mailing list