Applications can now detect rgb/yuv/gray/mono color types just by looking at pixdesc.flags.
Signed-off-by: Vittorio Giovara <[email protected]> --- Updated with wm4 and lu0 comments. Vittorio doc/APIchanges | 3 +++ libavutil/pixdesc.c | 11 ++++++----- libavutil/pixdesc.h | 4 ++++ libavutil/version.h | 2 +- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index 15cb8ea..0f71c52 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -13,6 +13,9 @@ libavutil: 2015-08-28 API changes, most recent first: +2015-xx-xx - xxxxxxx - lavu 55.1.0 - pixdesc.h + Add AV_PIX_FMT_FLAG_GRAY to identify grayscale pixel formats. + 2015-xx-xx - lavu 55.0.0 xxxxxxx - Change type of AVPixFmtDescriptor.flags. xxxxxxx - Change type of AVComponentDescriptor fields and drop bit packing. diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c index 4f11479..f3eeab7 100644 --- a/libavutil/pixdesc.c +++ b/libavutil/pixdesc.c @@ -244,7 +244,7 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { .comp = { { 0, 1, 0, 0, 8, 0, 7, 1 }, /* Y */ }, - .flags = AV_PIX_FMT_FLAG_PSEUDOPAL, + .flags = AV_PIX_FMT_FLAG_PSEUDOPAL | AV_PIX_FMT_FLAG_GRAY, .alias = "gray8,y8", }, [AV_PIX_FMT_MONOWHITE] = { @@ -501,7 +501,7 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { .comp = { { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */ }, - .flags = AV_PIX_FMT_FLAG_BE, + .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_GRAY, .alias = "y16be", }, [AV_PIX_FMT_GRAY16LE] = { @@ -512,6 +512,7 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { .comp = { { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */ }, + .flags = AV_PIX_FMT_FLAG_GRAY, .alias = "y16le", }, [AV_PIX_FMT_YUV440P] = { @@ -1352,7 +1353,7 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { { 0, 2, 0, 0, 8, 1, 7, 1 }, /* Y */ { 0, 2, 1, 0, 8, 1, 7, 2 }, /* A */ }, - .flags = AV_PIX_FMT_FLAG_ALPHA, + .flags = AV_PIX_FMT_FLAG_ALPHA | AV_PIX_FMT_FLAG_GRAY, .alias = "gray8a", }, [AV_PIX_FMT_YA16LE] = { @@ -1362,7 +1363,7 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { { 0, 4, 0, 0, 16, 3, 15, 1 }, /* Y */ { 0, 4, 2, 0, 16, 3, 15, 3 }, /* A */ }, - .flags = AV_PIX_FMT_FLAG_ALPHA, + .flags = AV_PIX_FMT_FLAG_ALPHA | AV_PIX_FMT_FLAG_GRAY, }, [AV_PIX_FMT_YA16BE] = { .name = "ya16be", @@ -1371,7 +1372,7 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { { 0, 4, 0, 0, 16, 3, 15, 1 }, /* Y */ { 0, 4, 2, 0, 16, 3, 15, 3 }, /* A */ }, - .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_ALPHA, + .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_ALPHA | AV_PIX_FMT_FLAG_GRAY, }, [AV_PIX_FMT_GBRP] = { .name = "gbrp", diff --git a/libavutil/pixdesc.h b/libavutil/pixdesc.h index ea84fd3..efa0ac2 100644 --- a/libavutil/pixdesc.h +++ b/libavutil/pixdesc.h @@ -151,6 +151,10 @@ typedef struct AVPixFmtDescriptor { * The pixel format has an alpha channel. */ #define AV_PIX_FMT_FLAG_ALPHA (1 << 7) +/** + * The pixel format contains grayscale data in the first component. + */ +#define AV_PIX_FMT_FLAG_GRAY (1 << 8) /** * Read a line from an image, and write the values of the diff --git a/libavutil/version.h b/libavutil/version.h index 8640450..3c12d71 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -54,7 +54,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 55 -#define LIBAVUTIL_VERSION_MINOR 0 +#define LIBAVUTIL_VERSION_MINOR 1 #define LIBAVUTIL_VERSION_MICRO 0 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ -- 1.9.5 (Apple Git-50.3) _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
