[FFmpeg-devel] [PATCH] lavfi, ffmpeg: simplify filter names.

Nicolas George george at nsup.org
Sat Dec 24 11:52:31 EET 2016


The names are only used for technical output and debugging.
Make them similar to C identifiers for easier quick reading
of debug dumps.

Signed-off-by: Nicolas George <george at nsup.org>
---
 ffmpeg_filter.c             | 24 ++++++++++++------------
 libavfilter/avfiltergraph.c |  6 +++---
 2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/ffmpeg_filter.c b/ffmpeg_filter.c
index 006401476e..7782bcce67 100644
--- a/ffmpeg_filter.c
+++ b/ffmpeg_filter.c
@@ -422,7 +422,7 @@ static int configure_output_video_filter(FilterGraph *fg, OutputFilter *ofilter,
     int ret;
     char name[255];
 
-    snprintf(name, sizeof(name), "output stream %d:%d", ost->file_index, ost->index);
+    snprintf(name, sizeof(name), "out_%d_%d", ost->file_index, ost->index);
     ret = avfilter_graph_create_filter(&ofilter->filter,
                                        avfilter_get_by_name("buffersink"),
                                        name, NULL, NULL, fg->graph);
@@ -443,7 +443,7 @@ static int configure_output_video_filter(FilterGraph *fg, OutputFilter *ofilter,
             av_strlcatf(args, sizeof(args), ":%s=%s", e->key, e->value);
         }
 
-        snprintf(name, sizeof(name), "scaler for output stream %d:%d",
+        snprintf(name, sizeof(name), "scaler_out_%d_%d",
                  ost->file_index, ost->index);
         if ((ret = avfilter_graph_create_filter(&filter, avfilter_get_by_name("scale"),
                                                 name, args, NULL, fg->graph)) < 0)
@@ -457,7 +457,7 @@ static int configure_output_video_filter(FilterGraph *fg, OutputFilter *ofilter,
 
     if ((pix_fmts = choose_pix_fmts(ofilter))) {
         AVFilterContext *filter;
-        snprintf(name, sizeof(name), "pixel format for output stream %d:%d",
+        snprintf(name, sizeof(name), "format_out_%d_%d",
                  ost->file_index, ost->index);
         ret = avfilter_graph_create_filter(&filter,
                                            avfilter_get_by_name("format"),
@@ -478,7 +478,7 @@ static int configure_output_video_filter(FilterGraph *fg, OutputFilter *ofilter,
 
         snprintf(args, sizeof(args), "fps=%d/%d", ost->frame_rate.num,
                  ost->frame_rate.den);
-        snprintf(name, sizeof(name), "fps for output stream %d:%d",
+        snprintf(name, sizeof(name), "fps_out_%d_%d",
                  ost->file_index, ost->index);
         ret = avfilter_graph_create_filter(&fps, avfilter_get_by_name("fps"),
                                            name, args, NULL, fg->graph);
@@ -492,7 +492,7 @@ static int configure_output_video_filter(FilterGraph *fg, OutputFilter *ofilter,
         pad_idx = 0;
     }
 
-    snprintf(name, sizeof(name), "trim for output stream %d:%d",
+    snprintf(name, sizeof(name), "trim_out_%d_%d",
              ost->file_index, ost->index);
     ret = insert_trim(of->start_time, of->recording_time,
                       &last_filter, &pad_idx, name);
@@ -517,7 +517,7 @@ static int configure_output_audio_filter(FilterGraph *fg, OutputFilter *ofilter,
     char name[255];
     int ret;
 
-    snprintf(name, sizeof(name), "output stream %d:%d", ost->file_index, ost->index);
+    snprintf(name, sizeof(name), "out_%d_%d", ost->file_index, ost->index);
     ret = avfilter_graph_create_filter(&ofilter->filter,
                                        avfilter_get_by_name("abuffersink"),
                                        name, NULL, NULL, fg->graph);
@@ -584,7 +584,7 @@ static int configure_output_audio_filter(FilterGraph *fg, OutputFilter *ofilter,
         av_freep(&sample_rates);
         av_freep(&channel_layouts);
 
-        snprintf(name, sizeof(name), "audio format for output stream %d:%d",
+        snprintf(name, sizeof(name), "format_out_%d_%d",
                  ost->file_index, ost->index);
         ret = avfilter_graph_create_filter(&format,
                                            avfilter_get_by_name("aformat"),
@@ -792,7 +792,7 @@ static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter,
     if (ist->framerate.num) {
         AVFilterContext *setpts;
 
-        snprintf(name, sizeof(name), "force CFR for input from stream %d:%d",
+        snprintf(name, sizeof(name), "forcecfr_in_%d_%d",
                  ist->file_index, ist->st->index);
         if ((ret = avfilter_graph_create_filter(&setpts,
                                                 avfilter_get_by_name("setpts"),
@@ -809,7 +809,7 @@ static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter,
     if (do_deinterlace) {
         AVFilterContext *yadif;
 
-        snprintf(name, sizeof(name), "deinterlace input from stream %d:%d",
+        snprintf(name, sizeof(name), "deinterlace_in_%d_%d",
                  ist->file_index, ist->st->index);
         if ((ret = avfilter_graph_create_filter(&yadif,
                                                 avfilter_get_by_name("yadif"),
@@ -823,7 +823,7 @@ static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter,
         last_filter = yadif;
     }
 
-    snprintf(name, sizeof(name), "trim for input stream %d:%d",
+    snprintf(name, sizeof(name), "trim_in_%d_%d",
              ist->file_index, ist->st->index);
     if (copy_ts) {
         tsoffset = f->start_time == AV_NOPTS_VALUE ? 0 : f->start_time;
@@ -872,7 +872,7 @@ static int configure_input_audio_filter(FilterGraph *fg, InputFilter *ifilter,
                    ifilter->channel_layout);
     else
         av_bprintf(&args, ":channels=%d", ifilter->channels);
-    snprintf(name, sizeof(name), "graph %d input from stream %d:%d", fg->index,
+    snprintf(name, sizeof(name), "graph_%d_in_%d_%d", fg->index,
              ist->file_index, ist->st->index);
 
     if ((ret = avfilter_graph_create_filter(&ifilter->filter, abuffer_filt,
@@ -887,7 +887,7 @@ static int configure_input_audio_filter(FilterGraph *fg, InputFilter *ifilter,
     av_log(NULL, AV_LOG_INFO, opt_name " is forwarded to lavfi "            \
            "similarly to -af " filter_name "=%s.\n", arg);                  \
                                                                             \
-    snprintf(name, sizeof(name), "graph %d %s for input stream %d:%d",      \
+    snprintf(name, sizeof(name), "graph_%d_%s_in_%d_%d",      \
                 fg->index, filter_name, ist->file_index, ist->st->index);   \
     ret = avfilter_graph_create_filter(&filt_ctx,                           \
                                        avfilter_get_by_name(filter_name),   \
diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c
index cb5d618ab1..6670a4f2c8 100644
--- a/libavfilter/avfiltergraph.c
+++ b/libavfilter/avfiltergraph.c
@@ -528,7 +528,7 @@ static int query_formats(AVFilterGraph *graph, AVClass *log_ctx)
                         return AVERROR(EINVAL);
                     }
 
-                    snprintf(inst_name, sizeof(inst_name), "auto-inserted scaler %d",
+                    snprintf(inst_name, sizeof(inst_name), "auto_scaler_%d",
                              scaler_count++);
 
                     if ((ret = avfilter_graph_create_filter(&convert, filter,
@@ -543,7 +543,7 @@ static int query_formats(AVFilterGraph *graph, AVClass *log_ctx)
                         return AVERROR(EINVAL);
                     }
 
-                    snprintf(inst_name, sizeof(inst_name), "auto-inserted resampler %d",
+                    snprintf(inst_name, sizeof(inst_name), "auto_resampler_%d",
                              resampler_count++);
                     scale_args[0] = '\0';
                     if (graph->aresample_swr_opts)
@@ -1240,7 +1240,7 @@ static int graph_insert_fifos(AVFilterGraph *graph, AVClass *log_ctx)
                    avfilter_get_by_name("fifo") :
                    avfilter_get_by_name("afifo");
 
-            snprintf(name, sizeof(name), "auto-inserted fifo %d", fifo_count++);
+            snprintf(name, sizeof(name), "auto_fifo_%d", fifo_count++);
 
             ret = avfilter_graph_create_filter(&fifo_ctx, fifo, name, NULL,
                                                NULL, graph);
-- 
2.11.0



More information about the ffmpeg-devel mailing list