Commit bd2d71dc authored by François Cartegnie's avatar François Cartegnie 🤞

packetizer: hevc: parse pic timing

parent ec9de0f6
......@@ -1307,3 +1307,46 @@ int hevc_compute_picture_order_count( const hevc_sequence_parameter_set_t *p_sps
return pocMSB + p_slice->pic_order_cnt_lsb;
}
struct hevc_sei_pic_timing_t
{
nal_u4_t pic_struct;
};
void hevc_release_sei_pic_timing( hevc_sei_pic_timing_t *p_timing )
{
free( p_timing );
}
hevc_sei_pic_timing_t * hevc_decode_sei_pic_timing( bs_t *p_bs,
const hevc_sequence_parameter_set_t *p_sps )
{
hevc_sei_pic_timing_t *p_timing = malloc(sizeof(*p_timing));
if( p_timing )
{
if( p_sps->vui.frame_field_info_present_flag )
p_timing->pic_struct = bs_read( p_bs, 4 );
else
p_timing->pic_struct = 0;
}
return p_timing;
}
uint8_t hevc_get_num_clock_ts( const hevc_sequence_parameter_set_t *p_sps,
const hevc_sei_pic_timing_t *p_timing )
{
if( p_sps->vui.frame_field_info_present_flag && p_timing && p_timing->pic_struct < 13 )
{
/* !WARN modified with units_field_based_flag (D.3.25) for values 0, 7 and 8 */
const uint8_t rgi_numclock[13] = { 2, 1, 1, 2, 2, 3, 3, 4, 6, 1, 1, 1, 1 };
return rgi_numclock[p_timing->pic_struct];
}
if( p_sps->vui_parameters_present_flag )
{
if( p_sps->vui.field_seq_flag )
return 1; /* D.3.27 */
}
return 2;
}
......@@ -20,8 +20,8 @@
#ifndef HEVC_NAL_H
# define HEVC_NAL_H
# include <vlc_common.h>
# include <vlc_es.h>
# include <vlc_bits.h>
#define HEVC_VPS_ID_MAX 15
#define HEVC_SPS_ID_MAX 15
......@@ -213,4 +213,13 @@ int hevc_compute_picture_order_count( const hevc_sequence_parameter_set_t *p_sps
const hevc_slice_segment_header_t *slice,
hevc_poc_ctx_t *ctx );
typedef struct hevc_sei_pic_timing_t hevc_sei_pic_timing_t;
hevc_sei_pic_timing_t * hevc_decode_sei_pic_timing( bs_t *,
const hevc_sequence_parameter_set_t * );
void hevc_release_sei_pic_timing( hevc_sei_pic_timing_t * );
uint8_t hevc_get_num_clock_ts( const hevc_sequence_parameter_set_t *,
const hevc_sei_pic_timing_t * /* can be NULL */ );
#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