Browse Source

lavc: move decoder bsf init into decoder-specific code

tags/n4.4
Anton Khirnov 5 years ago
parent
commit
b006a84a97
3 changed files with 7 additions and 13 deletions
  1. +7
    -1
      libavcodec/decode.c
  2. +0
    -6
      libavcodec/decode.h
  3. +0
    -6
      libavcodec/utils.c

+ 7
- 1
libavcodec/decode.c View File

@@ -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;
}

+ 0
- 6
libavcodec/decode.h View File

@@ -69,12 +69,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


+ 0
- 6
libavcodec/utils.c View File

@@ -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);


Loading…
Cancel
Save