int i_ref_idc;
int i_idr_pic_id;
int i_frame_num;
+ int i_poc;
int b_key;
int i_log2_max_frame_num;
+ int i_poc_type;
+ int i_log2_max_poc_lsb;
} h264_t;
void h264_parser_init( h264_t * );
h->i_idr_pic_id = -1;
h->i_frame_num = -1;
h->i_log2_max_frame_num = 0;
+ h->i_poc = -1;
+ h->i_poc_type = -1;
}
void h264_parser_parse( h264_t *h, nal_t *nal, int *pb_nal_start )
{
/* Skip i_log2_max_frame_num */
h->i_log2_max_frame_num = bs_read_ue( &s ) + 4;
/* Read poc_type */
- i_tmp = bs_read_ue( &s );
- if( i_tmp == 0 )
+ h->i_poc_type = bs_read_ue( &s );
+ if( h->i_poc_type == 0 )
{
- /* skip i_log2_max_poc_lsb */
- bs_read_ue( &s );
+ h->i_log2_max_poc_lsb = bs_read_ue( &s ) + 4;
}
- else if( i_tmp == 1 )
+ else if( h->i_poc_type == 1 )
{
int i_cycle;
/* skip b_delta_pic_order_always_zero */
h->b_key = 0;
break;
case 2: case 7: /* I */
- h->b_key = 1;
- break;
- case 4: case 9: /* ? */
- h->b_key = 1;
+ case 4: case 9: /* SI */
+ h->b_key = (nal->i_type == NAL_SLICE_IDR);
break;
}
/* pps id */
h->i_idr_pic_id = i_tmp;
}
+
+ if( h->i_poc_type == 0 )
+ {
+ i_tmp = bs_read( &s, h->i_log2_max_poc_lsb );
+ if( i_tmp != h->i_poc )
+ *pb_nal_start = 1;
+ h->i_poc = i_tmp;
+ }
}
h->i_nal_type = nal->i_type;
h->i_ref_idc = nal->i_ref_idc;