diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-10-09 01:03:55 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-10-09 01:26:34 +0200 |
commit | af28960412441c9204a85d4acdb56a74e8d98772 (patch) | |
tree | 32073af88c2d9e4963bed2020e52d8fa24bd43d7 /libavcodec/utils.c | |
parent | f0a6874de85fab8a9c5cb7749392f83b2aada22b (diff) | |
parent | 41e86146e7240f9d42e8cdb86a94bb3eb2bbe15f (diff) | |
download | ffmpeg-af28960412441c9204a85d4acdb56a74e8d98772.tar.gz |
Merge commit '41e86146e7240f9d42e8cdb86a94bb3eb2bbe15f'
* commit '41e86146e7240f9d42e8cdb86a94bb3eb2bbe15f':
dump: print detailed color space information
full color triplets are only printed if they are not all equal, otherwise
they are printed as before
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r-- | libavcodec/utils.c | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c index d235678779..02ca2dec6f 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -2986,7 +2986,6 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode) case AVMEDIA_TYPE_VIDEO: if (enc->pix_fmt != AV_PIX_FMT_NONE) { char detail[256] = "("; - const char *colorspace_name; av_strlcat(buf, separator, buf_size); @@ -2997,12 +2996,28 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode) enc->bits_per_raw_sample <= av_pix_fmt_desc_get(enc->pix_fmt)->comp[0].depth_minus1) av_strlcatf(detail, sizeof(detail), "%d bpc, ", enc->bits_per_raw_sample); if (enc->color_range != AVCOL_RANGE_UNSPECIFIED) - av_strlcatf(detail, sizeof(detail), - enc->color_range == AVCOL_RANGE_MPEG ? "tv, ": "pc, "); + av_strlcatf(detail, sizeof(detail), "%s, ", + av_color_range_name(enc->color_range)); + + if (enc->colorspace != AVCOL_SPC_UNSPECIFIED || + enc->color_primaries != AVCOL_PRI_UNSPECIFIED || + enc->color_trc != AVCOL_TRC_UNSPECIFIED) { + if (enc->colorspace != enc->color_primaries || + enc->colorspace != enc->color_trc) { + new_line = 1; + av_strlcatf(detail, sizeof(detail), "%s/%s/%s, ", + av_color_space_name(enc->colorspace), + av_color_primaries_name(enc->color_primaries), + av_color_transfer_name(enc->color_trc)); + } else + av_strlcatf(detail, sizeof(detail), "%s, ", + av_get_colorspace_name(enc->colorspace)); + } - colorspace_name = av_get_colorspace_name(enc->colorspace); - if (colorspace_name) - av_strlcatf(detail, sizeof(detail), "%s, ", colorspace_name); + if (av_log_get_level() >= AV_LOG_DEBUG && + enc->chroma_sample_location != AVCHROMA_LOC_UNSPECIFIED) + av_strlcatf(detail, sizeof(detail), "%s, ", + av_chroma_location_name(enc->chroma_sample_location)); if (strlen(detail) > 1) { detail[strlen(detail) - 2] = 0; @@ -3011,7 +3026,7 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode) } if (enc->width) { - av_strlcat(buf, new_line ? "\n " : ", ", buf_size); + av_strlcat(buf, new_line ? separator : ", ", buf_size); snprintf(buf + strlen(buf), buf_size - strlen(buf), "%dx%d", |