summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2021-03-09 12:00:09 +0100
committerAnton Khirnov <anton@khirnov.net>2021-03-16 11:09:44 +0100
commitb006a84a97e7c8131a9e561d6c642edef6215977 (patch)
treeb223374fca5397481e759c37c314f711cedc9e28 /libavcodec
parent20aec597d05f1930dbd4e4c5ab8ee837dea5b5f3 (diff)
lavc: move decoder bsf init into decoder-specific code
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/decode.c8
-rw-r--r--libavcodec/decode.h6
-rw-r--r--libavcodec/utils.c6
3 files changed, 7 insertions, 13 deletions
diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index c8e9be3a13..5a00aeedae 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -185,7 +185,7 @@ static int extract_packet_props(AVCodecInternal *avci, const AVPacket *pkt)
return 0;
}
-int ff_decode_bsfs_init(AVCodecContext *avctx)
+static int decode_bsfs_init(AVCodecContext *avctx)
{
AVCodecInternal *avci = avctx->internal;
int ret;
@@ -2007,6 +2007,8 @@ int ff_reget_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
int ff_decode_preinit(AVCodecContext *avctx)
{
+ int ret = 0;
+
/* if the decoder init function was already called previously,
* free the already allocated subtitle_header before overwriting it */
av_freep(&avctx->subtitle_header);
@@ -2043,5 +2045,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
avctx->export_side_data |= AV_CODEC_EXPORT_DATA_MVS;
}
+ ret = decode_bsfs_init(avctx);
+ if (ret < 0)
+ return ret;
+
return 0;
}
diff --git a/libavcodec/decode.h b/libavcodec/decode.h
index a865fe954f..1467b1eb33 100644
--- a/libavcodec/decode.h
+++ b/libavcodec/decode.h
@@ -70,12 +70,6 @@ int ff_decode_get_packet(AVCodecContext *avctx, AVPacket *pkt);
int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame);
/**
- * Called during avcodec_open2() to initialize avctx->internal->bsf.
- * The bsf should be freed with av_bsf_free().
- */
-int ff_decode_bsfs_init(AVCodecContext *avctx);
-
-/**
* Make sure avctx.hw_frames_ctx is set. If it's not set, the function will
* try to allocate it from hw_device_ctx. If that is not possible, an error
* message is printed, and an error code is returned.
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 3eae531297..c072ca5489 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -730,12 +730,6 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code
goto free_and_end;
}
- if (av_codec_is_decoder(avctx->codec)) {
- ret = ff_decode_bsfs_init(avctx);
- if (ret < 0)
- goto free_and_end;
- }
-
if (HAVE_THREADS
&& !(avci->frame_thread_encoder && (avctx->active_thread_type&FF_THREAD_FRAME))) {
ret = ff_thread_init(avctx);