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>
This commit is contained in:
James Almer 2016-09-28 13:26:12 -03:00
commit e9a5fc9678
1 changed files with 24 additions and 9 deletions

View File

@ -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) {