X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fqsv.c;h=45e1c25c68f69daf862f6cd75c5a592b86dbfced;hb=7a4639b1eba31f88490c85663c75fb1414307680;hp=250b4e61e36fef7275bda521b20ecab4899e3f1f;hpb=725ae0e2d0222f81b5cca3b0b226116ec6fd0494;p=ffmpeg diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c index 250b4e61e36..45e1c25c68f 100644 --- a/libavcodec/qsv.c +++ b/libavcodec/qsv.c @@ -195,6 +195,30 @@ int ff_qsv_find_surface_idx(QSVFramesContext *ctx, QSVFrame *frame) return AVERROR_BUG; } +enum AVPictureType ff_qsv_map_pictype(int mfx_pic_type) +{ + enum AVPictureType type; + switch (mfx_pic_type & 0x7) { + case MFX_FRAMETYPE_I: + if (mfx_pic_type & MFX_FRAMETYPE_S) + type = AV_PICTURE_TYPE_SI; + else + type = AV_PICTURE_TYPE_I; + break; + case MFX_FRAMETYPE_B: + type = AV_PICTURE_TYPE_B; + break; + case MFX_FRAMETYPE_P: + if (mfx_pic_type & MFX_FRAMETYPE_S) + type = AV_PICTURE_TYPE_SP; + else + type = AV_PICTURE_TYPE_P; + break; + } + + return type; +} + static int qsv_load_plugins(mfxSession session, const char *load_plugins, void *logctx) { @@ -389,7 +413,7 @@ static mfxStatus qsv_frame_alloc(mfxHDL pthis, mfxFrameAllocRequest *req, mfxFrameInfo *i = &req->Info; mfxFrameInfo *i1 = &frames_hwctx->surfaces[0].Info; - if (i->Width != i1->Width || i->Height != i1->Height || + if (i->Width > i1->Width || i->Height > i1->Height || i->FourCC != i1->FourCC || i->ChromaFormat != i1->ChromaFormat) { av_log(ctx->logctx, AV_LOG_ERROR, "Mismatching surface properties in an " "allocation request: %dx%d %d %d vs %dx%d %d %d\n", @@ -593,10 +617,12 @@ int ff_qsv_init_session_device(AVCodecContext *avctx, mfxSession *psession, "Error setting a HW handle"); } - err = MFXJoinSession(parent_session, session); - if (err != MFX_ERR_NONE) - return ff_qsv_print_error(avctx, err, - "Error joining session"); + if (QSV_RUNTIME_VERSION_ATLEAST(ver, 1, 25)) { + err = MFXJoinSession(parent_session, session); + if (err != MFX_ERR_NONE) + return ff_qsv_print_error(avctx, err, + "Error joining session"); + } ret = qsv_load_plugins(session, load_plugins, avctx); if (ret < 0) {