[VDPAU] [PATCH] Fix incorrect VdpDecoderRender signature.
Stephen Warren
swarren at nvidia.com
Tue Feb 18 14:24:28 PST 2014
Reimar Döffinger wrote at Tuesday, February 18, 2014 2:40 PM:
> On Tue, Feb 18, 2014 at 08:42:09AM -0800, Stephen Warren wrote:
> > Reimar Döffinger wrote at Sunday, February 16, 2014 12:14 PM:
> > > VdpPictureInfo is already a pointer to e.g. a VdpPictureInfoH264,
> > > and that is what the function expects, it does not expect
> > > a pointer to a pointer as the signature claims.
> > > This also requires a new typedef to keep the const attribute.
> >
> > Good catch, but ...
> >
> > > diff --git a/include/vdpau/vdpau.h b/include/vdpau/vdpau.h
> >
> > > typedef void * VdpPictureInfo;
> > > +typedef const void * ConstVdpPictureInfo;
> >
> > I think this would be better served by the following:
> >
> > - typedef void * VdpPictureInfo;
> > + typedef struct VdpPictureInfo VdpPictureInfo;
>
> There is no "struct VdpPictureInfo" I can see anywhere? (and that is
> almost certainly intentional since adding a new, larger
> VdpPictureInfoSomething would break API/ABI if there was such a generic
> type)
Correct; the patch above should create an undefined struct type.
Perhaps you'd need to add "struct VdpPictureInfo" too.
> It would mean you could no longer pass in a VdpPictureInfoMPEG1Or2 *
> without needing a cast.
I think you'd already need a cast, since no code is passing the current
parameter type either, and since it's not void*, the conversion shouldn't
be automatic. This should warn with any reasonable warning level.
> There is also the problem that this would change API more
> significantly.
> If someone placed a VdpPictureInfo field into a struct for example
> this change will break their code, since it refuses to compile.
Why would you do that?
> > > @@ -3017,7 +3018,7 @@ typedef VdpPictureInfoMPEG4Part2 VdpPictureInfoDivX5;
> > > typedef VdpStatus VdpDecoderRender(
> > > VdpDecoder decoder,
> > > VdpVideoSurface target,
> > > - VdpPictureInfo const * picture_info,
> > > + ConstVdpPictureInfo picture_info,
> >
> > ... and dropping that change.
> >
> > That way, all of VdpPictureInfo (the generic version) and VdpPictureInfo*
> > (the various concrete structures) are all structs, rather than the generic
> > version being a pointer instead.
>
> I agree this would be nicer, but I can't see how it would be possible.
If my original suggestion doesn't work, just change the parameter to
a "void const *" and avoid any typedefs.
--
nvpublic
More information about the VDPAU
mailing list