[FFmpeg-devel] [PATCH 3/4] avutil/pixdesc: add av_pix_fmt_desc_has_alpha()
Marton Balint
cus at passwd.hu
Thu Apr 19 22:32:20 EEST 2018
Signed-off-by: Marton Balint <cus at passwd.hu>
---
doc/APIchanges | 3 +++
libavutil/pixdesc.h | 11 +++++++++++
libavutil/version.h | 2 +-
3 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/doc/APIchanges b/doc/APIchanges
index 4f6ac2a031..2a0b6f057a 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,9 @@ libavutil: 2017-10-21
API changes, most recent first:
+2018-04-xx - xxxxxxxxxx - lavu 56.16.100 - pixdesc.h
+ Add av_pix_fmt_desc_has_alpha().
+
-------- 8< --------- FFmpeg 4.0 was cut here -------- 8< ---------
2018-04-03 - d6fc031caf - lavu 56.13.100 - pixdesc.h
diff --git a/libavutil/pixdesc.h b/libavutil/pixdesc.h
index 1ab372782a..aef4313ccb 100644
--- a/libavutil/pixdesc.h
+++ b/libavutil/pixdesc.h
@@ -430,4 +430,15 @@ 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 true if a pixel format descriptor has alpha channel.
+ *
+ * @param desc the pixel format descriptor
+ * @return 1 if the pixel format descriptor has alpha, 0 otherwise.
+ */
+static inline int av_pix_fmt_desc_has_alpha(const AVPixFmtDescriptor *desc)
+{
+ return desc->nb_components == 2 || desc->nb_components == 4 || (desc->flags & AV_PIX_FMT_FLAG_PAL);
+}
+
#endif /* AVUTIL_PIXDESC_H */
diff --git a/libavutil/version.h b/libavutil/version.h
index 387421775f..23567000a3 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -79,7 +79,7 @@
*/
#define LIBAVUTIL_VERSION_MAJOR 56
-#define LIBAVUTIL_VERSION_MINOR 15
+#define LIBAVUTIL_VERSION_MINOR 16
#define LIBAVUTIL_VERSION_MICRO 100
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
--
2.13.6
More information about the ffmpeg-devel
mailing list