From f0a6874de85fab8a9c5cb7749392f83b2aada22b Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 8 Oct 2014 23:48:32 +0200 Subject: [PATCH] avformat: Allow choosing the dump format field separator. The default is to maintain the previous ", " for now. Signed-off-by: Michael Niedermayer --- libavformat/avformat.h | 10 ++++++++++ libavformat/dump.c | 4 +++- libavformat/options_table.h | 1 + libavformat/version.h | 2 +- 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 9c545c08d0..52b9dcc1d9 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -1713,6 +1713,16 @@ typedef struct AVFormatContext { * via AVOptions (NO direct access). */ int64_t probesize2; + + /** + * dump format seperator. + * can be ", " or "\n " or anything else + * Code outside libavformat should access this field using AVOptions + * (NO direct access). + * - muxing: Set by user. + * - demuxing: Set by user. + */ + uint8_t *dump_separator; } AVFormatContext; int av_format_get_probe_score(const AVFormatContext *s); diff --git a/libavformat/dump.c b/libavformat/dump.c index f19bcaebbf..29d4aacc0e 100644 --- a/libavformat/dump.c +++ b/libavformat/dump.c @@ -27,6 +27,7 @@ #include "libavutil/intreadwrite.h" #include "libavutil/log.h" #include "libavutil/mathematics.h" +#include "libavutil/opt.h" #include "libavutil/avstring.h" #include "libavutil/replaygain.h" #include "libavutil/stereo3d.h" @@ -345,6 +346,7 @@ static void dump_stream_format(AVFormatContext *ic, int i, int flags = (is_output ? ic->oformat->flags : ic->iformat->flags); AVStream *st = ic->streams[i]; AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL, 0); + char *separator = ic->dump_separator; avcodec_string(buf, sizeof(buf), st->codec, is_output); av_log(NULL, AV_LOG_INFO, " Stream #%d:%d", index, i); @@ -378,7 +380,7 @@ static void dump_stream_format(AVFormatContext *ic, int i, int tbc = st->codec->time_base.den && st->codec->time_base.num; if (fps || tbr || tbn || tbc) - av_log(NULL, AV_LOG_INFO, "\n "); + av_log(NULL, AV_LOG_INFO, "%s", separator); if (fps) print_fps(av_q2d(st->avg_frame_rate), tbr || tbn || tbc ? "fps, " : "fps"); diff --git a/libavformat/options_table.h b/libavformat/options_table.h index 71024be195..4ac8b3d20e 100644 --- a/libavformat/options_table.h +++ b/libavformat/options_table.h @@ -96,6 +96,7 @@ static const AVOption avformat_options[] = { {"unofficial", "allow unofficial extensions", 0, AV_OPT_TYPE_CONST, {.i64 = FF_COMPLIANCE_UNOFFICIAL }, INT_MIN, INT_MAX, D|E, "strict"}, {"experimental", "allow non-standardized experimental variants", 0, AV_OPT_TYPE_CONST, {.i64 = FF_COMPLIANCE_EXPERIMENTAL }, INT_MIN, INT_MAX, D|E, "strict"}, {"max_ts_probe", "maximum number of packets to read while waiting for the first timestamp", OFFSET(max_ts_probe), AV_OPT_TYPE_INT, { .i64 = 50 }, 0, INT_MAX, D }, +{"dump_separator", "set information dump field separator", OFFSET(dump_separator), AV_OPT_TYPE_STRING, {.str = ", "}, CHAR_MIN, CHAR_MAX, D|E}, {NULL}, }; diff --git a/libavformat/version.h b/libavformat/version.h index 569681cebf..62f1c26616 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -30,7 +30,7 @@ #include "libavutil/version.h" #define LIBAVFORMAT_VERSION_MAJOR 56 -#define LIBAVFORMAT_VERSION_MINOR 8 +#define LIBAVFORMAT_VERSION_MINOR 9 #define LIBAVFORMAT_VERSION_MICRO 100 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \