c++ - How to get pixel bit count using PixelFormat in libav -


Is there a way to get a bit count of pixels from the codecContext.pix_fmt type PixelFormat? I use it manually:

  switch (OUT_IMAGE_FORMAT) {case PIX_FMT_RGB24: pVideoInfo-> bmiHeader.biBitCount = 24; do something(); break; // etc}   

But it requires manual updates every time, when libav will add or remove some pixel formats. Or if I need to add some pixel formats that were not previously supported.

PS I need to fill CMediaType for the DirectShow filter, so bits_per_raw_sample is not suitable because it is internal use as I know.

Try to use

  #include "libavutil / pixdesc .h "pVideoInfo-> bmiHeader.biBitCount = av_get_bits_per_pixel (and av_pix_fmt_descriptors [OUT_IMAGE_FORMAT]);   



Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

memcached - Django cache performance -

java : convert string value to int -