Skip to content

Commit

Permalink
Merge pull request #620 from OpenShot/fix-alpha-frank-rocks
Browse files Browse the repository at this point in the history
Thanks to @ferdnyc for the suggestion to better detect alpha channels.
  • Loading branch information
jonoomph committed Jan 27, 2021
2 parents ec31234 + d6ec5da commit 1e03d2c
Showing 1 changed file with 4 additions and 26 deletions.
30 changes: 4 additions & 26 deletions src/FFmpegUtilities.h
Expand Up @@ -127,32 +127,10 @@
#endif

// Does ffmpeg pixel format contain an alpha channel?
inline static const bool ffmpeg_has_alpha(PixelFormat pix_fmt)
{
if (pix_fmt == AV_PIX_FMT_ARGB ||
pix_fmt == AV_PIX_FMT_RGBA ||
pix_fmt == AV_PIX_FMT_ABGR ||
pix_fmt == AV_PIX_FMT_BGRA ||
pix_fmt == AV_PIX_FMT_YUVA420P ||
pix_fmt == AV_PIX_FMT_YA16LE ||
pix_fmt == AV_PIX_FMT_YA16BE ||
pix_fmt == AV_PIX_FMT_YA8 ||
pix_fmt == AV_PIX_FMT_GBRAP ||
pix_fmt == AV_PIX_FMT_GBRAP10BE ||
pix_fmt == AV_PIX_FMT_GBRAP10LE ||
pix_fmt == AV_PIX_FMT_GBRAP12BE ||
pix_fmt == AV_PIX_FMT_GBRAP12LE ||
pix_fmt == AV_PIX_FMT_GBRAP16BE ||
pix_fmt == AV_PIX_FMT_GBRAP16LE ||
pix_fmt == AV_PIX_FMT_GBRPF32BE ||
pix_fmt == AV_PIX_FMT_GBRPF32LE ||
pix_fmt == AV_PIX_FMT_GBRAPF32BE ||
pix_fmt == AV_PIX_FMT_GBRAPF32LE) {
return true;
} else {
return false;
}
}
inline static const bool ffmpeg_has_alpha(PixelFormat pix_fmt) {
const AVPixFmtDescriptor *fmt_desc = av_pix_fmt_desc_get(pix_fmt);
return bool(fmt_desc->flags & AV_PIX_FMT_FLAG_ALPHA);
}

// FFmpeg's libavutil/common.h defines an RSHIFT incompatible with Ruby's
// definition in ruby/config.h, so we move it to FF_RSHIFT
Expand Down

0 comments on commit 1e03d2c

Please sign in to comment.