[FFmpeg-devel] [PATCH] pixdesc: Add av_get_pix_fmt_descriptor()

Tomas Härdin tomas.hardin
Thu Jul 8 15:36:34 CEST 2010


On Thu, 2010-07-08 at 14:25 +0100, M?ns Rullg?rd wrote:
> Tomas H?rdin <tomas.hardin at codemill.se> writes:
> 
> > Hi
> >
> > While poking around with MinGW compiled lav* DLLs in MSVC I noticed
> > link.exe can't resolve references to av_pix_fmt_descriptors. This is due
> > to how import libraries work, but I'm not an expert. The important thing
> > is that only functions get exported properly - globals don't.
> 
> I vaguely recall us having similar problems a few years ago.  I think
> the offending variable ended up being removed eventually for other
> reasons.
> 
> > To fix this I propose the lavu API be extended with a function
> > called av_get_pix_fmt_descriptor which returns a pointer to an
> > AVPixFmtDescriptor for a specified format.
> >
> > There are probably more globals that have this problem, but some quick
> > greping didn't yield many results.
> >
> > Patch attached. Minor version bump included.
> >
> > (I assume av_pix_fmt_descriptors is meant to be user accessible since
> > ffplay uses it and certain information contained within can't be
> > accessed any other way)
> >
> > /Tomas
> >
> > diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
> > index 6233680..f86cdde 100644
> > --- a/libavutil/pixdesc.c
> > +++ b/libavutil/pixdesc.c
> > @@ -789,6 +789,11 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
> >      },
> >  };
> >  
> > +const AVPixFmtDescriptor* av_get_pix_fmt_descriptor(enum PixelFormat pix_fmt)
> > +{
> > +    return &av_pix_fmt_descriptors[pix_fmt];
> > +}
> 
> This might need a bounds check.  If pixel formats are added, calling
> an older library with a new format would have bad consequences.  Do we
> care about such a situation?
> 

I'd say we do. New patch attached.

/Tomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pix_desc2.patch
Type: text/x-patch
Size: 1522 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100708/84af4b9e/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100708/84af4b9e/attachment.pgp>



More information about the ffmpeg-devel mailing list