Commit 23ffa367 authored by Francois Cartegnie's avatar Francois Cartegnie

hevc_nal: retrieve vps/sps/pps id without decoding

parent 2db2212b
...@@ -290,6 +290,23 @@ static bool hevc_parse_scaling_list_rbsp( bs_t *p_bs ) ...@@ -290,6 +290,23 @@ static bool hevc_parse_scaling_list_rbsp( bs_t *p_bs )
return true; return true;
} }
/* Shortcut for retrieving vps/sps/pps id */
bool hevc_get_xps_id(const uint8_t *p_buf, size_t i_buf, uint8_t *pi_id)
{
if(unlikely(!hxxx_strip_AnnexB_startcode(&p_buf, &i_buf) || i_buf < 3))
return false;
/* No need to lookup convert from emulation for that data */
uint8_t i_nal_type = ((p_buf[0] & 0x7E) >> 1);
bs_t bs;
bs_init(&bs, &p_buf[2], i_buf - 2);
if(i_nal_type == HEVC_NAL_PPS)
*pi_id = bs_read_ue( &bs );
else
*pi_id = bs_read( &bs, 4 );
return true;
}
static bool hevc_parse_inner_profile_tier_level_rbsp( bs_t *p_bs, static bool hevc_parse_inner_profile_tier_level_rbsp( bs_t *p_bs,
hevc_inner_profile_tier_level_t *p_in ) hevc_inner_profile_tier_level_t *p_in )
{ {
......
...@@ -142,5 +142,6 @@ void hevc_rbsp_release_pps( hevc_picture_parameter_set_t * ); ...@@ -142,5 +142,6 @@ void hevc_rbsp_release_pps( hevc_picture_parameter_set_t * );
uint8_t * hevc_hvcC_to_AnnexB_NAL( const uint8_t *p_buf, size_t i_buf, uint8_t * hevc_hvcC_to_AnnexB_NAL( const uint8_t *p_buf, size_t i_buf,
size_t *pi_res, uint8_t *pi_nal_length_size ); size_t *pi_res, uint8_t *pi_nal_length_size );
bool hevc_get_xps_id(const uint8_t *p_buf, size_t i_buf, uint8_t *pi_id);
#endif /* HEVC_NAL_H */ #endif /* HEVC_NAL_H */
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