MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / print_digraph

Function print_digraph

tools/graph2dot.c:53–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51};
52
53static void print_digraph(FILE *outfile, AVFilterGraph *graph)
54{
55 int i, j;
56
57 fprintf(outfile, "digraph G {\n");
58 fprintf(outfile, "node [shape=box]\n");
59 fprintf(outfile, "rankdir=LR\n");
60
61 for (i = 0; i < graph->nb_filters; i++) {
62 char filter_ctx_label[128];
63 const AVFilterContext *filter_ctx = graph->filters[i];
64
65 snprintf(filter_ctx_label, sizeof(filter_ctx_label), "%s\\n(%s)",
66 filter_ctx->name,
67 filter_ctx->filter->name);
68
69 for (j = 0; j < filter_ctx->nb_outputs; j++) {
70 AVFilterLink *link = filter_ctx->outputs[j];
71 if (link) {
72 char dst_filter_ctx_label[128];
73 const AVFilterContext *dst_filter_ctx = link->dst;
74
75 snprintf(dst_filter_ctx_label, sizeof(dst_filter_ctx_label),
76 "%s\\n(%s)",
77 dst_filter_ctx->name,
78 dst_filter_ctx->filter->name);
79
80 fprintf(outfile, "\"%s\" -> \"%s\" [ label= \"inpad:%s -> outpad:%s\\n",
81 filter_ctx_label, dst_filter_ctx_label,
82 avfilter_pad_get_name(link->srcpad, 0),
83 avfilter_pad_get_name(link->dstpad, 0));
84
85 if (link->type == AVMEDIA_TYPE_VIDEO) {
86 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(link->format);
87 fprintf(outfile,
88 "fmt:%s w:%d h:%d tb:%d/%d",
89 desc->name,
90 link->w, link->h,
91 link->time_base.num, link->time_base.den);
92 } else if (link->type == AVMEDIA_TYPE_AUDIO) {
93 char buf[255];
94 av_channel_layout_describe(&link->ch_layout, buf, sizeof(buf));
95 fprintf(outfile,
96 "fmt:%s sr:%d cl:%s tb:%d/%d",
97 av_get_sample_fmt_name(link->format),
98 link->sample_rate, buf,
99 link->time_base.num, link->time_base.den);
100 }
101 fprintf(outfile, "\" ];\n");
102 }
103 }
104 }
105 fprintf(outfile, "}\n");
106}
107
108int main(int argc, char **argv)
109{

Callers 1

mainFunction · 0.85

Calls 4

avfilter_pad_get_nameFunction · 0.85
av_pix_fmt_desc_getFunction · 0.85
av_get_sample_fmt_nameFunction · 0.85

Tested by

no test coverage detected