[FFmpeg-cvslog] videotoolbox: add alpha support
rcombs
git at videolan.org
Mon Nov 29 00:42:11 EET 2021
ffmpeg | branch: master | rcombs <rcombs at rcombs.me> | Sat Nov 13 14:21:23 2021 -0600| [350eb59f8c25372067b7e338b45cce97fe892e4f] | committer: rcombs
videotoolbox: add alpha support
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=350eb59f8c25372067b7e338b45cce97fe892e4f
---
libavcodec/videotoolbox.c | 3 +++
libavutil/hwcontext_videotoolbox.c | 2 ++
2 files changed, 5 insertions(+)
diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
index 5f08488a6b..542fe9316a 100644
--- a/libavcodec/videotoolbox.c
+++ b/libavcodec/videotoolbox.c
@@ -1075,6 +1075,9 @@ static enum AVPixelFormat videotoolbox_best_pixel_format(AVCodecContext *avctx)
int depth = descriptor->comp[0].depth;
+ if (descriptor->flags & AV_PIX_FMT_FLAG_ALPHA)
+ return AV_PIX_FMT_AYUV64;
+
#if HAVE_KCVPIXELFORMATTYPE_444YPCBCR16BIPLANARVIDEORANGE
if (depth > 10)
return descriptor->log2_chroma_w == 0 ? AV_PIX_FMT_P416 : AV_PIX_FMT_P216;
diff --git a/libavutil/hwcontext_videotoolbox.c b/libavutil/hwcontext_videotoolbox.c
index f7a1299cc3..e9567bbf44 100644
--- a/libavutil/hwcontext_videotoolbox.c
+++ b/libavutil/hwcontext_videotoolbox.c
@@ -48,6 +48,7 @@ static const struct {
#ifdef kCFCoreFoundationVersionNumber10_7
{ kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange, false, AV_PIX_FMT_NV12 },
{ kCVPixelFormatType_420YpCbCr8BiPlanarFullRange, true, AV_PIX_FMT_NV12 },
+ { kCVPixelFormatType_4444AYpCbCr16, false, AV_PIX_FMT_AYUV64 },
#endif
#if HAVE_KCVPIXELFORMATTYPE_420YPCBCR10BIPLANARVIDEORANGE
{ kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange, false, AV_PIX_FMT_P010 },
@@ -80,6 +81,7 @@ static const struct {
static const enum AVPixelFormat supported_formats[] = {
#ifdef kCFCoreFoundationVersionNumber10_7
AV_PIX_FMT_NV12,
+ AV_PIX_FMT_AYUV64,
#endif
AV_PIX_FMT_YUV420P,
AV_PIX_FMT_UYVY422,
More information about the ffmpeg-cvslog
mailing list