tools/graph2dot: factorize code printing non-media specific link information

This commit is contained in:
Stefano Sabatini 2012-06-06 23:18:46 +02:00
parent 20689670c8
commit ce7266c66a
1 changed files with 10 additions and 12 deletions

View File

@ -67,29 +67,27 @@ static void print_digraph(FILE *outfile, AVFilterGraph *graph)
dst_filter_ctx->name, dst_filter_ctx->name,
dst_filter_ctx->filter->name); dst_filter_ctx->filter->name);
fprintf(outfile, "\"%s\" -> \"%s\"", fprintf(outfile, "\"%s\" -> \"%s\" [ label= \"inpad:%s ",
filter_ctx_label, dst_filter_ctx_label); filter_ctx_label, dst_filter_ctx_label, link->srcpad->name);
if (link->type == AVMEDIA_TYPE_VIDEO) { if (link->type == AVMEDIA_TYPE_VIDEO) {
fprintf(outfile, fprintf(outfile,
" [ label= \"inpad:%s fmt:%s w:%d h:%d tb:%d/%d outpad:%s\" ]", "fmt:%s w:%d h:%d tb:%d/%d",
link->srcpad->name,
av_pix_fmt_descriptors[link->format].name, av_pix_fmt_descriptors[link->format].name,
link->w, link->h, link->time_base.num, link->w, link->h,
link->time_base.den, link->time_base.num, link->time_base.den);
link->dstpad->name);
} else if (link->type == AVMEDIA_TYPE_AUDIO) { } else if (link->type == AVMEDIA_TYPE_AUDIO) {
char buf[255]; char buf[255];
av_get_channel_layout_string(buf, sizeof(buf), -1, av_get_channel_layout_string(buf, sizeof(buf), -1,
link->channel_layout); link->channel_layout);
fprintf(outfile, fprintf(outfile,
" [ label= \"inpad:%s fmt:%s sr:%"PRId64" cl:%s tb:%d/%d outpad:%s\" ]", "fmt:%s sr:%"PRId64" cl:%s tb:%d/%d",
link->srcpad->name,
av_get_sample_fmt_name(link->format), av_get_sample_fmt_name(link->format),
link->sample_rate, buf, link->sample_rate, buf,
link->time_base.num, link->time_base.den, link->time_base.num, link->time_base.den);
link->dstpad->name);
} }
fprintf(outfile, ";\n");
fprintf(outfile, " outpad:%s\" ];\n", link->dstpad->name);
} }
} }
} }