summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2023-04-28 11:33:38 +0200
committerAnton Khirnov <anton@khirnov.net>2023-05-05 18:12:49 +0200
commited9fc6f20dbe8f46e82179678ead55296580390c (patch)
tree0a1c22582f78d3676789657cffac259048292a80
parent60ecf44b037c7961ac4e69f83ff315c11c5df922 (diff)
lavc/decode: pass AVHWAccel instead of AVCodecHWConfigInternal to hwaccel_init()
The only thing besides the hwaccel that this function uses from AVCodecHWConfigInternal is the pixel format, which should always match the hwaccel one. Will be useful in following commits.
-rw-r--r--libavcodec/decode.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 4f2359f07e..f66dda0907 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -1118,12 +1118,10 @@ int avcodec_get_hw_frames_parameters(AVCodecContext *avctx,
}
static int hwaccel_init(AVCodecContext *avctx,
- const AVCodecHWConfigInternal *hw_config)
+ const AVHWAccel *hwaccel)
{
- const AVHWAccel *hwaccel;
int err;
- hwaccel = hw_config->hwaccel;
if (hwaccel->capabilities & AV_HWACCEL_CODEC_CAP_EXPERIMENTAL &&
avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) {
av_log(avctx, AV_LOG_WARNING, "Ignoring experimental hwaccel: %s\n",
@@ -1144,7 +1142,7 @@ static int hwaccel_init(AVCodecContext *avctx,
if (err < 0) {
av_log(avctx, AV_LOG_ERROR, "Failed setup for format %s: "
"hwaccel initialisation returned error.\n",
- av_get_pix_fmt_name(hw_config->public.pix_fmt));
+ av_get_pix_fmt_name(hwaccel->pix_fmt));
av_freep(&avctx->internal->hwaccel_priv_data);
avctx->hwaccel = NULL;
return err;
@@ -1278,7 +1276,7 @@ int ff_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt)
if (hw_config->hwaccel) {
av_log(avctx, AV_LOG_DEBUG, "Format %s requires hwaccel "
"initialisation.\n", desc->name);
- err = hwaccel_init(avctx, hw_config);
+ err = hwaccel_init(avctx, hw_config->hwaccel);
if (err < 0)
goto try_again;
}