[FFmpeg-cvslog] fftools/ffmpeg_mux_init: drop OutputStream.filters[_script]

Anton Khirnov git at videolan.org
Mon Apr 24 18:03:08 EEST 2023


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Tue Apr 18 10:36:38 2023 +0200| [ecb44ca8777c0323c4ed00f64465a4072188c959] | committer: Anton Khirnov

fftools/ffmpeg_mux_init: drop OutputStream.filters[_script]

They are not needed outside of ost_get_filters(), so make them stack
variables there.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ecb44ca8777c0323c4ed00f64465a4072188c959
---

 fftools/ffmpeg.h          |  2 --
 fftools/ffmpeg_mux_init.c | 28 +++++++++++++++-------------
 2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 72020c8f3a..c9d499efdd 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -639,8 +639,6 @@ typedef struct OutputStream {
 
     OutputFilter *filter;
     char *avfilter;
-    char *filters;         ///< filtergraph associated to the -filter option
-    char *filters_script;  ///< filtergraph script associated to the -filter_script option
 
     AVDictionary *encoder_opts;
     AVDictionary *sws_dict;
diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c
index c82556a706..da3dccd6d7 100644
--- a/fftools/ffmpeg_mux_init.c
+++ b/fftools/ffmpeg_mux_init.c
@@ -423,43 +423,45 @@ static MuxStream *mux_stream_alloc(Muxer *mux, enum AVMediaType type)
 static int ost_get_filters(const OptionsContext *o, AVFormatContext *oc,
                            OutputStream *ost)
 {
-    MATCH_PER_STREAM_OPT(filter_scripts, str, ost->filters_script, oc, ost->st);
-    MATCH_PER_STREAM_OPT(filters,        str, ost->filters,        oc, ost->st);
+    const char *filters = NULL, *filters_script = NULL;
+
+    MATCH_PER_STREAM_OPT(filter_scripts, str, filters_script, oc, ost->st);
+    MATCH_PER_STREAM_OPT(filters,        str, filters,        oc, ost->st);
 
     if (!ost->enc) {
-        if (ost->filters_script || ost->filters) {
+        if (filters_script || filters) {
             av_log(ost, AV_LOG_ERROR,
                    "%s '%s' was specified, but codec copy was selected. "
                    "Filtering and streamcopy cannot be used together.\n",
-                   ost->filters ? "Filtergraph" : "Filtergraph script",
-                   ost->filters ? ost->filters : ost->filters_script);
+                   filters ? "Filtergraph" : "Filtergraph script",
+                   filters ? filters : filters_script);
             return AVERROR(ENOSYS);
         }
         return 0;
     }
 
     if (!ost->ist) {
-        if (ost->filters_script || ost->filters) {
+        if (filters_script || filters) {
             av_log(ost, AV_LOG_ERROR,
                    "%s '%s' was specified for a stream fed from a complex "
                    "filtergraph. Simple and complex filtering cannot be used "
                    "together for the same stream.\n",
-                   ost->filters ? "Filtergraph" : "Filtergraph script",
-                   ost->filters ? ost->filters : ost->filters_script);
+                   filters ? "Filtergraph" : "Filtergraph script",
+                   filters ? filters : filters_script);
             return AVERROR(EINVAL);
         }
         return 0;
     }
 
-    if (ost->filters_script && ost->filters) {
+    if (filters_script && filters) {
         av_log(ost, AV_LOG_ERROR, "Both -filter and -filter_script set\n");
         exit_program(1);
     }
 
-    if (ost->filters_script)
-        ost->avfilter = file_read(ost->filters_script);
-    else if (ost->filters)
-        ost->avfilter = av_strdup(ost->filters);
+    if (filters_script)
+        ost->avfilter = file_read(filters_script);
+    else if (filters)
+        ost->avfilter = av_strdup(filters);
     else
         ost->avfilter = av_strdup(ost->type == AVMEDIA_TYPE_VIDEO ? "null" : "anull");
     return ost->avfilter ? 0 : AVERROR(ENOMEM);



More information about the ffmpeg-cvslog mailing list