Bug #1159
ffaudio fails to compile with FFmpeg 5.0
100%
Description
With FFmpeg 5.0 (shipped meanwhile by Arch Linux), some APIs return const pointers now.
This causes build failures when using "-fpermissive".
ffaudio-core.cc: In function ‘AVInputFormat* get_format_by_content(const char*, VFSFile&)’: ffaudio-core.cc:291:36: error: invalid conversion from ‘const AVInputFormat*’ to ‘AVInputFormat*’ [-fpermissive] 291 | f = av_probe_input_format2 (& d, true, & score); | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~ | | | const AVInputFormat* ffaudio-core.cc: In function ‘bool find_codec(AVFormatContext*, CodecInfo*)’: ffaudio-core.cc:364:52: error: invalid conversion from ‘const AVCodec*’ to ‘AVCodec*’ [-fpermissive] 364 | AVCodec * codec = avcodec_find_decoder (stream->codecpar->codec_id); | ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | const AVCodec*
Workaround by Arch Linux: https://github.com/archlinux/svntogit-packages/commit/40cc5f012245a25c182afe3cd6ec27056381bbe4
History
#1 Updated by Thomas Lange over 2 years ago
This causes build failures when using "-fpermissive".
Obviously missing a "not"...
#2 Updated by John Lindgren over 2 years ago
Is it enough just to add "const" in our code? Or does that break things with older ffmpeg versions?
#3 Updated by Thomas Lange over 2 years ago
- File ffaudio.diff ffaudio.diff added
It does not work directly, but we can cast away the "const" for "avformat_open_input()".
The attached patch compiles with FFmpeg 4.4 and 5.0, tested with/without "export PKG_CONFIG_PATH='/usr/lib/ffmpeg4.4/pkgconfig'".
Could you try it on an older distribution and/or Windows as well please?
#4 Updated by Artem S. Tashkinov over 2 years ago
Thomas Lange wrote:
Could you try it on an older distribution and/or Windows as well please?
Thanks for the patch, works fine with ffmpeg 5.0. Cannot test with ffmpeg 4.4 at the moment.
#5 Updated by John Lindgren over 2 years ago
- % Done changed from 0 to 100
- Target version set to 4.2
- Status changed from New to Closed
This should be fixed in master now.