Bug 490650 - src/musicbrainz/MusicDNSAudioDecoder.cpp fails to build on Ubuntu Jammy with Amarok git
Summary: src/musicbrainz/MusicDNSAudioDecoder.cpp fails to build on Ubuntu Jammy with ...
Status: RESOLVED FIXED
Alias: None
Product: amarok
Classification: Applications
Component: general (show other bugs)
Version: 3.0.81
Platform: Other Linux
: NOR normal
Target Milestone: kf5
Assignee: Amarok Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-07-22 14:40 UTC by Joseph Yasi
Modified: 2024-07-22 23:19 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph Yasi 2024-07-22 14:40:52 UTC
***
If you're not sure this is actually a bug, instead post about it at https://discuss.kde.org

If you're reporting a crash, attach a backtrace with debug symbols; see https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***

SUMMARY
src/musicbrainz/MusicDNSAudioDecoder.cpp fails to compile with Ubuntu Jammy's version of FFMPEG (4.4.2)

STEPS TO REPRODUCE
1. Compile Amarok on Ubuntu Jammy from git after 42d249b659253b8970bd870d77a56c869e79bcef and f6143b2df0b251f3e5e5665ea7121e49b0f45d7e.

OBSERVED RESULT
/<<PKGBUILDDIR>>/src/musicbrainz/MusicDNSAudioDecoder.cpp: In member function ‘int MusicDNSAudioDecoder::decode(const QString&, DecodedAudioData*, int)’:
/<<PKGBUILDDIR>>/src/musicbrainz/MusicDNSAudioDecoder.cpp:327:63: error: invalid user-defined conversion from ‘QByteArray’ to ‘const char*’ [-fpermissive]
  327 |     if( avformat_open_input( &pFormatCtx, fileName.toLocal8Bit(), nullptr, nullptr ) < 0 )
      |                                           ~~~~~~~~~~~~~~~~~~~~^~
See: https://launchpadlibrarian.net/740431669/buildlog_ubuntu-jammy-amd64.amarok_2%3A3.0.1+git202407210215-0+yasi1~22~ubuntu22.04.1_BUILDING.txt.gz

EXPECTED RESULT
Compilation succeeds.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Kubuntu 22.04
(available in About System)
KDE Plasma Version: 5.24.7
KDE Frameworks Version: 5.92
Qt Version: 5.15.3

ADDITIONAL INFORMATION
fileName.toLocal8Bit().constData() looks like it was made in one of the FFMPEG version branches, but not in the #elif LIBAVCODEC_VERSION_MAJOR >= 54 branch.
Comment 1 Tuomas Nurmi 2024-07-22 23:19:12 UTC
Thank you again for noticing! That's a sneaky place in code. Maybe I'll clean up some bits too while I'm at it, as the older codepaths have been bypassed by various modernization efforts, and still to use NULL etc.
Comment 2 Tuomas Nurmi 2024-07-22 23:19:44 UTC
Git commit 622440b76f3c174b41072fd358bd5f7ffdf6aca5 by Tuomas Nurmi.
Committed on 22/07/2024 at 23:13.
Pushed by nurmi into branch 'master'.

Fix compilation with ffmpeg < 5

Also drop some code for ffmpeg 0.10 and older, which were released 10+ years ago.

M  +1    -463  src/musicbrainz/MusicDNSAudioDecoder.cpp

https://invent.kde.org/multimedia/amarok/-/commit/622440b76f3c174b41072fd358bd5f7ffdf6aca5