summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2023-04-28 11:48:04 +0200
committerAnton Khirnov <anton@khirnov.net>2023-05-05 18:12:49 +0200
commit5c9f8048e1343ee6e58feb296dc8dc68e4f91e3a (patch)
tree4a78f267fdf23b21942d190a9b1525e3d333b062
parented9fc6f20dbe8f46e82179678ead55296580390c (diff)
lavc/decode: stop duplicating code from hwaccel_uninit()
-rw-r--r--libavcodec/avcodec.c5
-rw-r--r--libavcodec/decode.c4
-rw-r--r--libavcodec/hwconfig.h1
3 files changed, 5 insertions, 5 deletions
diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c
index 5a96899d50..db8226f9b3 100644
--- a/libavcodec/avcodec.c
+++ b/libavcodec/avcodec.c
@@ -39,6 +39,7 @@
#include "decode.h"
#include "encode.h"
#include "frame_thread_encoder.h"
+#include "hwconfig.h"
#include "internal.h"
#include "thread.h"
@@ -459,9 +460,7 @@ av_cold int avcodec_close(AVCodecContext *avctx)
av_buffer_unref(&avci->pool);
- if (avctx->hwaccel && avctx->hwaccel->uninit)
- avctx->hwaccel->uninit(avctx);
- av_freep(&avci->hwaccel_priv_data);
+ ff_hwaccel_uninit(avctx);
av_bsf_free(&avci->bsf);
diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index f66dda0907..bc29812899 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -1152,7 +1152,7 @@ static int hwaccel_init(AVCodecContext *avctx,
return 0;
}
-static void hwaccel_uninit(AVCodecContext *avctx)
+void ff_hwaccel_uninit(AVCodecContext *avctx)
{
if (avctx->hwaccel && avctx->hwaccel->uninit)
avctx->hwaccel->uninit(avctx);
@@ -1191,7 +1191,7 @@ int ff_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt)
for (;;) {
// Remove the previous hwaccel, if there was one.
- hwaccel_uninit(avctx);
+ ff_hwaccel_uninit(avctx);
user_choice = avctx->get_format(avctx, choices);
if (user_choice == AV_PIX_FMT_NONE) {
diff --git a/libavcodec/hwconfig.h b/libavcodec/hwconfig.h
index 721424912c..f03b744cdf 100644
--- a/libavcodec/hwconfig.h
+++ b/libavcodec/hwconfig.h
@@ -39,6 +39,7 @@ typedef struct AVCodecHWConfigInternal {
const AVHWAccel *hwaccel;
} AVCodecHWConfigInternal;
+void ff_hwaccel_uninit(AVCodecContext *avctx);
// These macros are used to simplify AVCodecHWConfigInternal definitions.