You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
qsvdec: Allow use of hw_device_ctx to make the internal session
This commit is contained in:
@@ -42,7 +42,7 @@
|
|||||||
#include "qsvdec.h"
|
#include "qsvdec.h"
|
||||||
|
|
||||||
static int qsv_init_session(AVCodecContext *avctx, QSVContext *q, mfxSession session,
|
static int qsv_init_session(AVCodecContext *avctx, QSVContext *q, mfxSession session,
|
||||||
AVBufferRef *hw_frames_ref)
|
AVBufferRef *hw_frames_ref, AVBufferRef *hw_device_ref)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@@ -67,6 +67,18 @@ static int qsv_init_session(AVCodecContext *avctx, QSVContext *q, mfxSession ses
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
q->session = q->internal_session;
|
||||||
|
} else if (hw_device_ref) {
|
||||||
|
if (q->internal_session) {
|
||||||
|
MFXClose(q->internal_session);
|
||||||
|
q->internal_session = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = ff_qsv_init_session_device(avctx, &q->internal_session,
|
||||||
|
hw_device_ref, q->load_plugins);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
|
||||||
q->session = q->internal_session;
|
q->session = q->internal_session;
|
||||||
} else {
|
} else {
|
||||||
if (!q->internal_session) {
|
if (!q->internal_session) {
|
||||||
@@ -133,7 +145,7 @@ static int qsv_decode_init(AVCodecContext *avctx, QSVContext *q)
|
|||||||
iopattern = MFX_IOPATTERN_OUT_SYSTEM_MEMORY;
|
iopattern = MFX_IOPATTERN_OUT_SYSTEM_MEMORY;
|
||||||
q->iopattern = iopattern;
|
q->iopattern = iopattern;
|
||||||
|
|
||||||
ret = qsv_init_session(avctx, q, session, avctx->hw_frames_ctx);
|
ret = qsv_init_session(avctx, q, session, avctx->hw_frames_ctx, avctx->hw_device_ctx);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "Error initializing an MFX session\n");
|
av_log(avctx, AV_LOG_ERROR, "Error initializing an MFX session\n");
|
||||||
return ret;
|
return ret;
|
||||||
|
Reference in New Issue
Block a user