From 9e142b4410f9b1c703f3f12ced07c45dc2a0db24 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 10 Dec 2023 16:20:20 +0100 Subject: Add FFmpegExaminer::has_alpha(). --- src/lib/ffmpeg_examiner.cc | 13 +++++++++++++ src/lib/ffmpeg_examiner.h | 2 ++ 2 files changed, 15 insertions(+) diff --git a/src/lib/ffmpeg_examiner.cc b/src/lib/ffmpeg_examiner.cc index 46f4f236e..ed6f21094 100644 --- a/src/lib/ffmpeg_examiner.cc +++ b/src/lib/ffmpeg_examiner.cc @@ -383,6 +383,19 @@ FFmpegExaminer::bits_per_pixel () const } +bool +FFmpegExaminer::has_alpha() const +{ + if (video_codec_context()->pix_fmt == -1) { + return false; + } + + auto const d = av_pix_fmt_desc_get(video_codec_context()->pix_fmt); + DCPOMATIC_ASSERT(d); + return d->flags & AV_PIX_FMT_FLAG_ALPHA; +} + + bool FFmpegExaminer::yuv () const { diff --git a/src/lib/ffmpeg_examiner.h b/src/lib/ffmpeg_examiner.h index 10d060707..4747929b5 100644 --- a/src/lib/ffmpeg_examiner.h +++ b/src/lib/ffmpeg_examiner.h @@ -77,6 +77,8 @@ public: boost::optional bits_per_pixel () const; + bool has_alpha() const; + boost::optional rotation () const { return _rotation; } -- cgit v1.2.3