]> git.sesse.net Git - ffmpeg/blobdiff - tools/graph2dot.c
audioconvert: K&R whitespace cosmetics
[ffmpeg] / tools / graph2dot.c
index 57a25a73cb1ba45f9ca710a7690c4064c0aa45b8..5ec6e204f7568852610da3c357c15f2b167f6a29 100644 (file)
@@ -1,20 +1,20 @@
 /*
  * Copyright (c) 2008-2010 Stefano Sabatini
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -22,7 +22,8 @@
 
 #undef HAVE_AV_CONFIG_H
 #include "libavutil/pixdesc.h"
-#include "libavfilter/graphparser.h"
+#include "libavutil/audioconvert.h"
+#include "libavfilter/avfiltergraph.h"
 
 static void usage(void)
 {
@@ -67,8 +68,18 @@ static void print_digraph(FILE *outfile, AVFilterGraph *graph)
                          dst_filter_ctx->filter->name);
 
                 fprintf(outfile, "\"%s\" -> \"%s\"", filter_ctx_label, dst_filter_ctx_label);
-                fprintf(outfile, " [ label= \"fmt:%s w:%d h:%d\"];\n",
-                        av_pix_fmt_descriptors[link->format].name, link->w, link->h);
+                if (link->type == AVMEDIA_TYPE_VIDEO) {
+                    fprintf(outfile, " [ label= \"fmt:%s w:%d h:%d tb:%d/%d\" ]",
+                            av_pix_fmt_descriptors[link->format].name,
+                            link->w, link->h, link->time_base.num, link->time_base.den);
+                } else if (link->type == AVMEDIA_TYPE_AUDIO) {
+                    char buf[255];
+                    av_get_channel_layout_string(buf, sizeof(buf), -1, link->channel_layout);
+                    fprintf(outfile, " [ label= \"fmt:%s sr:%"PRId64" cl:%s\" ]",
+                            av_get_sample_fmt_name(link->format),
+                            link->sample_rate, buf);
+                }
+                fprintf(outfile, ";\n");
             }
         }
     }
@@ -151,9 +162,7 @@ int main(int argc, char **argv)
         return 1;
     }
 
-    if (avfilter_graph_check_validity(graph, NULL) ||
-        avfilter_graph_config_formats(graph, NULL) ||
-        avfilter_graph_config_links  (graph, NULL))
+    if (avfilter_graph_config(graph, NULL) < 0)
         return 1;
 
     print_digraph(outfile, graph);