diff options
author | James Almer <jamrial@gmail.com> | 2016-09-28 13:26:12 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2016-09-28 13:26:12 -0300 |
commit | e9a5fc967867f9bd361f472306ca130bb64b0b04 (patch) | |
tree | bf88785dc19a742e8b121fd78ce2c65a71a3322d /libavcodec | |
parent | 32c25f06b79f9edcda726f6e043325d40036cdce (diff) | |
parent | 6f19bbcf8532d018d8d6d82e000738d0ac2385c9 (diff) | |
download | ffmpeg-e9a5fc967867f9bd361f472306ca130bb64b0b04.tar.gz |
Merge commit '6f19bbcf8532d018d8d6d82e000738d0ac2385c9'
* commit '6f19bbcf8532d018d8d6d82e000738d0ac2385c9':
qsvdec: move reading the user-provided session to qsv_decode_init()
Conflicts:
libavcodec/qsvdec.c
Merged-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/qsvdec.c | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c index 98585e3f78..b685e0e3f0 100644 --- a/libavcodec/qsvdec.c +++ b/libavcodec/qsvdec.c @@ -49,8 +49,27 @@ int ff_qsv_map_pixfmt(enum AVPixelFormat format) } } +static int qsv_init_session(AVCodecContext *avctx, QSVContext *q, mfxSession session) +{ + if (!session) { + if (!q->internal_qs.session) { + int ret = ff_qsv_init_internal_session(avctx, &q->internal_qs, + q->load_plugins); + if (ret < 0) + return ret; + } + + q->session = q->internal_qs.session; + } else { + q->session = session; + } + + return 0; +} + static int qsv_decode_init(AVCodecContext *avctx, QSVContext *q, AVPacket *avpkt) { + mfxSession session = NULL; mfxVideoParam param = { { 0 } }; mfxBitstream bs = { { { 0 } } }; int ret; @@ -68,20 +87,16 @@ static int qsv_decode_init(AVCodecContext *avctx, QSVContext *q, AVPacket *avpkt if (avctx->hwaccel_context) { AVQSVContext *qsv = avctx->hwaccel_context; - q->session = qsv->session; + session = qsv->session; q->iopattern = qsv->iopattern; q->ext_buffers = qsv->ext_buffers; q->nb_ext_buffers = qsv->nb_ext_buffers; } - if (!q->session) { - if (!q->internal_qs.session) { - ret = ff_qsv_init_internal_session(avctx, &q->internal_qs, - q->load_plugins); - if (ret < 0) - return ret; - } - q->session = q->internal_qs.session; + ret = qsv_init_session(avctx, q, session); + if (ret < 0) { + av_log(avctx, AV_LOG_ERROR, "Error initializing an MFX session\n"); + return ret; } if (avpkt->size) { |