[vlc-commits] packetizer: h264: rename NAL startcode escaping functions
Francois Cartegnie
git at videolan.org
Fri Aug 21 00:42:25 CEST 2015
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Aug 20 13:03:21 2015 +0200| [c7479da1bc876c3310d4028b6e45affce0a72997] | committer: Francois Cartegnie
packetizer: h264: rename NAL startcode escaping functions
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c7479da1bc876c3310d4028b6e45affce0a72997
---
modules/demux/mpeg/hevc.c | 2 +-
modules/demux/mpeg/mpeg_parser_helpers.h | 3 ++-
modules/mux/mp4.c | 4 ++--
modules/packetizer/h264.c | 4 ++--
modules/packetizer/h264_nal.c | 2 +-
modules/packetizer/h264_nal.h | 4 ++--
6 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/modules/demux/mpeg/hevc.c b/modules/demux/mpeg/hevc.c
index 1701747..eafb747 100644
--- a/modules/demux/mpeg/hevc.c
+++ b/modules/demux/mpeg/hevc.c
@@ -231,7 +231,7 @@ static uint8_t * CreateDecodedNAL( int *pi_ret,
if( !dst )
return NULL;
- *pi_ret = nal_decode( src, dst, i_src );
+ *pi_ret = nal_to_rbsp( src, dst, i_src );
return dst;
}
diff --git a/modules/demux/mpeg/mpeg_parser_helpers.h b/modules/demux/mpeg/mpeg_parser_helpers.h
index 3f39539..50c828b 100644
--- a/modules/demux/mpeg/mpeg_parser_helpers.h
+++ b/modules/demux/mpeg/mpeg_parser_helpers.h
@@ -70,7 +70,8 @@ static inline int32_t bs_read_se( bs_t *s )
return val&0x01 ? (val+1)/2 : -(val/2);
}
-static inline size_t nal_decode(const uint8_t * p_src, uint8_t * p_dst, size_t i_size)
+/* Discards emulation prevention three bytes */
+static inline size_t nal_to_rbsp(const uint8_t * p_src, uint8_t * p_dst, size_t i_size)
{
size_t j = 0;
for (size_t i = 0; i < i_size; i++) {
diff --git a/modules/mux/mp4.c b/modules/mux/mp4.c
index 428b596..47b838e 100644
--- a/modules/mux/mp4.c
+++ b/modules/mux/mp4.c
@@ -1173,7 +1173,7 @@ static void hevcParseVPS(uint8_t * p_buffer, size_t i_buffer, uint8_t *general,
const size_t i_decoded_nal_size = 512;
uint8_t p_dec_nal[i_decoded_nal_size];
size_t i_size = (i_buffer < i_decoded_nal_size)?i_buffer:i_decoded_nal_size;
- nal_decode(p_buffer, p_dec_nal, i_size);
+ nal_to_rbsp(p_buffer, p_dec_nal, i_size);
/* first two bytes are the NAL header, 3rd and 4th are:
vps_video_parameter_set_id(4)
@@ -1196,7 +1196,7 @@ static void hevcParseSPS(uint8_t * p_buffer, size_t i_buffer, uint8_t * chroma_i
const size_t i_decoded_nal_size = 512;
uint8_t p_dec_nal[i_decoded_nal_size];
size_t i_size = (i_buffer < i_decoded_nal_size)?i_buffer-2:i_decoded_nal_size;
- nal_decode(p_buffer+2, p_dec_nal, i_size);
+ nal_to_rbsp(p_buffer+2, p_dec_nal, i_size);
bs_t bs;
bs_init(&bs, p_dec_nal, i_size);
diff --git a/modules/packetizer/h264.c b/modules/packetizer/h264.c
index 8502298..1a56440 100644
--- a/modules/packetizer/h264.c
+++ b/modules/packetizer/h264.c
@@ -894,7 +894,7 @@ static void ParseSlice( decoder_t *p_dec, bool *pb_new_picture, slice_t *p_slice
bs_t s;
/* do not convert the whole frame */
- CreateDecodedNAL( &pb_dec, &i_dec, &p_frag->p_buffer[5],
+ CreateRbspFromNAL( &pb_dec, &i_dec, &p_frag->p_buffer[5],
__MIN( p_frag->i_buffer - 5, 60 ) );
bs_init( &s, pb_dec, i_dec );
@@ -1000,7 +1000,7 @@ static void ParseSei( decoder_t *p_dec, block_t *p_frag )
int i_dec;
/* */
- CreateDecodedNAL( &pb_dec, &i_dec, &p_frag->p_buffer[5], p_frag->i_buffer - 5 );
+ CreateRbspFromNAL( &pb_dec, &i_dec, &p_frag->p_buffer[5], p_frag->i_buffer - 5 );
if( !pb_dec )
return;
diff --git a/modules/packetizer/h264_nal.c b/modules/packetizer/h264_nal.c
index 227433d..1586545 100644
--- a/modules/packetizer/h264_nal.c
+++ b/modules/packetizer/h264_nal.c
@@ -404,7 +404,7 @@ int h264_parse_sps( const uint8_t *p_sps_buf, int i_sps_size,
return -1;
memset( p_sps, 0, sizeof(struct nal_sps) );
- CreateDecodedNAL( &pb_dec, &i_dec, &p_sps_buf[5],
+ CreateRbspFromNAL( &pb_dec, &i_dec, &p_sps_buf[5],
i_sps_size - 5 );
bs_init( &s, pb_dec, i_dec );
diff --git a/modules/packetizer/h264_nal.h b/modules/packetizer/h264_nal.h
index ba3647f..286c6de 100644
--- a/modules/packetizer/h264_nal.h
+++ b/modules/packetizer/h264_nal.h
@@ -103,7 +103,7 @@ struct nal_pps
int i_pic_order_present_flag;
};
-static inline void CreateDecodedNAL( uint8_t **pp_ret, int *pi_ret,
+static inline void CreateRbspFromNAL( uint8_t **pp_ret, int *pi_ret,
const uint8_t *src, int i_src )
{
uint8_t *dst = malloc( i_src );
@@ -111,7 +111,7 @@ static inline void CreateDecodedNAL( uint8_t **pp_ret, int *pi_ret,
*pp_ret = dst;
if( dst )
- *pi_ret = nal_decode(src, dst, i_src);
+ *pi_ret = nal_to_rbsp(src, dst, i_src);
}
/* Parse the SPS/PPS Metadata and convert it to annex b format */
More information about the vlc-commits
mailing list