diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-10-08 22:53:48 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-10-08 22:53:48 +0200 |
commit | bb44f7d5d7e48bd67fa24fbec4a28f9890e444aa (patch) | |
tree | 863b54eb4dd13a87d11869ac64730be4ed9c2397 | |
parent | 7eb959bf0b961e308e3068f161ee94e82e02355d (diff) | |
parent | 5a419b2dd1881889d436f55741fd3ff3f9f436c4 (diff) | |
download | ffmpeg-bb44f7d5d7e48bd67fa24fbec4a28f9890e444aa.tar.gz |
Merge commit '5a419b2dd1881889d436f55741fd3ff3f9f436c4'
* commit '5a419b2dd1881889d436f55741fd3ff3f9f436c4':
pixdesc: return color properties names
Conflicts:
libavutil/pixdesc.c
libavutil/pixdesc.h
libavutil/version.h
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | doc/APIchanges | 3 | ||||
-rw-r--r-- | libavutil/pixdesc.c | 58 | ||||
-rw-r--r-- | libavutil/pixdesc.h | 26 | ||||
-rw-r--r-- | libavutil/version.h | 4 |
4 files changed, 89 insertions, 2 deletions
diff --git a/doc/APIchanges b/doc/APIchanges index 01510493c4..546b7d2a4c 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -15,6 +15,9 @@ libavutil: 2014-08-09 API changes, most recent first: +2014-09-xx - xxxxxxx - lavu 54.04.0 - pixdesc.h + Add API to return the name of frame and context color properties. + 2014-09-xx - xxxxxxx - lavc 56.2.0 - vdpau.h Add av_vdpau_bind_context(). This function should now be used for creating (or resetting) a AVVDPAUContext instead of av_vdpau_alloc_context(). diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c index 154392af20..648d014daa 100644 --- a/libavutil/pixdesc.c +++ b/libavutil/pixdesc.c @@ -1902,6 +1902,33 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { }, }; +static const char *color_range_names[AVCOL_RANGE_NB] = { + "unknown", "tv", "pc", +}; + +static const char *color_primaries_names[AVCOL_PRI_NB] = { + "reserved", "bt709", "unknown", "reserved", "bt470m", + "bt470bg", "smpte170m", "smpte240m", "film", "bt2020", +}; + +static const char *color_transfer_names[AVCOL_TRC_NB] = { + "reserved", "bt709", "unknown", "reserved", "bt470m", + "bt470bg", "smpte170m", "smpte240m", "linear", "log100", + "log316", "iec61966-2-4", "bt1361e", "iec61966-2-1", + "bt2020-10", "bt2020-20", +}; + +static const char *color_space_names[AVCOL_SPC_NB] = { + "gbr", "bt709", "unknown", "reserved", "fcc", + "bt470bg", "smpte170m", "smpte240m", "ycgco", + "bt2020nc", "bt2020c", +}; + +static const char *chroma_location_names[AVCHROMA_LOC_NB] = { + "unspecified", "left", "center", "topleft", + "top", "bottomleft", "bottom", +}; + FF_DISABLE_DEPRECATION_WARNINGS static enum AVPixelFormat get_pix_fmt_internal(const char *name) { @@ -2305,6 +2332,36 @@ enum AVPixelFormat av_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt1, en return dst_pix_fmt; } +const char *av_color_range_name(enum AVColorRange range) +{ + return (unsigned) range < AVCOL_RANGE_NB ? + color_range_names[range] : NULL; +} + +const char *av_color_primaries_name(enum AVColorPrimaries primaries) +{ + return (unsigned) primaries < AVCOL_PRI_NB ? + color_primaries_names[primaries] : NULL; +} + +const char *av_color_transfer_name(enum AVColorTransferCharacteristic transfer) +{ + return (unsigned) transfer < AVCOL_TRC_NB ? + color_transfer_names[transfer] : NULL; +} + +const char *av_color_space_name(enum AVColorSpace space) +{ + return (unsigned) space < AVCOL_SPC_NB ? + color_space_names[space] : NULL; +} + +const char *av_chroma_location_name(enum AVChromaLocation location) +{ + return (unsigned) location < AVCHROMA_LOC_NB ? + chroma_location_names[location] : NULL; +} + #ifdef TEST int main(void){ @@ -2332,3 +2389,4 @@ int main(void){ } #endif + diff --git a/libavutil/pixdesc.h b/libavutil/pixdesc.h index 41e81dbe13..a4376b2c0e 100644 --- a/libavutil/pixdesc.h +++ b/libavutil/pixdesc.h @@ -356,4 +356,30 @@ int av_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt, */ enum AVPixelFormat av_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2, enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr); + +/** + * @return the name for provided color range or NULL if unknown. + */ +const char *av_color_range_name(enum AVColorRange range); + +/** + * @return the name for provided color primaries or NULL if unknown. + */ +const char *av_color_primaries_name(enum AVColorPrimaries primaries); + +/** + * @return the name for provided color transfer or NULL if unknown. + */ +const char *av_color_transfer_name(enum AVColorTransferCharacteristic transfer); + +/** + * @return the name for provided color space or NULL if unknown. + */ +const char *av_color_space_name(enum AVColorSpace space); + +/** + * @return the name for provided chroma location or NULL if unknown. + */ +const char *av_chroma_location_name(enum AVChromaLocation location); + #endif /* AVUTIL_PIXDESC_H */ diff --git a/libavutil/version.h b/libavutil/version.h index ae5dd65a4e..6db2dd7096 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -56,8 +56,8 @@ */ #define LIBAVUTIL_VERSION_MAJOR 54 -#define LIBAVUTIL_VERSION_MINOR 9 -#define LIBAVUTIL_VERSION_MICRO 101 +#define LIBAVUTIL_VERSION_MINOR 10 +#define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ LIBAVUTIL_VERSION_MINOR, \ |