diff options
author | Anton Khirnov <anton@khirnov.net> | 2012-05-26 08:54:25 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2012-05-26 21:14:35 +0200 |
commit | 8271f55bd7d6f4e06786dc8dd7c9538d83ad026a (patch) | |
tree | 3105fd2faa4d8fe77c80e827dd5221dbc7748c9c /avprobe.c | |
parent | d30acfa94c995d8ebde9c8492747fec611db066d (diff) | |
download | ffmpeg-8271f55bd7d6f4e06786dc8dd7c9538d83ad026a.tar.gz |
avprobe: restore pseudo-INI old style format for compatibility.
Diffstat (limited to 'avprobe.c')
-rw-r--r-- | avprobe.c | 50 |
1 files changed, 50 insertions, 0 deletions
@@ -281,6 +281,50 @@ static void json_print_string(const char *key, const char *value) } /* + * old-style pseudo-INI + */ +static void old_print_object_header(const char *name) +{ + char *str, *p; + + if (!strcmp(name, "tags")) + return; + + str = p = av_strdup(name); + while (*p) { + *p = toupper(*p); + p++; + } + + avio_printf(probe_out, "[%s]\n", str); + av_freep(&str); +} + +static void old_print_object_footer(const char *name) +{ + char *str, *p; + + if (!strcmp(name, "tags")) + return; + + str = p = av_strdup(name); + while (*p) { + *p = toupper(*p); + p++; + } + + avio_printf(probe_out, "[/%s]\n", str); + av_freep(&str); +} + +static void old_print_string(const char *key, const char *value) +{ + if (!strcmp(octx.prefix[octx.level - 1].name, "tags")) + avio_printf(probe_out, "TAG:"); + ini_print_string(key, value); +} + +/* * Simple Formatter for single entries. */ @@ -783,6 +827,12 @@ static int opt_output_format(const char *opt, const char *arg) print_integer = ini_print_integer; print_string = ini_print_string; + } else if (!strcmp(arg, "old")) { + print_header = NULL; + print_object_header = old_print_object_header; + print_object_footer = old_print_object_footer; + + print_string = old_print_string; } else { av_log(NULL, AV_LOG_ERROR, "Unsupported formatter %s\n", arg); return AVERROR(EINVAL); |