Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'libavcodec/qsvdec.c')
-rw-r--r--libavcodec/qsvdec.c54
1 files changed, 22 insertions, 32 deletions
diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
index 6fd9442b7f..996d8e8fef 100644
--- a/libavcodec/qsvdec.c
+++ b/libavcodec/qsvdec.c
@@ -4,20 +4,20 @@
* copyright (c) 2013 Luca Barbato
* copyright (c) 2015 Anton Khirnov <anton@khirnov.net>
*
- * This file is part of Libav.
+ * This file is part of FFmpeg.
*
- * Libav is free software; you can redistribute it and/or
+ * 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.
*
- * Libav is distributed in the hope that it will be useful,
+ * 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 Libav; if not, write to the Free Software
+ * License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@@ -34,6 +34,7 @@
#include "avcodec.h"
#include "internal.h"
+#include "qsv.h"
#include "qsv_internal.h"
#include "qsvdec.h"
@@ -48,37 +49,28 @@ int ff_qsv_map_pixfmt(enum AVPixelFormat format)
}
}
-static int qsv_init_session(AVCodecContext *avctx, QSVContext *q, mfxSession session)
-{
- if (!session) {
- if (!q->internal_session) {
- int ret = ff_qsv_init_internal_session(avctx, &q->internal_session, NULL);
- if (ret < 0)
- return ret;
- }
-
- q->session = q->internal_session;
- } else {
- q->session = session;
- }
-
- /* make sure the decoder is uninitialized */
- MFXVideoDECODE_Close(q->session);
-
- return 0;
-}
-
-int ff_qsv_decode_init(AVCodecContext *avctx, QSVContext *q, mfxSession session)
+int ff_qsv_decode_init(AVCodecContext *avctx, QSVContext *q)
{
mfxVideoParam param = { { 0 } };
int ret;
- ret = qsv_init_session(avctx, q, session);
- if (ret < 0) {
- av_log(avctx, AV_LOG_ERROR, "Error initializing an MFX session\n");
- return ret;
+ q->iopattern = MFX_IOPATTERN_OUT_SYSTEM_MEMORY;
+
+ if (avctx->hwaccel_context) {
+ AVQSVContext *qsv = avctx->hwaccel_context;
+
+ q->session = qsv->session;
+ q->iopattern = qsv->iopattern;
+ q->ext_buffers = qsv->ext_buffers;
+ q->nb_ext_buffers = qsv->nb_ext_buffers;
}
+ if (!q->session) {
+ ret = ff_qsv_init_internal_session(avctx, &q->internal_qs, NULL);
+ if (ret < 0)
+ return ret;
+ q->session = q->internal_qs.session;
+ }
ret = ff_qsv_codec_id_to_mfx(avctx->codec_id);
if (ret < 0)
@@ -282,9 +274,7 @@ int ff_qsv_decode_close(QSVContext *q)
av_freep(&cur);
cur = q->work_frames;
}
-
- if (q->internal_session)
- MFXClose(q->internal_session);
+ ff_qsv_close_internal_session(&q->internal_qs);
return 0;
}