lavc/decode: stop duplicating code from hwaccel_uninit()

pull/389/head
Anton Khirnov 2 years ago committed by Lynne
parent a4611e3170
commit 3d2e1aa324
No known key found for this signature in database
GPG Key ID: A2FEA5F03F034464
  1. 5
      libavcodec/avcodec.c
  2. 4
      libavcodec/decode.c
  3. 1
      libavcodec/hwconfig.h

@ -39,6 +39,7 @@
#include "decode.h" #include "decode.h"
#include "encode.h" #include "encode.h"
#include "frame_thread_encoder.h" #include "frame_thread_encoder.h"
#include "hwconfig.h"
#include "internal.h" #include "internal.h"
#include "thread.h" #include "thread.h"
@ -459,9 +460,7 @@ av_cold int avcodec_close(AVCodecContext *avctx)
av_buffer_unref(&avci->pool); av_buffer_unref(&avci->pool);
if (avctx->hwaccel && avctx->hwaccel->uninit) ff_hwaccel_uninit(avctx);
avctx->hwaccel->uninit(avctx);
av_freep(&avci->hwaccel_priv_data);
av_bsf_free(&avci->bsf); av_bsf_free(&avci->bsf);

@ -1145,7 +1145,7 @@ static int hwaccel_init(AVCodecContext *avctx,
return 0; return 0;
} }
static void hwaccel_uninit(AVCodecContext *avctx) void ff_hwaccel_uninit(AVCodecContext *avctx)
{ {
if (avctx->hwaccel && avctx->hwaccel->uninit) if (avctx->hwaccel && avctx->hwaccel->uninit)
avctx->hwaccel->uninit(avctx); avctx->hwaccel->uninit(avctx);
@ -1184,7 +1184,7 @@ int ff_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt)
for (;;) { for (;;) {
// Remove the previous hwaccel, if there was one. // Remove the previous hwaccel, if there was one.
hwaccel_uninit(avctx); ff_hwaccel_uninit(avctx);
user_choice = avctx->get_format(avctx, choices); user_choice = avctx->get_format(avctx, choices);
if (user_choice == AV_PIX_FMT_NONE) { if (user_choice == AV_PIX_FMT_NONE) {

@ -39,6 +39,7 @@ typedef struct AVCodecHWConfigInternal {
const AVHWAccel *hwaccel; const AVHWAccel *hwaccel;
} AVCodecHWConfigInternal; } AVCodecHWConfigInternal;
void ff_hwaccel_uninit(AVCodecContext *avctx);
// These macros are used to simplify AVCodecHWConfigInternal definitions. // These macros are used to simplify AVCodecHWConfigInternal definitions.

Loading…
Cancel
Save