From cd7b6deeaaf1e9c771e998519554e75057c62580 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Fri, 5 Jul 2013 17:42:37 +0200 Subject: [PATCH 1/2] tools: Wording and formatting cosmetics --- tools/graph2dot.c | 8 ++++---- tools/pktdumper.c | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tools/graph2dot.c b/tools/graph2dot.c index 26cb28b068..692ada258c 100644 --- a/tools/graph2dot.c +++ b/tools/graph2dot.c @@ -36,7 +36,7 @@ static void usage(void) { - printf("Convert a libavfilter graph to a dot file\n"); + printf("Convert a libavfilter graph to a dot file.\n"); printf("Usage: graph2dot [OPTIONS]\n"); printf("\n" "Options:\n" @@ -133,7 +133,7 @@ int main(int argc, char **argv) infilename = "/dev/stdin"; infile = fopen(infilename, "r"); if (!infile) { - fprintf(stderr, "Impossible to open input file '%s': %s\n", + fprintf(stderr, "Failed to open input file '%s': %s\n", infilename, strerror(errno)); return 1; } @@ -142,7 +142,7 @@ int main(int argc, char **argv) outfilename = "/dev/stdout"; outfile = fopen(outfilename, "w"); if (!outfile) { - fprintf(stderr, "Impossible to open output file '%s': %s\n", + fprintf(stderr, "Failed to open output file '%s': %s\n", outfilename, strerror(errno)); return 1; } @@ -175,7 +175,7 @@ int main(int argc, char **argv) avfilter_register_all(); if (avfilter_graph_parse(graph, graph_string, NULL, NULL, NULL) < 0) { - fprintf(stderr, "Impossible to parse the graph description\n"); + fprintf(stderr, "Failed to parse the graph description\n"); return 1; } diff --git a/tools/pktdumper.c b/tools/pktdumper.c index 98b9327ef4..c6398fe517 100644 --- a/tools/pktdumper.c +++ b/tools/pktdumper.c @@ -31,18 +31,18 @@ #include #endif -#define FILENAME_BUF_SIZE 4096 - #include "libavutil/avstring.h" #include "libavutil/time.h" #include "libavformat/avformat.h" +#define FILENAME_BUF_SIZE 4096 #define PKTFILESUFF "_%08" PRId64 "_%02d_%010" PRId64 "_%06d_%c.bin" static int usage(int ret) { - fprintf(stderr, "dump (up to maxpkts) AVPackets as they are demuxed by libavformat.\n"); - fprintf(stderr, "each packet is dumped in its own file named like `basename file.ext`_$PKTNUM_$STREAMINDEX_$STAMP_$SIZE_$FLAGS.bin\n"); + fprintf(stderr, "Dump (up to maxpkts) AVPackets as they are demuxed by libavformat.\n"); + fprintf(stderr, "Each packet is dumped in its own file named like\n"); + fprintf(stderr, "$(basename file.ext)_$PKTNUM_$STREAMINDEX_$STAMP_$SIZE_$FLAGS.bin\n"); fprintf(stderr, "pktdumper [-nw] file [maxpkts]\n"); fprintf(stderr, "-n\twrite No file at all, only demux.\n"); fprintf(stderr, "-w\tWait at end of processing instead of quitting.\n"); @@ -79,7 +79,7 @@ int main(int argc, char **argv) if (strrchr(fntemplate, '.')) *strrchr(fntemplate, '.') = '\0'; if (strchr(fntemplate, '%')) { - fprintf(stderr, "can't use filenames containing '%%'\n"); + fprintf(stderr, "cannot use filenames containing '%%'\n"); return usage(1); } if (strlen(fntemplate) + sizeof(PKTFILESUFF) >= sizeof(fntemplate) - 1) { From a4baf96abd64cda68e3e4692b182bdf60745a14d Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Fri, 21 Jun 2013 14:47:01 +0200 Subject: [PATCH 2/2] avprobe: rename the prettyprint structures --- avprobe.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/avprobe.c b/avprobe.c index c410cd269c..5ad56a182b 100644 --- a/avprobe.c +++ b/avprobe.c @@ -82,17 +82,17 @@ static void exit_program(void) typedef enum { ARRAY, OBJECT -} ProbeElementType; +} PrintElementType; typedef struct { const char *name; - ProbeElementType type; + PrintElementType type; int64_t index; int64_t nb_elems; -} ProbeElement; +} PrintElement; typedef struct { - ProbeElement *prefix; + PrintElement *prefix; int level; void (*print_header)(void); void (*print_footer)(void); @@ -104,10 +104,10 @@ typedef struct { void (*print_integer) (const char *key, int64_t value); void (*print_string) (const char *key, const char *value); -} OutputContext; +} PrintContext; static AVIOContext *probe_out = NULL; -static OutputContext octx; +static PrintContext octx; #define AVP_INDENT() avio_printf(probe_out, "%*c", octx.level * 2, ' ') /* @@ -166,7 +166,7 @@ static void ini_print_array_header(const char *name) static void ini_print_object_header(const char *name) { int i; - ProbeElement *el = octx.prefix + octx.level -1; + PrintElement *el = octx.prefix + octx.level -1; if (el->nb_elems) avio_printf(probe_out, "\n"); @@ -362,7 +362,7 @@ static void probe_group_enter(const char *name, int type) int64_t count = -1; octx.prefix = - av_realloc(octx.prefix, sizeof(ProbeElement) * (octx.level + 1)); + av_realloc(octx.prefix, sizeof(PrintElement) * (octx.level + 1)); if (!octx.prefix || !name) { fprintf(stderr, "Out of memory\n"); @@ -370,13 +370,13 @@ static void probe_group_enter(const char *name, int type) } if (octx.level) { - ProbeElement *parent = octx.prefix + octx.level -1; + PrintElement *parent = octx.prefix + octx.level -1; if (parent->type == ARRAY) count = parent->nb_elems; parent->nb_elems++; } - octx.prefix[octx.level++] = (ProbeElement){name, type, count, 0}; + octx.prefix[octx.level++] = (PrintElement){name, type, count, 0}; } static void probe_group_leave(void)