[FFmpeg-devel] [PATCH] Generalize pixel format enum fields to int formats

Stefano Sabatini stefano.sabatini-lala
Wed Jul 21 15:39:11 CEST 2010


On date Wednesday 2010-07-21 12:10:37 +0200, Stefano Sabatini encoded:
> On date Wednesday 2010-07-21 02:38:28 -0700, S.N. Hemanth Meenakshisundaram encoded:
[...]
> > -AVFilterFormats *avfilter_all_colorspaces(void)
> > +AVFilterFormats *avfilter_all_formats(enum AVMediaType type)
> >  {
> >      AVFilterFormats *ret = NULL;
> > -    enum PixelFormat pix_fmt;
> > +    int fmt;
> > +    int num_formats = type == AVMEDIA_TYPE_VIDEO ? PIX_FMT_NB : 0;
> >  
> > -    for (pix_fmt = 0; pix_fmt < PIX_FMT_NB; pix_fmt++)
> > -        if (!(av_pix_fmt_descriptors[pix_fmt].flags & PIX_FMT_HWACCEL))
> > -            avfilter_add_colorspace(&ret, pix_fmt);
> 
> > +    for (fmt = 0; fmt < num_formats; fmt++)
> > +        if ((type != AVMEDIA_TYPE_VIDEO) ||
> > +            !(av_pix_fmt_descriptors[fmt].flags & PIX_FMT_HWACCEL))
> > +            avfilter_add_format(&ret, fmt);
> 
> This is wrong if type != VIDEO.
> 
>        if (((type == AVMEDIA_TYPE_VIDEO) && !(av_pix_fmt_descriptors[fmt].flags & PIX_FMT_HWACCEL))
>            || type != VIDEO)
>            ...
> 
> [...]

Err forget about that, *I* was wrong, anyway I find that expression a
little confusing.
 
> Also missing APIchanges entry (I'll apply that in a separate commit).
> 
> Apart from this, patch looks fine to apply, Michael?

Regards.
-- 
FFmpeg = Fierce and Faithless Merciful Picky Earthshaking Ghost



More information about the ffmpeg-devel mailing list