Project

General

Profile

Bug #1159

ffaudio fails to compile with FFmpeg 5.0

Added by Thomas Lange 4 months ago. Updated 4 months ago.

Status:
Closed
Priority:
Minor
Assignee:
-
Category:
plugins/ffaudio
Target version:
Start date:
February 27, 2022
Due date:
% Done:

100%

Estimated time:
Affects version:

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

ffaudio.diff (2.21 KB) ffaudio.diff Thomas Lange, March 01, 2022 01:37

History

#1 Updated by Thomas Lange 4 months ago

This causes build failures when using "-fpermissive".

Obviously missing a "not"...

#2 Updated by John Lindgren 4 months 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 4 months ago

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 4 months 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 4 months 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.

Also available in: Atom PDF