diff options
author | Anton Khirnov <anton@khirnov.net> | 2022-10-13 15:24:33 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2022-10-18 13:57:43 +0200 |
commit | 36ce335d46151b477404caeec38ddbc20c112304 (patch) | |
tree | 76b59d1b537c3a23222a3049756d95b5e768bcc8 /fftools/ffmpeg_mux.c | |
parent | a55ca682e2c74a48bae0c1b76418a8fe0ac97733 (diff) | |
download | ffmpeg-36ce335d46151b477404caeec38ddbc20c112304.tar.gz |
fftools/ffmpeg_mux: inline of_muxer_init() into of_open()
A separate muxer init is no longer necessary, now that of_open() has
access to Muxer.
Diffstat (limited to 'fftools/ffmpeg_mux.c')
-rw-r--r-- | fftools/ffmpeg_mux.c | 56 |
1 files changed, 5 insertions, 51 deletions
diff --git a/fftools/ffmpeg_mux.c b/fftools/ffmpeg_mux.c index 4c56f4ba96..2f71e03144 100644 --- a/fftools/ffmpeg_mux.c +++ b/fftools/ffmpeg_mux.c @@ -38,7 +38,7 @@ #include "libavformat/avformat.h" #include "libavformat/avio.h" -static int want_sdp = 1; +int want_sdp = 1; static Muxer *mux_from_of(OutputFile *of) { @@ -487,9 +487,9 @@ fail: return ret; } -static int mux_check_init(OutputFile *of) +int mux_check_init(Muxer *mux) { - Muxer *mux = mux_from_of(of); + OutputFile *of = &mux->of; AVFormatContext *fc = mux->fc; int ret, i; @@ -538,12 +538,13 @@ static int mux_check_init(OutputFile *of) int of_stream_init(OutputFile *of, OutputStream *ost) { + Muxer *mux = mux_from_of(of); if (ost->sq_idx_mux >= 0) sq_set_tb(of->sq_mux, ost->sq_idx_mux, ost->mux_timebase); ost->initialized = 1; - return mux_check_init(of); + return mux_check_init(mux); } int of_write_trailer(OutputFile *of) @@ -638,53 +639,6 @@ void of_close(OutputFile **pof) av_freep(pof); } -int of_muxer_init(OutputFile *of, AVFormatContext *fc, - AVDictionary *opts, int64_t limit_filesize, - int thread_queue_size) -{ - Muxer *mux = mux_from_of(of); - int ret = 0; - - mux->streams = av_calloc(fc->nb_streams, sizeof(*mux->streams)); - if (!mux->streams) { - fc_close(&fc); - return AVERROR(ENOMEM); - } - of->nb_streams = fc->nb_streams; - - mux->fc = fc; - - for (int i = 0; i < fc->nb_streams; i++) { - MuxStream *ms = &mux->streams[i]; - ms->muxing_queue = av_fifo_alloc2(8, sizeof(AVPacket*), 0); - if (!ms->muxing_queue) { - ret = AVERROR(ENOMEM); - goto fail; - } - ms->last_mux_dts = AV_NOPTS_VALUE; - } - - mux->thread_queue_size = thread_queue_size > 0 ? thread_queue_size : 8; - mux->limit_filesize = limit_filesize; - mux->opts = opts; - - if (strcmp(of->format->name, "rtp")) - want_sdp = 0; - - /* write the header for files with no streams */ - if (of->format->flags & AVFMT_NOSTREAMS && fc->nb_streams == 0) { - ret = mux_check_init(of); - if (ret < 0) - goto fail; - } - -fail: - if (ret < 0) - mux_free(mux); - - return ret; -} - int64_t of_filesize(OutputFile *of) { Muxer *mux = mux_from_of(of); |