avcodec: Allow choosing the dump format field separator.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2014-10-08 23:48:32 +02:00
parent f22f873ef0
commit e051d09c58
4 changed files with 17 additions and 4 deletions

View File

@ -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);

View File

@ -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},
};

View File

@ -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);

View File

@ -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, \