[FFmpeg-devel] [RFC] Request for pixdesc API review

Stefano Sabatini stefano.sabatini-lala
Mon Nov 23 22:00:09 CET 2009

On date Monday 2009-11-16 00:43:02 +0100, Stefano Sabatini encoded:
> * I also wonder if:
>   int av_get_bits_per_pixel(enum PixelFormat pix_fmt);
>   would be preferable to the current:
>   bits = av_get_bits_per_pixel(&av_pix_fmt_descriptors[pix_fmt]);
>   The first signature is easier to use in the most common scenario,
>   when the user has the pix_fmt and she wants to extracts the bits:
>   bits = av_get_bits_per_pixel(pix_fmt);
>   which is far simpler than:
>   bits = av_get_bits_per_pixel(&av_pix_fmt_descriptors[pix_fmt]);

First of all note that I consider this a very minor issue, after some
thought I concluded that I like the best av_get_bits_per_pixel(pix_desc)
since it is more flexible (for example it allows to compute the
bits-per-pixel value of a pixdesc not defined in the
av_pix_fmt_descriptors array).

But at the same time maybe would be useful a function of the kind:

int av_get_bits_per_pixel2(enum PixelFormat pix_fmt)
    return av_get_bits_per_pixel(&av_pix_fmt_descriptors[pix_fmt]);

which is easier to use for most use cases.

But then as I said this is a very minor minor issue, so I'm reasonably
happy also without it and someone (hi michael) may say that such an
av_get_bits_per_pixel2 stuff is only good for bloating the API.

FFmpeg = Faithful and Fierce Mere Pitiful Exxagerate Guide

More information about the ffmpeg-devel mailing list