Add FFmpegExaminer::has_alpha().
[dcpomatic.git] / src / lib / ffmpeg_examiner.cc
index 46f4f236e889515eca0254da7f7195be74efb5bb..ed6f210945960503ac303effc8d731af4554e4d2 100644 (file)
@@ -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
 {