diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-08-31 17:10:10 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-09-19 22:14:13 +0200 |
commit | 9c8aeacf82a872e1703efdfd2822a4f2d6324c9a (patch) | |
tree | 5f738c9da8d7396e7b5213876e08cf0c44de583f /libavcodec/utils.c | |
parent | 63139f62f35944b9abd42505bf13a740676978e9 (diff) | |
download | ffmpeg-9c8aeacf82a872e1703efdfd2822a4f2d6324c9a.tar.gz |
avutil: add av_get_colorspace_name()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r-- | libavcodec/utils.c | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 7ca2044a6c..e3f7ee27cf 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -2631,6 +2631,7 @@ 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; snprintf(buf + strlen(buf), buf_size - strlen(buf), ", %s", av_get_pix_fmt_name(enc->pix_fmt)); @@ -2640,21 +2641,11 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode) if (enc->color_range != AVCOL_RANGE_UNSPECIFIED) av_strlcatf(detail, sizeof(detail), enc->color_range == AVCOL_RANGE_MPEG ? "tv, ": "pc, "); - if (enc->colorspace<9U) { - static const char *name[] = { - "GBR", - "bt709", - NULL, - NULL, - "fcc", - "bt470bg", - "smpte170m", - "smpte240m", - "YCgCo", - }; - if (name[enc->colorspace]) - av_strlcatf(detail, sizeof(detail), "%s, ", name[enc->colorspace]); - } + + colorspace_name = av_get_colorspace_name(enc->colorspace); + if (colorspace_name) + av_strlcatf(detail, sizeof(detail), "%s, ", colorspace_name); + if (strlen(detail) > 1) { detail[strlen(detail) - 2] = 0; av_strlcatf(buf, buf_size, "%s)", detail); |