On Fri, Feb 26, 2016 at 10:39:41PM +0100, wm4 wrote: > On Fri, 26 Feb 2016 22:25:21 +0100 > Reimar Döffinger <reimar.doeffin...@gmx.de> wrote: > > > Check that the required plane pointers and only > > those are set up. > > > > Signed-off-by: Reimar Döffinger <reimar.doeffin...@gmx.de> > > --- > > libavcodec/utils.c | 14 ++++++++++++++ > > libavutil/frame.h | 3 +++ > > 2 files changed, 17 insertions(+) > > > > diff --git a/libavcodec/utils.c b/libavcodec/utils.c > > index af21cdd..af5ff93 100644 > > --- a/libavcodec/utils.c > > +++ b/libavcodec/utils.c > > @@ -885,6 +885,20 @@ static int get_buffer_internal(AVCodecContext *avctx, > > AVFrame *frame, int flags) > > avctx->sw_pix_fmt = avctx->pix_fmt; > > > > ret = avctx->get_buffer2(avctx, frame, flags); > > + if (ret >= 0 && 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++) { > > + if (frame->data[i]) > > + av_log(avctx, AV_LOG_ERROR, "Buffer returned by > > get_buffer2() did not zero unused plane pointers\n"); > > + frame->data[i] = NULL; > > + } > > + } > > > > Can you move it to a separate function? Say, ff_verify_frame(). This > could get much more complicated too when checking AVBufferRef usage or > audio.
Why ff_? If we've decided on it and use it in other places it might become a av_* function in libavutil. But until then I guess it should be a static function in that file? _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel