[vlc-commits] demux: packetizer: change nal length size to uint8

Francois Cartegnie git at videolan.org
Thu Dec 3 20:18:32 CET 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Dec  3 19:38:22 2015 +0100| [eec22355e4f1dba0ec73d370bdfca0b4f93eb06a] | committer: Francois Cartegnie

demux: packetizer: change nal length size to uint8

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

 modules/codec/crystalhd.c        |    2 +-
 modules/codec/mft.c              |    2 +-
 modules/codec/omxil/mediacodec.c |    2 +-
 modules/codec/omxil/omxil.h      |    2 +-
 modules/codec/videotoolbox.m     |    2 +-
 modules/packetizer/h264_nal.c    |   19 ++++++++++---------
 modules/packetizer/h264_nal.h    |    8 ++++----
 modules/packetizer/hevc_nal.c    |    2 +-
 modules/packetizer/hevc_nal.h    |    2 +-
 9 files changed, 21 insertions(+), 20 deletions(-)

diff --git a/modules/codec/crystalhd.c b/modules/codec/crystalhd.c
index 16f2aec..bc26176 100644
--- a/modules/codec/crystalhd.c
+++ b/modules/codec/crystalhd.c
@@ -110,7 +110,7 @@ struct decoder_sys_t
     uint8_t *p_sps_pps_buf;  /* SPS/PPS buffer */
     uint32_t i_sps_pps_size; /* SPS/PPS size */
 
-    uint32_t i_nal_size;     /* NAL header size */
+    uint8_t i_nal_size;     /* NAL header size */
 
     /* Callback */
     picture_t       *p_pic;
diff --git a/modules/codec/mft.c b/modules/codec/mft.c
index 797018c..595238c 100644
--- a/modules/codec/mft.c
+++ b/modules/codec/mft.c
@@ -100,7 +100,7 @@ struct decoder_sys_t
     IMFMediaType *output_type;
 
     /* H264 only. */
-    uint32_t nal_length_size;
+    uint8_t nal_length_size;
 };
 
 static const int pi_channels_maps[9] =
diff --git a/modules/codec/omxil/mediacodec.c b/modules/codec/omxil/mediacodec.c
index 4507b65..9d5544c 100644
--- a/modules/codec/omxil/mediacodec.c
+++ b/modules/codec/omxil/mediacodec.c
@@ -109,7 +109,7 @@ struct decoder_sys_t
         {
             AWindowHandler *p_awh;
             int i_pixel_format, i_stride, i_slice_height, i_width, i_height;
-            uint32_t i_nal_length_size;
+            uint8_t i_nal_length_size;
             size_t i_h264_profile;
             ArchitectureSpecificCopyData ascd;
             /* stores the inflight picture for each output buffer or NULL */
diff --git a/modules/codec/omxil/omxil.h b/modules/codec/omxil/omxil.h
index 1399c72..b744b24 100644
--- a/modules/codec/omxil/omxil.h
+++ b/modules/codec/omxil/omxil.h
@@ -135,7 +135,7 @@ struct decoder_sys_t
 
     date_t end_date;
 
-    size_t i_nal_size_length; /* Length of the NAL size field for H264 */
+    uint8_t i_nal_size_length; /* Length of the NAL size field for H264 */
     int b_use_pts;
 
 };
diff --git a/modules/codec/videotoolbox.m b/modules/codec/videotoolbox.m
index a608f86..ddde704 100644
--- a/modules/codec/videotoolbox.m
+++ b/modules/codec/videotoolbox.m
@@ -108,7 +108,7 @@ struct decoder_sys_t
     CMVideoCodecType            codec;
     size_t                      codec_profile;
     size_t                      codec_level;
-    uint32_t                    i_nal_length_size;
+    uint8_t                     i_nal_length_size;
 
     bool                        b_started;
     bool                        b_is_avcc;
diff --git a/modules/packetizer/h264_nal.c b/modules/packetizer/h264_nal.c
index fb53cac..eea04b8 100644
--- a/modules/packetizer/h264_nal.c
+++ b/modules/packetizer/h264_nal.c
@@ -54,7 +54,7 @@ static inline bool strip_AnnexB_startcode( const uint8_t **pp_data, size_t *pi_d
 int convert_sps_pps( decoder_t *p_dec, const uint8_t *p_buf,
                      uint32_t i_buf_size, uint8_t *p_out_buf,
                      uint32_t i_out_buf_size, uint32_t *p_sps_pps_size,
-                     uint32_t *p_nal_length_size)
+                     uint8_t *pi_nal_length_size)
 {
     int i_profile;
     uint32_t i_data_size = i_buf_size, i_nal_size, i_sps_pps_size = 0;
@@ -69,8 +69,8 @@ int convert_sps_pps( decoder_t *p_dec, const uint8_t *p_buf,
 
     /* Read infos in first 6 bytes */
     i_profile = (p_buf[1] << 16) | (p_buf[2] << 8) | p_buf[3];
-    if (p_nal_length_size)
-        *p_nal_length_size  = (p_buf[4] & 0x03) + 1;
+    if (pi_nal_length_size)
+        *pi_nal_length_size  = (p_buf[4] & 0x03) + 1;
     p_buf       += 5;
     i_data_size -= 5;
 
@@ -129,9 +129,10 @@ int convert_sps_pps( decoder_t *p_dec, const uint8_t *p_buf,
 }
 
 void convert_h264_to_annexb( uint8_t *p_buf, uint32_t i_len,
-                             size_t i_nal_length_size )
+                             uint8_t i_nal_length_size )
 {
-    uint32_t nal_len = 0, nal_pos = 0;
+    uint32_t nal_len = 0;
+    uint8_t nal_pos = 0;
 
     if( i_nal_length_size != 4 )
         return;
@@ -234,7 +235,7 @@ static block_t *h264_increase_startcode_size( block_t *p_block,
 }
 
 static int h264_replace_startcode( uint8_t *p_buf,
-                                   size_t i_nal_length_size,
+                                   uint8_t i_nal_length_size,
                                    size_t i_startcode_ofs,
                                    size_t i_nal_size )
 {
@@ -255,7 +256,7 @@ static int h264_replace_startcode( uint8_t *p_buf,
     return 0;
 }
 
-block_t *convert_annexb_to_h264( block_t *p_block, size_t i_nal_length_size )
+block_t *convert_annexb_to_h264( block_t *p_block, uint8_t i_nal_length_size )
 {
     size_t i_startcode_ofs = 0;
     size_t i_startcode_size = 0;
@@ -748,7 +749,7 @@ block_t *h264_create_avcdec_config_record( uint8_t i_nal_length_size,
 }
 
 bool h264_get_profile_level(const es_format_t *p_fmt, size_t *p_profile,
-                            size_t *p_level, size_t *p_nal_length_size)
+                            size_t *p_level, uint8_t *pi_nal_length_size)
 {
     uint8_t *p = (uint8_t*)p_fmt->p_extra;
     if(!p || !p_fmt->p_extra) return false;
@@ -757,7 +758,7 @@ bool h264_get_profile_level(const es_format_t *p_fmt, size_t *p_profile,
     if (p_fmt->i_original_fourcc == VLC_FOURCC('a','v','c','1') && p[0] == 1)
     {
         if (p_fmt->i_extra < 12) return false;
-        if (p_nal_length_size) *p_nal_length_size = 1 + (p[4]&0x03);
+        if (pi_nal_length_size) *pi_nal_length_size = 1 + (p[4]&0x03);
         if (!(p[5]&0x1f)) return false;
         p += 8;
     }
diff --git a/modules/packetizer/h264_nal.h b/modules/packetizer/h264_nal.h
index a658199..b9d61a4 100644
--- a/modules/packetizer/h264_nal.h
+++ b/modules/packetizer/h264_nal.h
@@ -122,17 +122,17 @@ static inline void CreateRbspFromNAL( uint8_t **pp_ret, int *pi_ret,
 int convert_sps_pps( decoder_t *p_dec, const uint8_t *p_buf,
                      uint32_t i_buf_size, uint8_t *p_out_buf,
                      uint32_t i_out_buf_size, uint32_t *p_sps_pps_size,
-                     uint32_t *p_nal_length_size);
+                     uint8_t *p_nal_length_size);
 
 /* Convert avcC format to Annex B in-place */
 void convert_h264_to_annexb( uint8_t *p_buf, uint32_t i_len,
-                             size_t i_nal_length_size );
+                             uint8_t i_nal_length_size );
 
 /* Convert Annex B to avcC format in-place
  * Returns the same p_block or a new p_block if there is not enough room to put
  * the NAL size. In case of error, NULL is returned and p_block is released.
  * */
-block_t *convert_annexb_to_h264( block_t *p_block, size_t i_nal_length_size );
+block_t *convert_annexb_to_h264( block_t *p_block, uint8_t i_nal_length_size );
 
 /* Get the SPS/PPS pointers from an Annex B buffer
  * Returns 0 if a SPS and/or a PPS is found */
@@ -160,6 +160,6 @@ block_t *h264_create_avcdec_config_record( uint8_t i_nal_length_size,
 
 /* Get level and Profile */
 bool h264_get_profile_level(const es_format_t *p_fmt, size_t *p_profile,
-                            size_t *p_level, size_t *p_nal_length_size);
+                            size_t *p_level, uint8_t *p_nal_length_size);
 
 #endif /* H264_NAL_H */
diff --git a/modules/packetizer/hevc_nal.c b/modules/packetizer/hevc_nal.c
index 45c5218..076fdaa 100644
--- a/modules/packetizer/hevc_nal.c
+++ b/modules/packetizer/hevc_nal.c
@@ -26,7 +26,7 @@
 int convert_hevc_nal_units(decoder_t *p_dec, const uint8_t *p_buf,
                            uint32_t i_buf_size, uint8_t *p_out_buf,
                            uint32_t i_out_buf_size, uint32_t *p_sps_pps_size,
-                           uint32_t *p_nal_size)
+                           uint8_t *p_nal_size)
 {
     int i, num_arrays;
     const uint8_t *p_end = p_buf + i_buf_size;
diff --git a/modules/packetizer/hevc_nal.h b/modules/packetizer/hevc_nal.h
index 17625e9..3203530 100644
--- a/modules/packetizer/hevc_nal.h
+++ b/modules/packetizer/hevc_nal.h
@@ -32,7 +32,7 @@
 int convert_hevc_nal_units( decoder_t *p_dec, const uint8_t *p_buf,
                             uint32_t i_buf_size, uint8_t *p_out_buf,
                             uint32_t i_out_buf_size, uint32_t *p_sps_pps_size,
-                            uint32_t *p_nal_size);
+                            uint8_t *p_nal_size);
 
 
 #endif /* HEVC_NAL_H */



More information about the vlc-commits mailing list