From patchwork Fri Aug 11 09:10:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Bilyak X-Patchwork-Id: 4689 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.46.211 with SMTP id u202csp579339vsu; Fri, 11 Aug 2017 02:16:35 -0700 (PDT) X-Received: by 10.223.180.69 with SMTP id v5mr11824421wrd.199.1502442995709; Fri, 11 Aug 2017 02:16:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502442995; cv=none; d=google.com; s=arc-20160816; b=DXYpDG1OJjO3wklJ/Eql68wG5YYPcF0g+gXYnSDmq1FEeuUryomDRQ+TU1cr/Z7KND 60ILa836iZ4HGaoHmGrdrjSgIdEozy2RB6JkpJIVWeUyurqq02L5COpl2YWVlSE10DVD bd04+hApiLKIW4uTeGAAiywb0919t74yfa8qqb3GFAFAX2cQlSyIsvvc0ggpHvKtUIVw ysrEprzlOrQBeE2MWLz6WJcL67tM+u/NqRhpaCWhmSr/9Oc5Bxn5a0brIxinXBemOBmt xldIQDzmhF57kkpFMNDQYyAzSu2deOd1B3s0jP+miVlDBkJmqmCSPvsU2DuaUsGGLmPw XoFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :delivered-to:arc-authentication-results; bh=I8RcnkW5dg4vzLhpnvSAW3yvok1hU3qi7Bk4aOGPcjE=; b=Y5WG0i9PuQpeh/yOIGhz4lnOjsUnHg0JD7qCDfcJ5OrDG00zR3q6pw6U044QXRAnxJ uDzl1Ox15VDfZxNAqngr30lvisThWwh9JCvyB4OvTuND3GLQmYBRG6RTL/FoC/WzId3P KF5EXiLTpkfz8JqW2ev4Jh0EdpLXvaj99LQSDWUdnD+pHi7sHKWqFtCPK4RlzDTRLird twBVYHt087/ruO9n/EPYouz+h6cdj1yXXY6lOZAKFh2blCS3kDFHPmFQuMwZ7mg/vNGs I9plTTCGxCJeFVbMhpb00RMIb92Ft6a1d1cYyIZ6Hplifuql2zVjgqPhLPqJB1sS/SJ3 d8Rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=M1ybOx2s; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id q140si466138wmd.108.2017.08.11.02.16.35; Fri, 11 Aug 2017 02:16:35 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=M1ybOx2s; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3DC2C689CF7; Fri, 11 Aug 2017 12:16:30 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr0-f196.google.com (mail-wr0-f196.google.com [209.85.128.196]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BBC83689216 for ; Fri, 11 Aug 2017 12:16:23 +0300 (EEST) Received: by mail-wr0-f196.google.com with SMTP id g32so2130759wrd.5 for ; Fri, 11 Aug 2017 02:16:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=BXTZH0dphB8u/mNQBe7HgHzNDJ2XPGp/HjoUnhNiuVk=; b=M1ybOx2sBKA6MRVSdmu9sMEf4bHYi0bwB21Yuv0b5IS4xITqjqtgtZMjn6psX4luzb 2yCOCvL9pDzt8LNr7bHOYWhWazYDbWt2G3gG7qEDzKKckMgAnycuUQzV/yzJO4RMXSUW SByOi0oRbZMcyHNBo+dM2YUWIFmy+69+KXL+kfQ78y3TQAgajHiPWOx0qTFIu+H0AEjC BxG3IkW3cXlCvCo4oAC6RRSjm5S8jD/agyj6UrqUV5dFbmBA7KrVDsuDhLv/wymCMyXv t5zhxMxKs/66tItRRelR6OdUgM6siqzg3dwTXaEHhW+8ZKzWYhkqbyB9SYnvHBPETBZd P0fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=BXTZH0dphB8u/mNQBe7HgHzNDJ2XPGp/HjoUnhNiuVk=; b=CasC0WBxFSG27oKXI/WTmseHz0y+5lVCUPgcr0/zPSBYoXpSyMTq7frcpDD+4Gf9LK lOMkWiZTat86VHwAO+XkKZlihBA8vnp4fMdqZfGioNbqR9PXVs9cGAHPGFPllYrns5LA NSHW8hYS3xwuZ5MKosd54AQDIM6IXkwJXATJSxEhTgg3Hq6dJkcFe8Y7nbqElYNQyv4t X5GuXocsD2gx8th8Jr9bxI86m2dWZhgMyV97Nw+0Y6IHlkyJjsyYmF9HInRn9cppfpgg xBvbJYIsyzpaoxsk+wS8/Pzc5j19w8pChAEDnfu9rkpg2fpf2vpoalOOJXx3kztcwJxC Q5bw== X-Gm-Message-State: AHYfb5isI/aZc+oW1Lm3Og5htNMOle9TFP7TrbMO/pFYXWUsTWl7IysF t0yqMB5BD6+y6LludyE= X-Received: by 10.223.130.69 with SMTP id 63mr12437428wrb.42.1502442668280; Fri, 11 Aug 2017 02:11:08 -0700 (PDT) Received: from plumbum.astim.local (host113-234-static.10-188-b.business.telecomitalia.it. [188.10.234.113]) by smtp.googlemail.com with ESMTPSA id x4sm918321wma.33.2017.08.11.02.11.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 11 Aug 2017 02:11:07 -0700 (PDT) From: Alexander Bilyak To: ffmpeg-devel@ffmpeg.org Date: Fri, 11 Aug 2017 11:10:45 +0200 Message-Id: <20170811091046.1094-1-bilyak.alexander@gmail.com> X-Mailer: git-send-email 2.13.0 Subject: [FFmpeg-devel] [PATCH 1/2] libavcodec: Add support for QSV screen capture plugin X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Alexander Bilyak MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Intel QSV SDK provide screen capture plugin starting from API ver 1.17 as runtime loadable plugin for QSV decoder. * add API version selection while initialization of QSV context (default is still 1.1 for usual encoding/decoding) --- configure | 2 + libavcodec/Makefile | 1 + libavcodec/allcodecs.c | 1 + libavcodec/qsv.c | 6 +- libavcodec/qsv_internal.h | 2 +- libavcodec/qsvdec.c | 12 ++- libavcodec/qsvdec.h | 5 + libavcodec/qsvdec_screen.c | 250 +++++++++++++++++++++++++++++++++++++++++++++ libavcodec/qsvenc.c | 3 +- 9 files changed, 272 insertions(+), 10 deletions(-) create mode 100644 libavcodec/qsvdec_screen.c diff --git a/configure b/configure index 3a146ed857..942765e8a3 100755 --- a/configure +++ b/configure @@ -2520,6 +2520,8 @@ rv20_decoder_select="h263_decoder" rv20_encoder_select="h263_encoder" rv30_decoder_select="golomb h264pred h264qpel mpegvideo rv34dsp" rv40_decoder_select="golomb h264pred h264qpel mpegvideo rv34dsp" +screen_qsv_decoder_deps="libmfx" +screen_qsv_decoder_select="qsvdec" screenpresso_decoder_select="zlib" shorten_decoder_select="bswapdsp" sipr_decoder_select="lsp" diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 59029a853c..7a2052d4c7 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -519,6 +519,7 @@ OBJS-$(CONFIG_S302M_DECODER) += s302m.o OBJS-$(CONFIG_S302M_ENCODER) += s302menc.o OBJS-$(CONFIG_SANM_DECODER) += sanm.o OBJS-$(CONFIG_SCPR_DECODER) += scpr.o +OBJS-$(CONFIG_SCREEN_QSV_DECODER) += qsvdec_screen.o OBJS-$(CONFIG_SCREENPRESSO_DECODER) += screenpresso.o OBJS-$(CONFIG_SDX2_DPCM_DECODER) += dpcm.o OBJS-$(CONFIG_SGI_DECODER) += sgidec.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index 0243f47358..d572c3f27c 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -315,6 +315,7 @@ static void register_all(void) REGISTER_ENCDEC (S302M, s302m); REGISTER_DECODER(SANM, sanm); REGISTER_DECODER(SCPR, scpr); + REGISTER_DECODER(SCREEN_QSV, screen_qsv); REGISTER_DECODER(SCREENPRESSO, screenpresso); REGISTER_DECODER(SDX2_DPCM, sdx2_dpcm); REGISTER_ENCDEC (SGI, sgi); diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c index b9e2cd990d..80d0d4af37 100644 --- a/libavcodec/qsv.c +++ b/libavcodec/qsv.c @@ -242,15 +242,13 @@ load_plugin_fail: } int ff_qsv_init_internal_session(AVCodecContext *avctx, mfxSession *session, - const char *load_plugins) + const char *load_plugins, mfxVersion api_ver) { mfxIMPL impl = MFX_IMPL_AUTO_ANY; - mfxVersion ver = { { QSV_VERSION_MINOR, QSV_VERSION_MAJOR } }; - const char *desc; int ret; - ret = MFXInit(impl, &ver, session); + ret = MFXInit(impl, &api_ver, session); if (ret < 0) return ff_qsv_print_error(avctx, ret, "Error initializing an internal MFX session"); diff --git a/libavcodec/qsv_internal.h b/libavcodec/qsv_internal.h index c0305508dd..ebc3082e22 100644 --- a/libavcodec/qsv_internal.h +++ b/libavcodec/qsv_internal.h @@ -88,7 +88,7 @@ int ff_qsv_profile_to_mfx(enum AVCodecID codec_id, int profile); int ff_qsv_map_pixfmt(enum AVPixelFormat format, uint32_t *fourcc); int ff_qsv_init_internal_session(AVCodecContext *avctx, mfxSession *session, - const char *load_plugins); + const char *load_plugins, mfxVersion api_ver); int ff_qsv_init_session_device(AVCodecContext *avctx, mfxSession *psession, AVBufferRef *device_ref, const char *load_plugins); diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c index c00817f1d9..9aa139b1e8 100644 --- a/libavcodec/qsvdec.c +++ b/libavcodec/qsvdec.c @@ -41,8 +41,9 @@ #include "qsv_internal.h" #include "qsvdec.h" -static int qsv_init_session(AVCodecContext *avctx, QSVContext *q, mfxSession session, - AVBufferRef *hw_frames_ref, AVBufferRef *hw_device_ref) +int ff_qsv_init_session(AVCodecContext *avctx, QSVContext *q, mfxSession session, + AVBufferRef *hw_frames_ref, AVBufferRef *hw_device_ref, + mfxVersion api_ver) { int ret; @@ -83,7 +84,7 @@ static int qsv_init_session(AVCodecContext *avctx, QSVContext *q, mfxSession ses } else { if (!q->internal_session) { ret = ff_qsv_init_internal_session(avctx, &q->internal_session, - q->load_plugins); + q->load_plugins, api_ver); if (ret < 0) return ret; } @@ -145,7 +146,10 @@ static int qsv_decode_init(AVCodecContext *avctx, QSVContext *q) iopattern = MFX_IOPATTERN_OUT_SYSTEM_MEMORY; q->iopattern = iopattern; - ret = qsv_init_session(avctx, q, session, avctx->hw_frames_ctx, avctx->hw_device_ctx); + mfxVersion api_ver = { { QSV_VERSION_MINOR, QSV_VERSION_MAJOR } }; + + ret = ff_qsv_init_session(avctx, q, session, avctx->hw_frames_ctx, + avctx->hw_device_ctx, api_ver); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "Error initializing an MFX session\n"); return ret; diff --git a/libavcodec/qsvdec.h b/libavcodec/qsvdec.h index 4e86e4b7f8..704d308fb3 100644 --- a/libavcodec/qsvdec.h +++ b/libavcodec/qsvdec.h @@ -70,6 +70,11 @@ typedef struct QSVContext { int nb_ext_buffers; } QSVContext; +int ff_qsv_init_session(AVCodecContext *avctx, QSVContext *q, mfxSession session, + AVBufferRef *hw_frames_ref, AVBufferRef *hw_device_ref, + mfxVersion api_ver); + + int ff_qsv_process_data(AVCodecContext *avctx, QSVContext *q, AVFrame *frame, int *got_frame, AVPacket *pkt); diff --git a/libavcodec/qsvdec_screen.c b/libavcodec/qsvdec_screen.c new file mode 100644 index 0000000000..aeea851333 --- /dev/null +++ b/libavcodec/qsvdec_screen.c @@ -0,0 +1,250 @@ +/* + * Intel QSV screen capture decoder + * + * This file is part of FFmpeg. + * + * Copyright (C) 2017 Alexander Bilyak + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 + * of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * Intel QSV Screen capture decoder interface + * @author Alexander Bilyak + * @note This "decoder" uses intel QSV decoder plugin for screen capturing. + * It does not decode incoming packets; moreover: input packets should be empty. + * Make sure executable could find appropriate plugin during runtime. + */ + +#include +#include + +#include +#include + +#include "libavutil/common.h" +#include "libavutil/fifo.h" +#include "libavutil/opt.h" + +#include "avcodec.h" +#include "internal.h" +#include "qsv_internal.h" +#include "qsvdec.h" +#include "qsv.h" + +/** + * QSV screen capture decoder context + */ +typedef struct QSVScreenContext { + AVClass *class; /**< Class for private options */ + QSVContext qsv; /**< QSV context used for initialization */ + + mfxExtScreenCaptureParam param; /**< Screen capture parameters */ + + int draw_mouse; /**< Draw mouse cursor (private option) */ +} QSVScreenContext; + +/** + * Closes QSV screen decoder (public decoder API). + * + * @param avctx Context from avcodec core + * + * @return 0 on success, a negative AVERROR on error + */ +static av_cold int qsv_screen_decode_close(AVCodecContext *avctx) +{ + QSVScreenContext *s = avctx->priv_data; + + ff_qsv_decode_close(&s->qsv); + + return 0; +} + +/** + * Flushes QSV screen decoder (public decoder API). + * + * @param avctx Context from avcodec core + */ +static void qsv_screen_decode_flush(AVCodecContext *avctx) +{ + QSVScreenContext *s = avctx->priv_data; + + ff_qsv_decode_flush(avctx, &s->qsv); +} + +/** + * Init internal QSV context for screen capturing + * + * @param avctx Context from avcodec core + * + * @param q QSVContext to be initialized + * + * @return 0 on success, a negative AVERROR on error + */ +static int qsv_screen_context_init(AVCodecContext *avctx, QSVContext *q) +{ + int ret; + mfxSession session = NULL; + mfxVideoParam param = { 0 }; + mfxVersion api_ver = { { 17, 1 } }; + + QSVScreenContext *ctx = avctx->priv_data; + mfxExtBuffer* buffers = (mfxExtBuffer*)&ctx->param; + + ff_qsv_map_pixfmt(AV_PIX_FMT_NV12, &q->fourcc); + + avctx->pix_fmt = AV_PIX_FMT_NV12; + avctx->field_order = AV_FIELD_TT; + avctx->level = FF_LEVEL_UNKNOWN; + avctx->profile = FF_PROFILE_UNKNOWN; + + q->async_fifo = av_fifo_alloc((1 + q->async_depth) * + (sizeof(mfxSyncPoint*) + sizeof(QSVFrame*))); + if (!q->async_fifo) + return AVERROR(ENOMEM); + + q->iopattern = MFX_IOPATTERN_OUT_VIDEO_MEMORY; + + q->avctx_internal = avcodec_alloc_context3(NULL); + if (!q->avctx_internal) + return AVERROR(ENOMEM); + + q->orig_pix_fmt = AV_PIX_FMT_NONE; + + ret = ff_qsv_init_session(avctx, q, session, avctx->hw_frames_ctx, avctx->hw_device_ctx, api_ver); + if (ret < 0) { + av_log(avctx, AV_LOG_ERROR, "Error initializing an MFX session\n"); + return ret; + } + + param.mfx.CodecId = MFX_CODEC_CAPTURE; + + param.mfx.FrameInfo.FourCC = q->fourcc; + param.mfx.FrameInfo.Width = FFALIGN(avctx->width, 16); + param.mfx.FrameInfo.CropW = avctx->width; + param.mfx.FrameInfo.Height = FFALIGN(avctx->height, 16); + param.mfx.FrameInfo.CropH = avctx->height; + param.mfx.FrameInfo.ChromaFormat = MFX_CHROMAFORMAT_YUV420; + + ctx->param.Header.BufferId = MFX_EXTBUFF_SCREEN_CAPTURE_PARAM; + ctx->param.Header.BufferSz = sizeof(mfxExtScreenCaptureParam); + ctx->param.EnableCursorCapture = ctx->draw_mouse; + + param.ExtParam = &buffers; + param.NumExtParam = 1; + + param.IOPattern = q->iopattern; + + ret = MFXVideoDECODE_Init(q->session, ¶m); + if (ret < 0) + return ff_qsv_print_error(avctx, ret, + "Error initializing the MFX video decoder"); + + q->frame_info = param.mfx.FrameInfo; + + return 0; +} + +/** + * Init QSV screen decoder and loads screen capture plugin (public decoder API). + * + * @param avctx Context from avcodec core + * + * @return 0 on success, a negative AVERROR on error + */ +static av_cold int qsv_screen_decode_init(AVCodecContext *avctx) +{ + QSVScreenContext *s = avctx->priv_data; + int ret; + + static const char *uid_screendec_hw = "22d62c07e672408fbb4cc20ed7a053e4"; + + av_freep(&s->qsv.load_plugins); + s->qsv.load_plugins = av_strdup(uid_screendec_hw); + if (!s->qsv.load_plugins) + return AVERROR(ENOMEM); + + ret = qsv_screen_context_init(avctx, &s->qsv); + if (ret < 0) + return ret; + + return 0; +} + +/** + * Produce frame from screen capturing plugin (public decoder API). + * + * @param avctx Context from avcodec core + * + * @param[out] data Pointer to AVFrame where data will be stored + * + * @param[out] got_frame zero, if no frame produced, otherwise - nonzero + * + * @param[in] avpkt Input AVPacket. Should be non-NULL and have zero sized buf + * + * @return produced packet size on success, a negative AVERROR on error + */ +static int qsv_screen_decode_frame(AVCodecContext *avctx, void *data, + int *got_frame, AVPacket *avpkt) +{ + QSVScreenContext *ctx = avctx->priv_data; + AVFrame *frame = data; + int ret; + + if (avpkt->size) { + av_log(avctx, AV_LOG_ERROR, "pkt should be empty with 0-size buf\n"); + } + + while (!*got_frame) { + ret = ff_qsv_process_data(avctx, &ctx->qsv, frame, got_frame, avpkt); + if (ret < 0) + return ret; + } + + return avpkt->size; +} + +#define OFFSET(x) offsetof(QSVScreenContext, x) +#define VD AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM +static const AVOption screen_options[] = { + { "async_depth", "Internal parallelization depth, the higher the value the higher the latency.", OFFSET(qsv.async_depth), AV_OPT_TYPE_INT, { .i64 = ASYNC_DEPTH_DEFAULT }, 0, INT_MAX, VD }, + { "draw_mouse", "Capture the mouse pointer", OFFSET(draw_mouse), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, VD }, + { NULL }, +}; + + +static const AVClass screen_qsv_class = { + .class_name = "screen_qsv", + .item_name = av_default_item_name, + .option = screen_options, + .version = LIBAVUTIL_VERSION_INT, +}; + +AVCodec ff_screen_qsv_decoder = { + .name = "screen_qsv", + .long_name = NULL_IF_CONFIG_SMALL("Fake decoder for screen capturing with intel QSV plugin"), + .priv_data_size = sizeof(QSVScreenContext), + .type = AVMEDIA_TYPE_VIDEO, + .id = AV_CODEC_ID_RAWVIDEO, + .init = qsv_screen_decode_init, + .decode = qsv_screen_decode_frame, + .flush = qsv_screen_decode_flush, + .close = qsv_screen_decode_close, + .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_DR1 | AV_CODEC_CAP_AVOID_PROBING, + .priv_class = &screen_qsv_class, + .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_NV12, + AV_PIX_FMT_NONE }, +}; diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index 5eb506fb76..04399819c4 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -708,8 +708,9 @@ static int qsvenc_init_session(AVCodecContext *avctx, QSVEncContext *q) q->session = q->internal_session; } else { + mfxVersion api_ver = { { QSV_VERSION_MINOR, QSV_VERSION_MAJOR } }; ret = ff_qsv_init_internal_session(avctx, &q->internal_session, - q->load_plugins); + q->load_plugins, api_ver); if (ret < 0) return ret;