Previously I used ffmpeg on windows (0.52 build I found somewhere). Now I am porting to linux and to latest ffmpeg. So far I got 4 errors in 2 lines
On such simple line:
size = avpicture_get_size(pix_fmt, nWidth, nHeight);
I get:
initializing argument 1 of ‘int avpicture_get_size(PixelFormat, int, int)’ C/C++ Problem
and
invalid conversion from ‘int’ to ‘PixelFormat’ C/C++ Problem
And On such simple line
avpicture_fill((AVPicture *)picture, picture_buf, pix_fmt, nWidth, nHeight);
I get:
initializing argument 3 of ‘int avpicture_fill(AVPicture*, uint8_t*, PixelFormat, int, int)’ C/C++ Problem
and
invalid conversion from ‘int’ to ‘PixelFormat’ C/C++ Problem
Code compiled and worked perfectly under Windows ffmpeg 0.52 but now gives such error on linux g++ on ffmpeg 0.6.1
How to fix such errors?
PixelFormatis defined as an enum in pixfmt.h. I think that the problem is that in C++, there is no implicit conversion from anintto anenum. So, you need to explicitly convert theinttoPixelFormat. Try this:or you could just make
pix_fmtaPixelFormatinstead of an int.I don’t know why this worked previously, because C++ does not allow
inttoenumconversion without a cast. I think C does allow this though so maybe it was being compiled s C previously.Edit: I just saw the API change from int to enum. So that is why it compiled previously.