[FFmpeg-cvslog] avcodec: Allow choosing the dump format field separator.

Michael Niedermayer git at videolan.org
Thu Oct 9 01:03:31 CEST 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Wed Oct  8 23:48:32 2014 +0200| [e051d09c58c6f51fea0ce0dab32fe92f58211ac0] | committer: Michael Niedermayer

avcodec: Allow choosing the dump format field separator.

The default is to maintain the previous ", " for now.

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e051d09c58c6f51fea0ce0dab32fe92f58211ac0
---

 libavcodec/avcodec.h       |   11 +++++++++++
 libavcodec/options_table.h |    1 +
 libavcodec/utils.c         |    5 +++--
 libavcodec/version.h       |    4 ++--
 4 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index fd56584..15bd3ae 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -3079,6 +3079,17 @@ typedef struct AVCodecContext {
      * - decoding: unused.
      */
     uint16_t *chroma_intra_matrix;
+
+    /**
+     * dump format seperator.
+     * can be ", " or "\n      " or anything else
+     * Code outside libavcodec should access this field using AVOptions
+     * (NO direct access).
+     * - encoding: Set by user.
+     * - decoding: Set by user.
+     */
+    uint8_t *dump_separator;
+
 } AVCodecContext;
 
 AVRational av_codec_get_pkt_timebase         (const AVCodecContext *avctx);
diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
index b9b79f9..6de75bb 100644
--- a/libavcodec/options_table.h
+++ b/libavcodec/options_table.h
@@ -469,6 +469,7 @@ static const AVOption avcodec_options[] = {
 {"bb", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = AV_FIELD_BB }, 0, 0, V|D|E, "field_order" },
 {"tb", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = AV_FIELD_TB }, 0, 0, V|D|E, "field_order" },
 {"bt", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = AV_FIELD_BT }, 0, 0, V|D|E, "field_order" },
+{"dump_separator", "set information dump field separator", OFFSET(dump_separator), AV_OPT_TYPE_STRING, {.str = NULL}, CHAR_MIN, CHAR_MAX, A|V|S|D|E},
 {NULL},
 };
 
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 69c940b..d235678 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -2950,6 +2950,7 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
     int bitrate;
     int new_line = 0;
     AVRational display_aspect_ratio;
+    const char *separator = enc->dump_separator ? enc->dump_separator : ", ";
 
     if (!buf || buf_size <= 0)
         return;
@@ -2987,7 +2988,7 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
             char detail[256] = "(";
             const char *colorspace_name;
 
-            av_strlcat(buf, "\n      ", buf_size);
+            av_strlcat(buf, separator, buf_size);
 
             snprintf(buf + strlen(buf), buf_size - strlen(buf),
                  "%s", enc->pix_fmt == AV_PIX_FMT_NONE ? "none" :
@@ -3039,7 +3040,7 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
         }
         break;
     case AVMEDIA_TYPE_AUDIO:
-        av_strlcat(buf, "\n      ", buf_size);
+        av_strlcat(buf, separator, buf_size);
         if (enc->sample_rate) {
             snprintf(buf + strlen(buf), buf_size - strlen(buf),
                      "%d Hz, ", enc->sample_rate);
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 6ac5e7c..08db3b0 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,8 +29,8 @@
 #include "libavutil/version.h"
 
 #define LIBAVCODEC_VERSION_MAJOR 56
-#define LIBAVCODEC_VERSION_MINOR  3
-#define LIBAVCODEC_VERSION_MICRO 101
+#define LIBAVCODEC_VERSION_MINOR  4
+#define LIBAVCODEC_VERSION_MICRO 100
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
                                                LIBAVCODEC_VERSION_MINOR, \



More information about the ffmpeg-cvslog mailing list