return ret;
qf->surface = *(mfxFrameSurface1*)qf->frame->data[3];
+
+ if (q->frames_ctx.mids) {
+ ret = ff_qsv_find_surface_idx(&q->frames_ctx, qf);
+ if (ret < 0)
+ return ret;
+
+ qf->surface.Data.MemId = &q->frames_ctx.mids[ret];
+ }
} else {
/* make a copy if the input is not padded as libmfx requires */
if (frame->height & 31 || frame->linesize[0] & (q->width_align - 1)) {
q->internal_session = NULL;
av_buffer_unref(&q->frames_ctx.hw_frames_ctx);
- av_freep(&q->frames_ctx.mids);
- q->frames_ctx.nb_mids = 0;
+ av_buffer_unref(&q->frames_ctx.mids_buf);
cur = q->work_frames;
while (cur) {