[FFmpeg-devel] [PATCH] Document and validate AVFrame plane pointers.

Reimar Döffinger Reimar.Doeffinger at gmx.de
Sat Feb 27 12:52:10 CET 2016


On Sat, Feb 27, 2016 at 02:21:18AM +0100, Michael Niedermayer wrote:
> On Fri, Feb 26, 2016 at 11:06:22PM +0100, Reimar Döffinger wrote:
> > +static void validate_avframe_allocation(const AVCodecContext *avctx, AVFrame *frame)
> > +{
> > +    if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) {
> > +        int i;
> > +        int num_planes = av_pix_fmt_count_planes(frame->format);
> > +        for (i = 0; i < num_planes; i++) {
> > +            av_assert0(frame->data[i]);
> > +        }
> > +        // for formats without data like hwaccel allow
> > +        // pointers to be non-NULL.
> 
> > +        for (i = num_planes; num_planes > 0 && i < num_planes; i++) {
> 
> are both of i = num_planes and i < num_planes intended ?

That uncovered a few more issues.

> some note in APIChanges or release notes or something might make sense
> too

Hm. Forgot about that in latest version.
Also, why can't I pass a "const AVCodecContext *" to av_log?
That is kind of inconvenient.


More information about the ffmpeg-devel mailing list