From f295b4d8a0a1726157b4404c9cdd9a03aa7f171d Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 24 Sep 2024 09:35:56 +0200 Subject: [PATCH] fftools/ffmpeg_demux: drop ist_output_add() It is now a trivial wrapper over ist_use(), so export that directly. --- fftools/ffmpeg.h | 3 ++- fftools/ffmpeg_demux.c | 17 ++--------------- fftools/ffmpeg_mux_init.c | 17 +++++++++-------- 3 files changed, 13 insertions(+), 24 deletions(-) diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index 13e0fd14cd..d12b0e0d88 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -870,7 +870,8 @@ int64_t of_filesize(OutputFile *of); int ifile_open(const OptionsContext *o, const char *filename, Scheduler *sch); void ifile_close(InputFile **f); -int ist_output_add(InputStream *ist, OutputStream *ost); +int ist_use(InputStream *ist, int decoding_needed, + const ViewSpecifier *vs, SchedulerNode *src); int ist_filter_add(InputStream *ist, InputFilter *ifilter, int is_simple, const ViewSpecifier *vs, InputFilterOptions *opts, SchedulerNode *src); diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c index 9a3ae67e3a..364f148f60 100644 --- a/fftools/ffmpeg_demux.c +++ b/fftools/ffmpeg_demux.c @@ -873,8 +873,8 @@ void ifile_close(InputFile **pf) av_freep(pf); } -static int ist_use(InputStream *ist, int decoding_needed, - const ViewSpecifier *vs, SchedulerNode *src) +int ist_use(InputStream *ist, int decoding_needed, + const ViewSpecifier *vs, SchedulerNode *src) { Demuxer *d = demuxer_from_ifile(ist->file); DemuxStream *ds = ds_from_ist(ist); @@ -974,19 +974,6 @@ static int ist_use(InputStream *ist, int decoding_needed, return 0; } -int ist_output_add(InputStream *ist, OutputStream *ost) -{ - DemuxStream *ds = ds_from_ist(ist); - SchedulerNode src; - int ret; - - ret = ist_use(ist, ost->enc ? DECODING_FOR_OST : 0, NULL, &src); - if (ret < 0) - return ret; - - return ost->enc ? ds->sch_idx_dec : ds->sch_idx_stream; -} - int ist_filter_add(InputStream *ist, InputFilter *ifilter, int is_simple, const ViewSpecifier *vs, InputFilterOptions *opts, SchedulerNode *src) diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c index ec9f328e90..2541be59da 100644 --- a/fftools/ffmpeg_mux_init.c +++ b/fftools/ffmpeg_mux_init.c @@ -1537,18 +1537,19 @@ static int ost_add(Muxer *mux, const OptionsContext *o, enum AVMediaType type, if (ret < 0) goto fail; } else if (ost->ist) { - int sched_idx = ist_output_add(ost->ist, ost); - if (sched_idx < 0) { + SchedulerNode src; + + ret = ist_use(ost->ist, !!ost->enc, NULL, &src); + if (ret < 0) { av_log(ost, AV_LOG_ERROR, "Error binding an input stream\n"); - ret = sched_idx; goto fail; } - ms->sch_idx_src = sched_idx; + ms->sch_idx_src = src.idx; if (ost->enc) { - ret = sch_connect(mux->sch, SCH_DEC_OUT(sched_idx, 0), - SCH_ENC(ms->sch_idx_enc)); + ret = sch_connect(mux->sch, + src, SCH_ENC(ms->sch_idx_enc)); if (ret < 0) goto fail; @@ -1557,8 +1558,8 @@ static int ost_add(Muxer *mux, const OptionsContext *o, enum AVMediaType type, if (ret < 0) goto fail; } else { - ret = sch_connect(mux->sch, SCH_DSTREAM(ost->ist->file->index, sched_idx), - SCH_MSTREAM(ost->file->index, ms->sch_idx)); + ret = sch_connect(mux->sch, + src, SCH_MSTREAM(ost->file->index, ms->sch_idx)); if (ret < 0) goto fail; }