Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't build with FFMpeg 6.0 #2635

Open
Vascom opened this issue Mar 1, 2023 · 3 comments
Open

Can't build with FFMpeg 6.0 #2635

Vascom opened this issue Mar 1, 2023 · 3 comments

Comments

@Vascom
Copy link

Vascom commented Mar 1, 2023

FFMpeg removed AV_CODEC_CAP_TRUNCATED and CODEC_CAP_TRUNCATED definitions and now I can't build MegaSync with this error:

mega/src/gfx/freeimage.cpp: In member function 'bool mega::GfxProviderFreeImage::readbitmapFfmpeg(mega::FileSystemAccess*, const mega::LocalPath&, int)':
mega/src/gfx/freeimage.cpp:215:23: error: 'CODEC_CAP_TRUNCATED' was not declared in this scope; did you mean 'CAP_TRUNCATED'?
  215 | #define CAP_TRUNCATED CODEC_CAP_TRUNCATED
      |                       ^~~~~~~~~~~~~~~~~~~
mega/src/gfx/freeimage.cpp:334:33: note: in expansion of macro 'CAP_TRUNCATED'
  334 |     if (decoder->capabilities & CAP_TRUNCATED)
      |                                 ^~~~~~~~~~~~~
mega/src/gfx/freeimage.cpp:406:19: warning: 'void av_init_packet(AVPacket*)' is deprecated [-Wdeprecated-declarations]
  406 |     av_init_packet(&packet);
      |     ~~~~~~~~~~~~~~^~~~~~~~~
In file included from /usr/include/ffmpeg/libavformat/avformat.h:316:
/usr/include/ffmpeg/libavcodec/packet.h:512:6: note: declared here
  512 | void av_init_packet(AVPacket *pkt);
      |      ^~~~~~~~~~~~~~
make[1]: *** [Makefile:13285: freeimage.o] Error 1

Please help me fix it.

Commit at ffmpeg in that removed definitions: https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/3ceffe783965767e62d59e8e68ecd265c98460ec

@Vascom
Copy link
Author

Vascom commented Apr 4, 2023

This patch solve the problem.

--- src/MEGASync/mega/src/gfx/freeimage.cpp.orig
+++ src/MEGASync/mega/src/gfx/freeimage.cpp
@@ -209,11 +209,13 @@ bool GfxProviderFreeImage::readbitmapFre
 
 #ifdef HAVE_FFMPEG
 
+#if LIBAVCODEC_VERSION_MAJOR < 60
 #ifdef AV_CODEC_CAP_TRUNCATED
 #define CAP_TRUNCATED AV_CODEC_CAP_TRUNCATED
 #else
 #define CAP_TRUNCATED CODEC_CAP_TRUNCATED
 #endif
+#endif
 
 const char *GfxProviderFreeImage::supportedformatsFfmpeg()
 {
@@ -331,10 +333,12 @@ bool GfxProviderFreeImage::readbitmapFfm
     // Force seeking to key frames
     formatContext->seek2any = false;
     videoStream->skip_to_keyframe = true;
+#if LIBAVCODEC_VERSION_MAJOR < 60
     if (decoder->capabilities & CAP_TRUNCATED)
     {
         codecContext->flags |= CAP_TRUNCATED;
     }
+#endif
 
     AVPixelFormat sourcePixelFormat = static_cast<AVPixelFormat>(codecParm->format);
     AVPixelFormat targetPixelFormat = AV_PIX_FMT_BGR24; //raw data expected by freeimage is in this format

@sl1pkn07
Copy link

sl1pkn07 commented May 7, 2023

Hi

can you summit a PR for better track?

greetings

@HeronErin
Copy link

I am having this issue aswell, and the patch solves the compilation issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants