demux: packetizer: change nal length size to uint8
authorFrancois Cartegnie <fcvlcdev@free.fr>
Thu, 3 Dec 2015 18:38:22 +0000 (19:38 +0100)
committerFrancois Cartegnie <fcvlcdev@free.fr>
Thu, 3 Dec 2015 19:12:12 +0000 (20:12 +0100)
modules/codec/crystalhd.c
modules/codec/mft.c
modules/codec/omxil/mediacodec.c
modules/codec/omxil/omxil.h
modules/codec/videotoolbox.m
modules/packetizer/h264_nal.c
modules/packetizer/h264_nal.h
modules/packetizer/hevc_nal.c
modules/packetizer/hevc_nal.h

index 16f2aec..bc26176 100644 (file)
@@ -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;
index 797018c..595238c 100644 (file)
@@ -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] =
index 4507b65..9d5544c 100644 (file)
@@ -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 */
index 1399c72..b744b24 100644 (file)
@@ -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;
 
 };
index a608f86..ddde704 100644 (file)
@@ -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;
index fb53cac..eea04b8 100644 (file)
@@ -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;
     }
index a658199..b9d61a4 100644 (file)
@@ -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 */
index 45c5218..076fdaa 100644 (file)
@@ -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;
index 17625e9..3203530 100644 (file)
@@ -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 */