[FFmpeg-cvslog] qsvdec: move reading the user-provided session to qsv_decode_init()
Anton Khirnov
git at videolan.org
Wed Sep 28 19:27:17 EEST 2016
ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Sat May 21 18:26:40 2016 +0200| [6f19bbcf8532d018d8d6d82e000738d0ac2385c9] | committer: Anton Khirnov
qsvdec: move reading the user-provided session to qsv_decode_init()
This is a more appropriate place for it.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6f19bbcf8532d018d8d6d82e000738d0ac2385c9
---
libavcodec/qsvdec.c | 24 +++++++++++-------------
1 file changed, 11 insertions(+), 13 deletions(-)
diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
index 1d59e72..e3e5bba 100644
--- a/libavcodec/qsvdec.c
+++ b/libavcodec/qsvdec.c
@@ -70,8 +70,9 @@ static int qsv_init_session(AVCodecContext *avctx, QSVContext *q, mfxSession ses
return 0;
}
-static int qsv_decode_init(AVCodecContext *avctx, QSVContext *q, mfxSession session)
+static int qsv_decode_init(AVCodecContext *avctx, QSVContext *q)
{
+ mfxSession session = NULL;
mfxVideoParam param = { { 0 } };
int ret;
@@ -82,13 +83,20 @@ static int qsv_decode_init(AVCodecContext *avctx, QSVContext *q, mfxSession sess
return AVERROR(ENOMEM);
}
+ if (avctx->hwaccel_context) {
+ AVQSVContext *user_ctx = avctx->hwaccel_context;
+ session = user_ctx->session;
+ q->iopattern = user_ctx->iopattern;
+ q->ext_buffers = user_ctx->ext_buffers;
+ q->nb_ext_buffers = user_ctx->nb_ext_buffers;
+ }
+
ret = qsv_init_session(avctx, q, session);
if (ret < 0) {
av_log(avctx, AV_LOG_ERROR, "Error initializing an MFX session\n");
return ret;
}
-
ret = ff_qsv_codec_id_to_mfx(avctx->codec_id);
if (ret < 0)
return ret;
@@ -399,8 +407,6 @@ int ff_qsv_process_data(AVCodecContext *avctx, QSVContext *q,
if (q->parser->format != q->orig_pix_fmt ||
q->parser->coded_width != avctx->coded_width ||
q->parser->coded_height != avctx->coded_height) {
- mfxSession session = NULL;
-
enum AVPixelFormat pix_fmts[3] = { AV_PIX_FMT_QSV,
AV_PIX_FMT_NONE,
AV_PIX_FMT_NONE };
@@ -429,15 +435,7 @@ int ff_qsv_process_data(AVCodecContext *avctx, QSVContext *q,
avctx->pix_fmt = ret;
- if (avctx->hwaccel_context) {
- AVQSVContext *user_ctx = avctx->hwaccel_context;
- session = user_ctx->session;
- q->iopattern = user_ctx->iopattern;
- q->ext_buffers = user_ctx->ext_buffers;
- q->nb_ext_buffers = user_ctx->nb_ext_buffers;
- }
-
- ret = qsv_decode_init(avctx, q, session);
+ ret = qsv_decode_init(avctx, q);
if (ret < 0)
goto reinit_fail;
}
More information about the ffmpeg-cvslog
mailing list