Commit c7479da1 authored by Francois Cartegnie's avatar Francois Cartegnie

packetizer: h264: rename NAL startcode escaping functions

parent 0d302380
......@@ -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;
}
......
......@@ -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++) {
......
......@@ -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);
......
......@@ -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;
......
......@@ -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 );
......
......@@ -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 */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment