Weird rename name

I am compiling a project that uses both ffmpeg and Ogre. Now everything works fine on Windows.

But when I want to compile a file with the following line of code:

Ogre::PixelFormat format = Ogre::PF_BYTE_RGBA; 

The compiler produces the following error:

 error: 'AVPixelFormat' is not a member of 'Ogre' 

Which is strange in many ways, since I not only specified the Ogre namespace with ::, but also no AVPixelFormat in Ogre. How does gcc confuse "PixelFormat" with "AVPixelFormat"?

And how can I get rid of this?

I would like to use int here instead of enum, but another Ogre function requires the format to be in Ogre :: PixelFormat.

+4
source share
2 answers

Pre-process it using gcc -E , then grep through a file looking for AVPixelFormat or PixelFormat . I suspect that you are floating #define or typedef , you just need to find where this is happening, and the precompiled source file is the place that will become apparent.

+6
source

The problem is avutil / pixfmt.h:

 #define PixelFormat AVPixelFormat 

This prevents users from using the word "PixelFormat" anywhere in their own code, even if in namespaces.

This is like a compatibility hack for older software that still uses older identifiers.

The solution is pretty simple if you can edit the code. Just add C ++ a code

 #define FF_API_PIX_FMT 0 

before including ffmpeg headers.

This disables the if in the pixfmt.h header:

 #if FF_API_PIX_FMT #define PixelFormat AVPixelFormat ... 

Source: https://trac.ffmpeg.org/ticket/4216

PS I know that the question is old, but for some reason I feel that there is no solution, and I need a solution, so I added it.

+3
source

All Articles