diff mbox series

[FFmpeg-devel,12/25] fftools/ffmpeg_mux_init: drop OutputStream.filters[_script]

Message ID 20230419195243.2974-12-anton@khirnov.net
State Accepted
Commit ecb44ca8777c0323c4ed00f64465a4072188c959
Headers show
Series [FFmpeg-devel,01/25] fftools/ffmpeg_filter: drop write-only FilterGraph.reconfiguration | expand

Checks

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

Commit Message

Anton Khirnov April 19, 2023, 7:52 p.m. UTC
They are not needed outside of ost_get_filters(), so make them stack
variables there.
---
 fftools/ffmpeg.h          |  2 --
 fftools/ffmpeg_mux_init.c | 28 +++++++++++++++-------------
 2 files changed, 15 insertions(+), 15 deletions(-)
diff mbox series

Patch

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