avutil: add av_get_colorspace_name()

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer
2013-08-31 17:10:10 +02:00
parent 63139f62f3
commit 9c8aeacf82
4 changed files with 29 additions and 16 deletions

View File

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