summaryrefslogtreecommitdiff
path: root/fftools/ffmpeg_mux.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2023-04-13 14:22:28 +0200
committerAnton Khirnov <anton@khirnov.net>2023-04-17 12:01:40 +0200
commita34f483291e5e635e55e0d326c23bb8c352852c3 (patch)
tree27c3a3e91bdb705c802f7e0ec85ae73a2ab5dcaa /fftools/ffmpeg_mux.c
parenta064aed4c37836468f4156e6b3aaf150a626fa50 (diff)
downloadffmpeg-a34f483291e5e635e55e0d326c23bb8c352852c3.tar.gz
fftools/ffmpeg: add muxer-input codec parameters to OutputStream
It stores codec parameters of the stream submitted to the muxer, which may be different from the codec parameters in AVStream due to bitstream filtering. This avoids the confusing back and forth synchronisation between the encoder, bitstream filters, and the muxer, now information flows only in one direction. It also reduces the need for non-muxing code to access AVStream.
Diffstat (limited to 'fftools/ffmpeg_mux.c')
-rw-r--r--fftools/ffmpeg_mux.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/fftools/ffmpeg_mux.c b/fftools/ffmpeg_mux.c
index eb64d8c3ff..40b439eea2 100644
--- a/fftools/ffmpeg_mux.c
+++ b/fftools/ffmpeg_mux.c
@@ -556,9 +556,9 @@ static int bsf_init(MuxStream *ms)
int ret;
if (!ctx)
- return 0;
+ return avcodec_parameters_copy(ost->st->codecpar, ost->par_in);
- ret = avcodec_parameters_copy(ctx->par_in, ost->st->codecpar);
+ ret = avcodec_parameters_copy(ctx->par_in, ost->par_in);
if (ret < 0)
return ret;
@@ -768,6 +768,8 @@ static void ost_free(OutputStream **post)
av_fifo_freep2(&ms->muxing_queue);
}
+ avcodec_parameters_free(&ost->par_in);
+
av_bsf_free(&ms->bsf_ctx);
av_frame_free(&ost->filtered_frame);