<p>Hi,</p><p><br />When opening a media i need to check if the pixel format holds an alpha channel.<br />I can check for the alpha flag in the pixel format description, like this:<br />const AVPixFmtDescriptor *pixDesc = av_pix_fmt_desc_get(pix_format);<br />bool has_alpha = pixDesc->flags & AV_PIX_FMT_FLAG_ALPHA;<br /><br />But i noticed that inside libavutil/pixdesc.c there is a function for checking for an alpha channel, which is defined like this:<br />#define pixdesc_has_alpha(pixdesc) ((pixdesc)->nb_components == 2 || (pixdesc)->nb_components == 4 || (pixdesc)->flags & AV_PIX_FMT_FLAG_PAL)<br />I understand the use of AV_PIX_FMT_FLAG_PAL as it is an exception, but could a pixel format with alpha have a number of components different from 2 and 4? <br /><br />So, which one of the two methods is more reliable?<br /><br />Any advice would be much appreciated.<br />Thank you,<br /><br />Simone.</p>