[FFmpeg-devel] [PATCH] avcodec/zmbv: Simplify assigning decode_intra function pointer

Tomas Härdin tjoppen at acc.umu.se
Tue Oct 8 14:44:33 EEST 2019


mån 2019-10-07 klockan 16:42 +0000 skrev Andreas Rheinhardt:
> Tomas Härdin:
> > mån 2019-10-07 klockan 02:57 +0200 skrev Andreas Rheinhardt:
> > > zmbv has only one function for decoding intra frames, namely
> > > decode_intra. This can be used to simplify the process of choosing the
> > > right function pointer.
> > > 
> > > This also removes spec-incompliant conversions between function pointers
> > > and pointers of type void * and thereby fixes the warning "ISO C forbids
> > > assignment between function pointer and ‘void *’" that GCC emits with
> > > the -pedantic option.
> > > 
> > > Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
> > > ---
> > >  libavcodec/zmbv.c | 8 +-------
> > >  1 file changed, 1 insertion(+), 7 deletions(-)
> > 
> > Why not just call zmbv_decode_intra() directly?
> > 
> > /Tomas
> > 
> This is a few lines below:
> 
>     if (!c->decode_intra) {
>         av_log(avctx, AV_LOG_ERROR, "Error! Got no format or no
> keyframe!\n");
>         return AVERROR_INVALIDDATA;
>     }
> 
> So whether this function pointer is set or not is used as a test for
> initialisation or so. Not being familiar with this code I therefore
> opted to not change the observable outcome of it at all.

You could just replace that with a simple flag :)

/Tomas



More information about the ffmpeg-devel mailing list