diff options
author | Anton Khirnov <anton@khirnov.net> | 2024-01-10 14:54:34 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2024-01-30 09:52:00 +0100 |
commit | f2a2094c477df952348ea1de79c839e813ca5db3 (patch) | |
tree | 37708987f8057372993ad1afc838bfbff209def2 /fftools/ffmpeg_demux.c | |
parent | d47bb91f8bc67427ee8e4f8855878f19efa6ef38 (diff) | |
download | ffmpeg-f2a2094c477df952348ea1de79c839e813ca5db3.tar.gz |
fftools/ffmpeg: make decoding AVCodecContext private to the decoder
Diffstat (limited to 'fftools/ffmpeg_demux.c')
-rw-r--r-- | fftools/ffmpeg_demux.c | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c index 16d4f67e59..8e904d2150 100644 --- a/fftools/ffmpeg_demux.c +++ b/fftools/ffmpeg_demux.c @@ -825,7 +825,6 @@ static void ist_free(InputStream **pist) av_freep(&ist->outputs); av_freep(&ist->hwaccel_device); - avcodec_free_context(&ist->dec_ctx); avcodec_parameters_free(&ist->par); av_bsf_free(&ds->bsf); @@ -886,16 +885,6 @@ static int ist_use(InputStream *ist, int decoding_needed) if (decoding_needed && ds->sch_idx_dec < 0) { int is_audio = ist->st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO; - ist->dec_ctx = avcodec_alloc_context3(ist->dec); - if (!ist->dec_ctx) - return AVERROR(ENOMEM); - - ret = avcodec_parameters_to_context(ist->dec_ctx, ist->par); - if (ret < 0) { - av_log(ist, AV_LOG_ERROR, "Error initializing the decoder context.\n"); - return ret; - } - ret = sch_add_dec(d->sch, decoder_thread, ist, d->loop && is_audio); if (ret < 0) return ret; @@ -950,12 +939,11 @@ int ist_filter_add(InputStream *ist, InputFilter *ifilter, int is_simple) ist->filters[ist->nb_filters - 1] = ifilter; - // initialize fallback parameters for filtering - ret = ifilter_parameters_from_dec(ifilter, ist->dec_ctx); + ret = dec_add_filter(ist->decoder, ifilter); if (ret < 0) return ret; - if (ist->dec_ctx->codec_type == AVMEDIA_TYPE_SUBTITLE) { + if (ist->par->codec_type == AVMEDIA_TYPE_SUBTITLE) { if (!d->pkt_heartbeat) { d->pkt_heartbeat = av_packet_alloc(); if (!d->pkt_heartbeat) |