Skip to content

Commit cd99a71

Browse files
committed
h264: extract nal_ref_idc and nal_unit_type
Signed-off-by: Philipp Zabel <[email protected]>
1 parent 14027b6 commit cd99a71

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/h264.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,23 @@ static void h264_va_picture_to_v4l2(struct request_data *driver_data,
219219
struct v4l2_ctrl_h264_pps *pps,
220220
struct v4l2_ctrl_h264_sps *sps)
221221
{
222+
unsigned char *b;
223+
unsigned char nal_ref_idc;
224+
unsigned char nal_unit_type;
225+
226+
/* Extract missing nal_ref_idc and nal_unit_type */
227+
b = surface->source_data;
228+
if (context->h264_start_code)
229+
b += 3;
230+
nal_ref_idc = (b[0] >> 5) & 0x3;
231+
nal_unit_type = b[0] & 0x1f;
232+
222233
h264_fill_dpb(driver_data, context, decode);
223234

224235
decode->num_slices = surface->slices_count;
236+
decode->nal_ref_idc = nal_ref_idc;
237+
if (nal_unit_type == 5)
238+
decode->flags = V4L2_H264_DECODE_PARAM_FLAG_IDR_PIC;
225239
decode->top_field_order_cnt = VAPicture->CurrPic.TopFieldOrderCnt;
226240
decode->bottom_field_order_cnt = VAPicture->CurrPic.BottomFieldOrderCnt;
227241

0 commit comments

Comments
 (0)