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

ffmpeg 7.x incompatibility #685

Open
meanjollies opened this issue Jun 22, 2024 · 7 comments
Open

ffmpeg 7.x incompatibility #685

meanjollies opened this issue Jun 22, 2024 · 7 comments

Comments

@meanjollies
Copy link

It appears there have been a number of API changes with the release of ffmpeg 7.0, some of which are not backward compatible. As a result, musikcube fails to build:

[ 55%] Building CXX object src/plugins/ffmpegdecoder/CMakeFiles/ffmpegdecoder.dir/plugin.cpp.o
[ 56%] Building CXX object src/plugins/ffmpegdecoder/CMakeFiles/ffmpegdecoder.dir/FfmpegDecoder.cpp.o
/home/a/musikcube/musikcube-3.0.2/src/plugins/ffmpegdecoder/FfmpegDecoder.cpp: In member function ‘bool FfmpegDecoder::InitializeResampler()’:
/home/a/musikcube/musikcube-3.0.2/src/plugins/ffmpegdecoder/FfmpegDecoder.cpp:270:29: error: ‘AVCodecContext’ {aka ‘struct AVCodecContext’} has no member named ‘channel_layout’; did you mean ‘ch_layout’?
  270 |         this->codecContext->channel_layout,
      |                             ^~~~~~~~~~~~~~
      |                             ch_layout
/home/a/musikcube/musikcube-3.0.2/src/plugins/ffmpegdecoder/FfmpegDecoder.cpp:273:29: error: ‘AVCodecContext’ {aka ‘struct AVCodecContext’} has no member named ‘channel_layout’; did you mean ‘ch_layout’?
  273 |         this->codecContext->channel_layout,
      |                             ^~~~~~~~~~~~~~
      |                             ch_layout
/home/a/musikcube/musikcube-3.0.2/src/plugins/ffmpegdecoder/FfmpegDecoder.cpp:268:23: error: ‘swr_alloc_set_opts’ was not declared in this scope; did you mean ‘swr_alloc_set_opts2’?
  268 |     this->resampler = swr_alloc_set_opts(
      |                       ^~~~~~~~~~~~~~~~~~
      |                       swr_alloc_set_opts2
/home/a/musikcube/musikcube-3.0.2/src/plugins/ffmpegdecoder/FfmpegDecoder.cpp: In member function ‘virtual bool FfmpegDecoder::Open(musik::core::sdk::IDataStream*)’:
/home/a/musikcube/musikcube-3.0.2/src/plugins/ffmpegdecoder/FfmpegDecoder.cpp:303:13: error: invalid conversion from ‘int (*)(void*, uint8_t*, int)’ {aka ‘int (*)(void*, unsigned char*, int)’} to ‘int (*)(void*, const uint8_t*, int)’ {aka ‘int (*)(void*, const unsigned char*, int)’} [-fpermissive]
  303 |             writeCallback,
      |             ^~~~~~~~~~~~~
      |             |
      |             int (*)(void*, uint8_t*, int) {aka int (*)(void*, unsigned char*, int)}
In file included from /home/a/musikcube/musikcube-3.0.2/src/plugins/ffmpegdecoder/FfmpegDecoder.h:43,
                 from /home/a/musikcube/musikcube-3.0.2/src/plugins/ffmpegdecoder/FfmpegDecoder.cpp:35:
/usr/include/libavformat/avio.h:404:25: note:   initializing argument 6 of ‘AVIOContext* avio_alloc_context(unsigned char*, int, int, void*, int (*)(void*, uint8_t*, int), int (*)(void*, const uint8_t*, int), int64_t (*)(void*, int64_t, int))’
  404 |                   int (*write_packet)(void *opaque, const uint8_t *buf, int buf_size),
      |                   ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/a/musikcube/musikcube-3.0.2/src/plugins/ffmpegdecoder/FfmpegDecoder.cpp:367:53: error: ‘AVCodecContext’ {aka ‘struct AVCodecContext’} has no member named ‘channel_layout’; did you mean ‘ch_layout’?
  367 |                             if (this->codecContext->channel_layout == 0) {
      |                                                     ^~~~~~~~~~~~~~
      |                                                     ch_layout
/home/a/musikcube/musikcube-3.0.2/src/plugins/ffmpegdecoder/FfmpegDecoder.cpp:368:53: error: ‘AVCodecContext’ {aka ‘struct AVCodecContext’} has no member named ‘channel_layout’; did you mean ‘ch_layout’?
  368 |                                 this->codecContext->channel_layout =
      |                                                     ^~~~~~~~~~~~~~
      |                                                     ch_layout
/home/a/musikcube/musikcube-3.0.2/src/plugins/ffmpegdecoder/FfmpegDecoder.cpp:369:87: error: ‘AVCodecContext’ {aka ‘struct AVCodecContext’} has no member named ‘channels’
  369 |                                     av_get_default_channel_layout(this->codecContext->channels);
      |                                                                                       ^~~~~~~~
/home/a/musikcube/musikcube-3.0.2/src/plugins/ffmpegdecoder/FfmpegDecoder.cpp:369:37: error: ‘av_get_default_channel_layout’ was not declared in this scope
  369 |                                     av_get_default_channel_layout(this->codecContext->channels);
      |                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/a/musikcube/musikcube-3.0.2/src/plugins/ffmpegdecoder/FfmpegDecoder.cpp:383:60: error: ‘AVCodecParameters’ {aka ‘struct AVCodecParameters’} has no member named ‘channels’
  383 |                         this->channels = stream->codecpar->channels;
      |                                                            ^~~~~~~~
/home/a/musikcube/musikcube-3.0.2/src/plugins/ffmpegdecoder/FfmpegDecoder.cpp: In member function ‘AVFrame* FfmpegDecoder::AllocFrame(AVFrame*, AVSampleFormat, int, int)’:
/home/a/musikcube/musikcube-3.0.2/src/plugins/ffmpegdecoder/FfmpegDecoder.cpp:594:55: error: ‘AVCodecContext’ {aka ‘struct AVCodecContext’} has no member named ‘channel_layout’; did you mean ‘ch_layout’?
  594 |         const int channelLayout = this->codecContext->channel_layout == 0
      |                                                       ^~~~~~~~~~~~~~
      |                                                       ch_layout
/home/a/musikcube/musikcube-3.0.2/src/plugins/ffmpegdecoder/FfmpegDecoder.cpp:595:65: error: ‘AVCodecContext’ {aka ‘struct AVCodecContext’} has no member named ‘channels’
  595 |             ? av_get_default_channel_layout(this->codecContext->channels)
      |                                                                 ^~~~~~~~
/home/a/musikcube/musikcube-3.0.2/src/plugins/ffmpegdecoder/FfmpegDecoder.cpp:595:15: error: ‘av_get_default_channel_layout’ was not declared in this scope
  595 |             ? av_get_default_channel_layout(this->codecContext->channels)
      |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/a/musikcube/musikcube-3.0.2/src/plugins/ffmpegdecoder/FfmpegDecoder.cpp:596:35: error: ‘AVCodecContext’ {aka ‘struct AVCodecContext’} has no member named ‘channel_layout’; did you mean ‘ch_layout’?
  596 |             : this->codecContext->channel_layout;
      |                                   ^~~~~~~~~~~~~~
      |                                   ch_layout
/home/a/musikcube/musikcube-3.0.2/src/plugins/ffmpegdecoder/FfmpegDecoder.cpp:598:19: error: ‘AVFrame’ {aka ‘struct AVFrame’} has no member named ‘channel_layout’; did you mean ‘ch_layout’?
  598 |         original->channel_layout = channelLayout;
      |                   ^~~~~~~~~~~~~~
      |                   ch_layout
make[2]: *** [src/plugins/ffmpegdecoder/CMakeFiles/ffmpegdecoder.dir/build.make:90: src/plugins/ffmpegdecoder/CMakeFiles/ffmpegdecoder.dir/FfmpegDecoder.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:867: src/plugins/ffmpegdecoder/CMakeFiles/ffmpegdecoder.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
@meanjollies meanjollies changed the title ffmpeg 7.x incompatbility ffmpeg 7.x incompatibility Jun 22, 2024
@sudoAlphaX
Copy link

Confirmed. Fails to build using musikcube AUR package with ffmpeg version 7.0.1

@maxilla-0
Copy link

has something happened since then?

@sudoAlphaX
Copy link

sudoAlphaX commented Jul 4, 2024 via email

@clangen
Copy link
Owner

clangen commented Jul 5, 2024

Apologies, musikcube development has stalled the past 6 months or so -- real life sometimes takes priority.

This is a particularly bad breakage, so I spent the day working on a fix; I pushed a couple commits to the main branch and it seems to be working across the platforms I've been able to test thus far. My Intel mac machine is extremely old, slow and out of date, but once I can verify it's working in that environment I'll get a new release out.

For now: if you can compile from source pull the latest changes and give it a go.

@sudoAlphaX
Copy link

sudoAlphaX commented Jul 5, 2024

With latest commit 40a26d7, Im able to successfully build musikcube from source, but when running musikcube, it crashes:
I forgot to uninstall the version installed from AUR (musikcube-git)

./musikcube: error while loading shared libraries: libmusikcore.so: cannot open shared object file: No such file or directory

Host details:
Arch Linux x86_64
6.9.7-zen1-1-zen
ffmpeg v7.0.1

@sudoAlphaX
Copy link

Musicube works perfectly when built from source. Thank you very much.
Commit: 40a26d7

@meanjollies
Copy link
Author

I can also confirm musikcube builds and works fine again. @clangen thank you for your work on this, and I hope you've been taking care of yourself.

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

4 participants