Commit 4392fc87 authored by Francois Cartegnie's avatar Francois Cartegnie

packetizer: h264_nal: rename for consistency

parent eec22355
......@@ -615,7 +615,7 @@ static int crystal_insert_sps_pps( decoder_t *p_dec,
if( !p_sys->p_sps_pps_buf )
return VLC_ENOMEM;
ret = convert_sps_pps( p_dec, p_buf, i_buf_size, p_sys->p_sps_pps_buf,
ret = h264_avcC_to_AnnexB_NAL( p_dec, p_buf, i_buf_size, p_sys->p_sps_pps_buf,
p_dec->fmt_in.i_extra * 2, &p_sys->i_sps_pps_size,
&p_sys->i_nal_size );
if( !ret )
......
......@@ -575,7 +575,7 @@ static int ProcessInputStream(decoder_t *p_dec, DWORD stream_id, block_t *p_bloc
if (p_dec->fmt_in.i_codec == VLC_CODEC_H264)
{
/* in-place NAL to annex B conversion. */
convert_h264_to_annexb(buffer_start, p_block->i_buffer, p_sys->nal_length_size);
h264_AVC_to_AnnexB(buffer_start, p_block->i_buffer, p_sys->nal_length_size);
}
hr = IMFMediaBuffer_Unlock(input_media_buffer);
......@@ -994,7 +994,7 @@ static int InitializeMFT(decoder_t *p_dec)
uint8_t *buf = malloc(buf_size);
if (((uint8_t*)p_dec->fmt_in.p_extra)[0] == 1)
{
convert_sps_pps(p_dec, p_dec->fmt_in.p_extra, p_dec->fmt_in.i_extra,
h264_avcC_to_AnnexB_NAL(p_dec, p_dec->fmt_in.p_extra, p_dec->fmt_in.i_extra,
buf, buf_size,
&size, &p_sys->nal_length_size);
}
......
......@@ -313,7 +313,7 @@ static int ParseVideoExtra(decoder_t *p_dec, uint8_t *p_extra, int i_extra)
if (p_dec->fmt_in.i_codec == VLC_CODEC_H264)
{
if (p_extra[0] == 1
&& convert_sps_pps(p_dec, p_extra, i_extra,
&& h264_avcC_to_AnnexB_NAL(p_dec, p_extra, i_extra,
p_buf, buf_size, &size,
&p_sys->u.video.i_nal_length_size) == VLC_SUCCESS)
H264SetCSD(p_dec, p_buf, size, NULL);
......@@ -981,7 +981,7 @@ static void H264ProcessBlock(decoder_t *p_dec, block_t *p_block,
if (p_sys->u.video.i_nal_length_size)
{
convert_h264_to_annexb(p_block->p_buffer, p_block->i_buffer,
h264_AVC_to_AnnexB(p_block->p_buffer, p_block->i_buffer,
p_sys->u.video.i_nal_length_size);
} else if (H264SetCSD(p_dec, p_block->p_buffer, p_block->i_buffer,
p_size_changed) == VLC_SUCCESS)
......@@ -999,7 +999,7 @@ static void HEVCProcessBlock(decoder_t *p_dec, block_t *p_block,
if (p_sys->u.video.i_nal_length_size)
{
convert_h264_to_annexb(p_block->p_buffer, p_block->i_buffer,
h264_AVC_to_AnnexB(p_block->p_buffer, p_block->i_buffer,
p_sys->u.video.i_nal_length_size);
}
......
......@@ -1174,7 +1174,7 @@ static int OpenGeneric( vlc_object_t *p_this, bool b_encode )
if( p_sys->i_nal_size_length && !p_sys->in.b_direct )
{
p_header->nFilledLen = 0;
convert_sps_pps( p_dec, p_dec->fmt_in.p_extra, p_dec->fmt_in.i_extra,
h264_avcC_to_AnnexB_NAL( p_dec, p_dec->fmt_in.p_extra, p_dec->fmt_in.i_extra,
p_header->pBuffer, p_header->nAllocLen,
(uint32_t*) &p_header->nFilledLen, NULL );
}
......@@ -1498,7 +1498,7 @@ static int DecodeVideoInput( decoder_t *p_dec, OmxPort *p_port, block_t **pp_blo
/* Convert H.264 NAL format to annex b. Doesn't do anything if
* i_nal_size_length == 0, which is the case for codecs other
* than H.264 */
convert_h264_to_annexb( p_header->pBuffer, p_header->nFilledLen,
h264_AVC_to_AnnexB( p_header->pBuffer, p_header->nFilledLen,
p_sys->i_nal_size_length);
OMX_DBG( "EmptyThisBuffer %p, %p, %u, %"PRId64, (void *)p_header,
(void *)p_header->pBuffer, (unsigned)p_header->nFilledLen,
......
......@@ -317,7 +317,7 @@ static int StartVideoToolbox(decoder_t *p_dec, block_t *p_block)
/* we need to convert the SPS and PPS units we received from the
* demuxer's avvC atom so we can process them further */
i_ret = convert_sps_pps(p_dec,
i_ret = h264_avcC_to_AnnexB_NAL(p_dec,
p_dec->fmt_in.p_extra,
p_dec->fmt_in.i_extra,
p_buf,
......@@ -385,7 +385,7 @@ static int StartVideoToolbox(decoder_t *p_dec, block_t *p_block)
p_sys->codec_level = sps_data.i_level;
/* create avvC atom to forward to the HW decoder */
block_t *p_block = h264_create_avcdec_config_record(
block_t *p_block = h264_AnnexB_NAL_to_avcC(
p_sys->i_nal_length_size,
p_sps_buf, i_sps_size,
p_pps_buf, i_pps_size);
......@@ -869,7 +869,7 @@ static block_t *H264ProcessBlock(decoder_t *p_dec, block_t *p_block)
}
}
return convert_annexb_to_h264(p_block, p_sys->i_nal_length_size);
return h264_AnnexB_to_AVC(p_block, p_sys->i_nal_length_size);
}
static CMSampleBufferRef VTSampleBufferCreate(decoder_t *p_dec,
......
......@@ -51,24 +51,22 @@ static inline bool strip_AnnexB_startcode( const uint8_t **pp_data, size_t *pi_d
return true;
}
int convert_sps_pps( decoder_t *p_dec, const uint8_t *p_buf,
int h264_avcC_to_AnnexB_NAL( 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,
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;
unsigned int i_loop_end;
/* */
if( i_data_size < 7 )
{
msg_Err( p_dec, "Input Metadata too small" );
msg_Err( p_dec, "avcC too small" );
return VLC_ENOMEM;
}
/* Read infos in first 6 bytes */
i_profile = (p_buf[1] << 16) | (p_buf[2] << 8) | p_buf[3];
if (pi_nal_length_size)
*pi_nal_length_size = (p_buf[4] & 0x03) + 1;
p_buf += 5;
......@@ -128,7 +126,7 @@ int convert_sps_pps( decoder_t *p_dec, const uint8_t *p_buf,
return VLC_SUCCESS;
}
void convert_h264_to_annexb( uint8_t *p_buf, uint32_t i_len,
void h264_AVC_to_AnnexB( uint8_t *p_buf, uint32_t i_len,
uint8_t i_nal_length_size )
{
uint32_t nal_len = 0;
......@@ -256,7 +254,7 @@ static int h264_replace_startcode( uint8_t *p_buf,
return 0;
}
block_t *convert_annexb_to_h264( block_t *p_block, uint8_t i_nal_length_size )
block_t *h264_AnnexB_to_AVC( block_t *p_block, uint8_t i_nal_length_size )
{
size_t i_startcode_ofs = 0;
size_t i_startcode_size = 0;
......@@ -704,7 +702,7 @@ int h264_parse_pps( const uint8_t *p_pps_buf, int i_pps_size,
return 0;
}
block_t *h264_create_avcdec_config_record( uint8_t i_nal_length_size,
block_t *h264_AnnexB_NAL_to_avcC( uint8_t i_nal_length_size,
const uint8_t *p_sps_buf,
size_t i_sps_size,
const uint8_t *p_pps_buf,
......
......@@ -118,21 +118,21 @@ static inline void CreateRbspFromNAL( uint8_t **pp_ret, int *pi_ret,
*pi_ret = nal_to_rbsp(src, dst, i_src);
}
/* Parse the SPS/PPS Metadata and convert it to annex b format */
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,
uint8_t *p_nal_length_size);
/*
AnnexB : [\x00] \x00 \x00 \x01 Prefixed NAL
AVC Sample format : NalLengthSize encoded size prefixed NAL
avcC: AVCDecoderConfigurationRecord combining SPS & PPS in AVC Sample Format
*/
/* Convert avcC format to Annex B in-place */
void convert_h264_to_annexb( uint8_t *p_buf, uint32_t i_len,
uint8_t i_nal_length_size );
/* Convert AVC Sample format to Annex B in-place */
void h264_AVC_to_AnnexB( uint8_t *p_buf, uint32_t i_len,
uint8_t i_nal_length_size );
/* Convert Annex B to avcC format in-place
/* Convert Annex B to AVC Sample 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, uint8_t i_nal_length_size );
block_t *h264_AnnexB_to_AVC( 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 */
......@@ -152,11 +152,17 @@ int h264_parse_pps( const uint8_t *p_pps_buf, int i_pps_size,
/* Create a AVCDecoderConfigurationRecord from SPS/PPS
* Returns a valid block_t on success, must be freed with block_Release */
block_t *h264_create_avcdec_config_record( uint8_t i_nal_length_size,
const uint8_t *p_sps_buf,
size_t i_sps_size,
const uint8_t *p_pps_buf,
size_t i_pps_size );
block_t *h264_AnnexB_NAL_to_avcC( uint8_t i_nal_length_size,
const uint8_t *p_sps_buf,
size_t i_sps_size,
const uint8_t *p_pps_buf,
size_t i_pps_size );
/* Convert AVCDecoderConfigurationRecord SPS/PPS to Annex B format */
int h264_avcC_to_AnnexB_NAL( 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,
uint8_t *p_nal_length_size);
/* Get level and Profile */
bool h264_get_profile_level(const es_format_t *p_fmt, size_t *p_profile,
......
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