|
@@ -144,6 +144,17 @@ int ff_qsv_map_pixfmt(enum AVPixelFormat format, uint32_t *fourcc) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int ff_qsv_find_surface_idx(QSVFramesContext *ctx, QSVFrame *frame) |
|
|
|
|
|
{ |
|
|
|
|
|
int i; |
|
|
|
|
|
for (i = 0; i < ctx->nb_mids; i++) { |
|
|
|
|
|
QSVMid *mid = &ctx->mids[i]; |
|
|
|
|
|
if (mid->handle == frame->surface.Data.MemId) |
|
|
|
|
|
return i; |
|
|
|
|
|
} |
|
|
|
|
|
return AVERROR_BUG; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
static int qsv_load_plugins(mfxSession session, const char *load_plugins, |
|
|
static int qsv_load_plugins(mfxSession session, const char *load_plugins, |
|
|
void *logctx) |
|
|
void *logctx) |
|
|
{ |
|
|
{ |
|
@@ -244,6 +255,7 @@ static mfxStatus qsv_frame_alloc(mfxHDL pthis, mfxFrameAllocRequest *req, |
|
|
QSVFramesContext *ctx = pthis; |
|
|
QSVFramesContext *ctx = pthis; |
|
|
mfxFrameInfo *i = &req->Info; |
|
|
mfxFrameInfo *i = &req->Info; |
|
|
mfxFrameInfo *i1 = &ctx->info; |
|
|
mfxFrameInfo *i1 = &ctx->info; |
|
|
|
|
|
int j; |
|
|
|
|
|
|
|
|
if (!(req->Type & MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET) || |
|
|
if (!(req->Type & MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET) || |
|
|
!(req->Type & (MFX_MEMTYPE_FROM_DECODE | MFX_MEMTYPE_FROM_ENCODE)) || |
|
|
!(req->Type & (MFX_MEMTYPE_FROM_DECODE | MFX_MEMTYPE_FROM_ENCODE)) || |
|
@@ -258,7 +270,13 @@ static mfxStatus qsv_frame_alloc(mfxHDL pthis, mfxFrameAllocRequest *req, |
|
|
return MFX_ERR_UNSUPPORTED; |
|
|
return MFX_ERR_UNSUPPORTED; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
resp->mids = ctx->mids; |
|
|
|
|
|
|
|
|
resp->mids = av_mallocz_array(ctx->nb_mids, sizeof(*resp->mids)); |
|
|
|
|
|
if (!resp->mids) |
|
|
|
|
|
return MFX_ERR_MEMORY_ALLOC; |
|
|
|
|
|
|
|
|
|
|
|
for (j = 0; j < ctx->nb_mids; j++) |
|
|
|
|
|
resp->mids[j] = &ctx->mids[j]; |
|
|
|
|
|
|
|
|
resp->NumFrameActual = ctx->nb_mids; |
|
|
resp->NumFrameActual = ctx->nb_mids; |
|
|
|
|
|
|
|
|
return MFX_ERR_NONE; |
|
|
return MFX_ERR_NONE; |
|
@@ -266,6 +284,7 @@ static mfxStatus qsv_frame_alloc(mfxHDL pthis, mfxFrameAllocRequest *req, |
|
|
|
|
|
|
|
|
static mfxStatus qsv_frame_free(mfxHDL pthis, mfxFrameAllocResponse *resp) |
|
|
static mfxStatus qsv_frame_free(mfxHDL pthis, mfxFrameAllocResponse *resp) |
|
|
{ |
|
|
{ |
|
|
|
|
|
av_freep(&resp->mids); |
|
|
return MFX_ERR_NONE; |
|
|
return MFX_ERR_NONE; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@@ -281,7 +300,8 @@ static mfxStatus qsv_frame_unlock(mfxHDL pthis, mfxMemId mid, mfxFrameData *ptr) |
|
|
|
|
|
|
|
|
static mfxStatus qsv_frame_get_hdl(mfxHDL pthis, mfxMemId mid, mfxHDL *hdl) |
|
|
static mfxStatus qsv_frame_get_hdl(mfxHDL pthis, mfxMemId mid, mfxHDL *hdl) |
|
|
{ |
|
|
{ |
|
|
*hdl = mid; |
|
|
|
|
|
|
|
|
QSVMid *qsv_mid = (QSVMid*)mid; |
|
|
|
|
|
*hdl = qsv_mid->handle; |
|
|
return MFX_ERR_NONE; |
|
|
return MFX_ERR_NONE; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@@ -365,7 +385,7 @@ int ff_qsv_init_session_hwcontext(AVCodecContext *avctx, mfxSession *psession, |
|
|
qsv_frames_ctx->info = frames_hwctx->surfaces[0].Info; |
|
|
qsv_frames_ctx->info = frames_hwctx->surfaces[0].Info; |
|
|
qsv_frames_ctx->nb_mids = frames_hwctx->nb_surfaces; |
|
|
qsv_frames_ctx->nb_mids = frames_hwctx->nb_surfaces; |
|
|
for (i = 0; i < frames_hwctx->nb_surfaces; i++) |
|
|
for (i = 0; i < frames_hwctx->nb_surfaces; i++) |
|
|
qsv_frames_ctx->mids[i] = frames_hwctx->surfaces[i].Data.MemId; |
|
|
|
|
|
|
|
|
qsv_frames_ctx->mids[i].handle = frames_hwctx->surfaces[i].Data.MemId; |
|
|
|
|
|
|
|
|
err = MFXVideoCORE_SetFrameAllocator(session, &frame_allocator); |
|
|
err = MFXVideoCORE_SetFrameAllocator(session, &frame_allocator); |
|
|
if (err != MFX_ERR_NONE) |
|
|
if (err != MFX_ERR_NONE) |
|
|