diff mbox series

[FFmpeg-devel,2/9] fftools/ffmpeg_demux: drop ist_output_add()

Message ID 20240928095341.15552-2-anton@khirnov.net
State New
Headers show
Series [FFmpeg-devel,1/9] fftools/ffmpeg_demux: drop InputStream.[nb_]outputs | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Anton Khirnov Sept. 28, 2024, 9:53 a.m. UTC
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 mbox series

Patch

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