[FFmpeg-cvslog] fftools/ffmpeg_filter: remove remaining OutputStream usage in init_simple_filtergraph()
Anton Khirnov
git at videolan.org
Thu Sep 26 19:33:26 EEST 2024
ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Thu Sep 12 18:49:27 2024 +0200| [d103b61cd84990b0dfce52315b18fdeaffa64f05] | committer: Anton Khirnov
fftools/ffmpeg_filter: remove remaining OutputStream usage in init_simple_filtergraph()
With this, nothing in ffmpeg_filter acesses OutputStream anymore, thus
there are no more direct ties between filtering and muxing.
Rename init_simple_filtergraph() to fg_create_simple() for consistency.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d103b61cd84990b0dfce52315b18fdeaffa64f05
---
fftools/ffmpeg.h | 9 +++++----
fftools/ffmpeg_filter.c | 22 +++++++++++-----------
fftools/ffmpeg_mux_init.c | 7 +++++--
3 files changed, 21 insertions(+), 17 deletions(-)
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index d20034efb0..b5c95439e5 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -755,10 +755,11 @@ int find_codec(void *logctx, const char *name,
int parse_and_set_vsync(const char *arg, int *vsync_var, int file_idx, int st_idx, int is_global);
int filtergraph_is_simple(const FilterGraph *fg);
-int init_simple_filtergraph(InputStream *ist, OutputStream *ost,
- char *graph_desc,
- Scheduler *sch, unsigned sch_idx_enc,
- const OutputFilterOptions *opts);
+int fg_create_simple(FilterGraph **pfg,
+ InputStream *ist,
+ char *graph_desc,
+ Scheduler *sch, unsigned sched_idx_enc,
+ const OutputFilterOptions *opts);
int fg_finalise_bindings(void);
/**
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index f785252be6..463245d9b0 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -1180,25 +1180,27 @@ fail:
return 0;
}
-int init_simple_filtergraph(InputStream *ist, OutputStream *ost,
- char *graph_desc,
- Scheduler *sch, unsigned sched_idx_enc,
- const OutputFilterOptions *opts)
+int fg_create_simple(FilterGraph **pfg,
+ InputStream *ist,
+ char *graph_desc,
+ Scheduler *sch, unsigned sched_idx_enc,
+ const OutputFilterOptions *opts)
{
+ const enum AVMediaType type = ist->par->codec_type;
FilterGraph *fg;
FilterGraphPriv *fgp;
int ret;
- ret = fg_create(&ost->fg_simple, graph_desc, sch);
+ ret = fg_create(pfg, graph_desc, sch);
if (ret < 0)
return ret;
- fg = ost->fg_simple;
+ fg = *pfg;
fgp = fgp_from_fg(fg);
fgp->is_simple = 1;
snprintf(fgp->log_name, sizeof(fgp->log_name), "%cf%s",
- av_get_media_type_string(ost->type)[0], opts->name);
+ av_get_media_type_string(type)[0], opts->name);
if (fg->nb_inputs != 1 || fg->nb_outputs != 1) {
av_log(fg, AV_LOG_ERROR, "Simple filtergraph '%s' was expected "
@@ -1208,16 +1210,14 @@ int init_simple_filtergraph(InputStream *ist, OutputStream *ost,
graph_desc, fg->nb_inputs, fg->nb_outputs);
return AVERROR(EINVAL);
}
- if (fg->outputs[0]->type != ost->type) {
+ if (fg->outputs[0]->type != type) {
av_log(fg, AV_LOG_ERROR, "Filtergraph has a %s output, cannot connect "
"it to %s output stream\n",
av_get_media_type_string(fg->outputs[0]->type),
- av_get_media_type_string(ost->type));
+ av_get_media_type_string(type));
return AVERROR(EINVAL);
}
- ost->filter = fg->outputs[0];
-
ret = ifilter_bind_ist(fg->inputs[0], ist, opts->vs);
if (ret < 0)
return ret;
diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c
index 53a17c33a6..ec9f328e90 100644
--- a/fftools/ffmpeg_mux_init.c
+++ b/fftools/ffmpeg_mux_init.c
@@ -1010,8 +1010,11 @@ ost_bind_filter(const Muxer *mux, MuxStream *ms, OutputFilter *ofilter,
ost->filter = ofilter;
ret = ofilter_bind_enc(ofilter, ms->sch_idx_enc, &opts);
} else {
- ret = init_simple_filtergraph(ost->ist, ost, filters,
- mux->sch, ms->sch_idx_enc, &opts);
+ ret = fg_create_simple(&ost->fg_simple, ost->ist, filters,
+ mux->sch, ms->sch_idx_enc, &opts);
+ if (ret >= 0)
+ ost->filter = ost->fg_simple->outputs[0];
+
}
av_freep(&opts.nb_threads);
if (ret < 0)
More information about the ffmpeg-cvslog
mailing list