Go to the documentation of this file.
39 printf(
"Convert a libavfilter graph to a dot file.\n");
40 printf(
"Usage: graph2dot [OPTIONS]\n");
43 "-i INFILE set INFILE as input file, stdin if omitted\n"
44 "-o OUTFILE set OUTFILE as output file, stdout if omitted\n"
45 "-h print this help\n");
57 fprintf(
outfile,
"digraph G {\n");
58 fprintf(
outfile,
"node [shape=box]\n");
59 fprintf(
outfile,
"rankdir=LR\n");
61 for (
i = 0;
i <
graph->nb_filters;
i++) {
62 char filter_ctx_label[128];
65 snprintf(filter_ctx_label,
sizeof(filter_ctx_label),
"%s\\n(%s)",
72 char dst_filter_ctx_label[128];
75 snprintf(dst_filter_ctx_label,
sizeof(dst_filter_ctx_label),
80 fprintf(
outfile,
"\"%s\" -> \"%s\" [ label= \"inpad:%s -> outpad:%s\\n",
81 filter_ctx_label, dst_filter_ctx_label,
88 "fmt:%s w:%d h:%d tb:%d/%d",
97 "fmt:%s sr:%d cl:%s tb:%d/%d",
109 int main(
int argc,
char **argv)
111 const char *outfilename =
NULL;
112 const char *infilename =
NULL;
115 char *graph_string =
NULL;
121 while ((
c =
getopt(argc, argv,
"hi:o:")) != -1) {
137 if (!infilename || !strcmp(infilename,
"-"))
138 infilename =
"/dev/stdin";
139 infile = fopen(infilename,
"r");
141 fprintf(stderr,
"Failed to open input file '%s': %s\n",
142 infilename, strerror(errno));
146 if (!outfilename || !strcmp(outfilename,
"-"))
147 outfilename =
"/dev/stdout";
148 outfile = fopen(outfilename,
"w");
150 fprintf(stderr,
"Failed to open output file '%s': %s\n",
151 outfilename, strerror(errno));
158 struct line *
line, *last_line, *first_line;
162 fprintf(stderr,
"Memory allocation failure\n");
166 while (fgets(last_line->
data,
sizeof(last_line->
data), infile)) {
169 fprintf(stderr,
"Memory allocation failure\n");
172 count += strlen(last_line->
data);
173 last_line->
next = new_line;
174 last_line = new_line;
180 fprintf(stderr,
"Memory allocation failure\n");
194 fprintf(stderr,
"Memory allocation failure\n");
199 fprintf(stderr,
"Failed to parse the graph description\n");
static FilteringContext * filter_ctx
const char * avfilter_pad_get_name(const AVFilterPad *pads, int pad_idx)
Get the name of an AVFilterPad.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
void av_get_channel_layout_string(char *buf, int buf_size, int nb_channels, uint64_t channel_layout)
Return a description of a channel layout.
const char * name
Filter name.
A link between two filters.
AVFilterGraph * avfilter_graph_alloc(void)
Allocate a filter graph.
static int getopt(int argc, char *argv[], char *opts)
int main(int argc, char **argv)
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
const char * av_get_sample_fmt_name(enum AVSampleFormat sample_fmt)
Return the name of sample_fmt, or NULL if sample_fmt is not recognized.
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a link
int avfilter_graph_config(AVFilterGraph *graphctx, void *log_ctx)
Check validity and configure all the links and formats in the graph.
char * name
name of this filter instance
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
int sample_rate
Sample rate of the audio data.
AVRational time_base
Time base for the timestamps in this frame.
printf("static const uint8_t my_array[100] = {\n")
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames,...
uint64_t channel_layout
Channel layout of the audio data.
void av_log_set_level(int level)
Set the log level.
#define i(width, name, range_min, range_max)
int avfilter_graph_parse(AVFilterGraph *graph, const char *filters, AVFilterInOut *inputs, AVFilterInOut *outputs, void *log_ctx)
Add a graph described by a string to a graph.
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
const AVFilter * filter
the AVFilter of which this is an instance
static void print_digraph(FILE *outfile, AVFilterGraph *graph)
The official guide to swscale for confused that consecutive non overlapping rectangles of slice_bottom special converter These generally are unscaled converters of common like for each output line the vertical scaler pulls lines from a ring buffer When the ring buffer does not contain the wanted line