[FFmpeg-devel] Should there be IsAlphaPixelFormat ?

Don Moir donmoir at comcast.net
Wed Jan 23 01:59:14 CET 2013

Currently I extract the code from swscale_internal.h:

static av_always_inline int isALPHA(enum AVPixelFormat pix_fmt)
    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
    return desc->nb_components == 2 || desc->nb_components == 4;

This is useful for to determine if I should create a transparent or non-transparent texture.

Although I don't know why it checks nb_components instead of desc->flags & AV_FMT_ALPHA. nb_components of 2 and 4 always == ALPHA but seems flags should be used instead. AV_FMT_ALPHA is always set for alpha formats.

So I need to include libavutil/pixdesc.h to gain access to AVPixFmtDescriptor.

Wondering if you think this should be exported generally ?

More information about the ffmpeg-devel mailing list