[FFmpeg-devel] [PATCH 1/2] avformat/mxfdec: Don't use wrong type of pointer

Tomas Härdin tjoppen at acc.umu.se
Mon Mar 15 22:28:22 EET 2021


mån 2021-03-15 klockan 19:48 +0100 skrev Andreas Rheinhardt:
> Tomas Härdin:
> > mån 2021-03-15 klockan 14:38 +0100 skrev Andreas Rheinhardt:
> > > Tomas Härdin:
> > > > fre 2021-03-12 klockan 14:07 +0100 skrev Andreas Rheinhardt:
> > > > > @@ -2922,20 +2929,19 @@ static int mxf_read_local_tags(MXFContext *mxf, KLVPacket *klv, MXFMetadataReadF
> > > > >                  }
> > > > >              }
> > > > >          }
> > > > > -        if (ctx_size && tag == 0x3C0A) {
> > > > > -            avio_read(pb, ctx->uid, 16);
> > > > > +        if (meta && tag == 0x3C0A) {
> > > > 
> > > > Why not keep this conditional on ctx_size? That way you could get rid
> > > > of ctx altogether
> > > > 
> > > 
> > > Because I consider it more natural to check for the existence of a
> > > MXFMetadataSet by checking whether a pointer to MXFMetadataSet is NULL
> > > or not. After all, ctx_size could also contain the size of the MXFContext.
> > 
> > No, it cannot. Look at mxf_metadata_read_table. ctx_size serves a dual
> > purpose: whether to pass MXFContext to read(), or to allocate a new
> > metadata element that is passed to read() instead.
> > 
> I know that it can't (yes, I looked at that table), but just judging
> from its name, ctx_size could also be the size of the MXFContext. And
> that's why I think that using a MXFMetadataSet* is more natural.

Except it isn't sizeof(MXFContext). It's zero. But anyway, this is
bikeshedding on my part since it'll work the same. I have a little
patch that adds some documentation to the function to clarify what
ctx_size does.

/Tomas



More information about the ffmpeg-devel mailing list