summaryrefslogtreecommitdiff
path: root/tools/graph2dot.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/graph2dot.c')
-rw-r--r--tools/graph2dot.c45
1 files changed, 30 insertions, 15 deletions
diff --git a/tools/graph2dot.c b/tools/graph2dot.c
index 12f1066c87..5552b3400d 100644
--- a/tools/graph2dot.c
+++ b/tools/graph2dot.c
@@ -1,20 +1,20 @@
/*
* Copyright (c) 2008-2010 Stefano Sabatini
*
- * This file is part of Libav.
+ * This file is part of FFmpeg.
*
- * Libav is free software; you can redistribute it and/or
+ * FFmpeg 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.
*
- * Libav is distributed in the hope that it will be useful,
+ * FFmpeg 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 Libav; if not, write to the Free Software
+ * License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@@ -28,7 +28,6 @@
#include "libavutil/channel_layout.h"
#include "libavutil/mem.h"
#include "libavutil/pixdesc.h"
-#include "libavutil/audioconvert.h"
#include "libavfilter/avfilter.h"
#if !HAVE_GETOPT
@@ -63,7 +62,7 @@ static void print_digraph(FILE *outfile, AVFilterGraph *graph)
char filter_ctx_label[128];
const AVFilterContext *filter_ctx = graph->filters[i];
- snprintf(filter_ctx_label, sizeof(filter_ctx_label), "%s (%s)",
+ snprintf(filter_ctx_label, sizeof(filter_ctx_label), "%s\\n(%s)",
filter_ctx->name,
filter_ctx->filter->name);
@@ -74,28 +73,32 @@ static void print_digraph(FILE *outfile, AVFilterGraph *graph)
const AVFilterContext *dst_filter_ctx = link->dst;
snprintf(dst_filter_ctx_label, sizeof(dst_filter_ctx_label),
- "%s (%s)",
+ "%s\\n(%s)",
dst_filter_ctx->name,
dst_filter_ctx->filter->name);
- fprintf(outfile, "\"%s\" -> \"%s\"",
- filter_ctx_label, dst_filter_ctx_label);
+ fprintf(outfile, "\"%s\" -> \"%s\" [ label= \"inpad:%s -> outpad:%s\\n",
+ filter_ctx_label, dst_filter_ctx_label,
+ link->srcpad->name, link->dstpad->name);
+
if (link->type == AVMEDIA_TYPE_VIDEO) {
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(link->format);
fprintf(outfile,
- " [ label= \"fmt:%s w:%d h:%d tb:%d/%d\" ]",
- desc->name, link->w, link->h, link->time_base.num,
- link->time_base.den);
+ "fmt:%s w:%d h:%d tb:%d/%d",
+ desc->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:%d cl:%s\" ]",
+ "fmt:%s sr:%d cl:%s tb:%d/%d",
av_get_sample_fmt_name(link->format),
- link->sample_rate, buf);
+ link->sample_rate, buf,
+ link->time_base.num, link->time_base.den);
}
- fprintf(outfile, ";\n");
+ fprintf(outfile, "\" ];\n");
}
}
}
@@ -154,9 +157,17 @@ int main(int argc, char **argv)
struct line *line, *last_line, *first_line;
char *p;
last_line = first_line = av_malloc(sizeof(struct line));
+ if (!last_line) {
+ fprintf(stderr, "Memory allocation failure\n");
+ return 1;
+ }
while (fgets(last_line->data, sizeof(last_line->data), infile)) {
struct line *new_line = av_malloc(sizeof(struct line));
+ if (!new_line) {
+ fprintf(stderr, "Memory allocation failure\n");
+ return 1;
+ }
count += strlen(last_line->data);
last_line->next = new_line;
last_line = new_line;
@@ -164,6 +175,10 @@ int main(int argc, char **argv)
last_line->next = NULL;
graph_string = av_malloc(count + 1);
+ if (!graph_string) {
+ fprintf(stderr, "Memory allocation failure\n");
+ return 1;
+ }
p = graph_string;
for (line = first_line; line->next; line = line->next) {
unsigned int l = strlen(line->data);