diff options
author | Haihao Xiang <haihao.xiang@intel.com> | 2024-05-08 14:03:13 +0800 |
---|---|---|
committer | Haihao Xiang <haihao.xiang@intel.com> | 2024-05-20 09:30:49 +0800 |
commit | 75015f9b0e0ef203bd051ef01bf2cb18710b8379 (patch) | |
tree | eefb21d61af00c8348ad063073ac22179cbe0ec2 /libavcodec | |
parent | cda721e01de571cd4004b8710526e3d2b47f6fd0 (diff) | |
download | ffmpeg-75015f9b0e0ef203bd051ef01bf2cb18710b8379.tar.gz |
lavc/qsvenc: use the right info for encoding
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/qsvenc.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index d881c11160..3df355ce78 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -745,8 +745,9 @@ static int init_video_param_jpeg(AVCodecContext *avctx, QSVEncContext *q) if (avctx->hw_frames_ctx) { AVHWFramesContext *frames_ctx = (AVHWFramesContext *)avctx->hw_frames_ctx->data; AVQSVFramesContext *frames_hwctx = frames_ctx->hwctx; - q->param.mfx.FrameInfo.Width = frames_hwctx->surfaces[0].Info.Width; - q->param.mfx.FrameInfo.Height = frames_hwctx->surfaces[0].Info.Height; + mfxFrameInfo *info = frames_hwctx->nb_surfaces ? &frames_hwctx->surfaces[0].Info : frames_hwctx->info; + q->param.mfx.FrameInfo.Width = info->Width; + q->param.mfx.FrameInfo.Height = info->Height; } if (avctx->framerate.den > 0 && avctx->framerate.num > 0) { @@ -869,8 +870,9 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q) if (avctx->hw_frames_ctx) { AVHWFramesContext *frames_ctx = (AVHWFramesContext*)avctx->hw_frames_ctx->data; AVQSVFramesContext *frames_hwctx = frames_ctx->hwctx; - q->param.mfx.FrameInfo.Width = frames_hwctx->surfaces[0].Info.Width; - q->param.mfx.FrameInfo.Height = frames_hwctx->surfaces[0].Info.Height; + mfxFrameInfo *info = frames_hwctx->nb_surfaces ? &frames_hwctx->surfaces[0].Info : frames_hwctx->info; + q->param.mfx.FrameInfo.Width = info->Width; + q->param.mfx.FrameInfo.Height = info->Height; } if (avctx->framerate.den > 0 && avctx->framerate.num > 0) { |