Bug 485432 - Fail to build with ffmpeg 7
Summary: Fail to build with ffmpeg 7
Status: ASSIGNED
Alias: None
Product: k3b
Classification: Applications
Component: general (show other bugs)
Version: 24.02.2
Platform: Debian unstable Linux
: NOR normal
Target Milestone: ---
Assignee: k3b developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-04-12 12:58 UTC by marillat
Modified: 2024-10-19 02:12 UTC (History)
5 users (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 marillat 2024-04-12 12:58:21 UTC
Hi,

With ffmpeg 7 k3b fail to build with these errors

/home/marillat/src/k3b-24.02.2/plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp: In member function ‘bool K3bFFMpegFile::open()’:
/home/marillat/src/k3b-24.02.2/plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp:143:26: error: ‘AVCodecContext’ {aka ‘struct AVCodecContext’} has no member named ‘channels’
  143 |         d->codecContext->channels > 1;
      |                          ^~~~~~~~
/home/marillat/src/k3b-24.02.2/plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp: In member function ‘void K3bFFMpegFile::close()’:
/home/marillat/src/k3b-24.02.2/plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp:159:24: warning: ‘int avcodec_close(AVCodecContext*)’ is deprecated [-Wdeprecated-declarations]
  159 |         ::avcodec_close(d->codecContext);
      |         ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
In file included from /home/marillat/src/k3b-24.02.2/plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp:19:
/usr/include/x86_64-linux-gnu/libavcodec/avcodec.h:2387:5: note: declared here
 2387 | int avcodec_close(AVCodecContext *avctx);
      |     ^~~~~~~~~~~~~
/home/marillat/src/k3b-24.02.2/plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp: In member function ‘int K3bFFMpegFile::channels() const’:
/home/marillat/src/k3b-24.02.2/plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp:188:29: error: ‘AVCodecContext’ {aka ‘struct AVCodecContext’} has no member named ‘channels’
  188 |     return d->codecContext->channels;
Comment 1 Leslie Zhai 2024-04-13 03:14:56 UTC
Hi,

Thanks for your bug report!

FFmpeg avutil: remove deprecated FF_API_OLD_CHANNEL_LAYOUT[1] and tag as 7.0[2].

So add libavcodec version major check for FFmpeg in k3b side[3]. But I still need to migrate the deprecated `channels`[4] to FFmpeg v7.0. 

[1] https://patchwork.ffmpeg.org/project/ffmpeg/patch/20240125134425.374-17-jamrial@gmail.com/
[2] https://github.com/FFmpeg/FFmpeg/commit/65ddc74988245a01421a63c5cffa4d900c47117c
[3] https://github.com/KDE/k3b/commit/712ef4adc992fd848dfd769f346f87216029c285
[4] https://github.com/FFmpeg/FFmpeg/blob/n6.2-dev/libavcodec/avcodec.h#L1072

Thanks,
Leslie Zhai
Comment 2 marillat 2024-04-13 06:09:48 UTC
(In reply to Leslie Zhai from comment #1)
> Hi,
> https://github.com/KDE/k3b/commit/712ef4adc992fd848dfd769f346f87216029c285

For the record LIBAVCODEC_VERSION_MAJOR come from the library soname
We have libavcodec.so.61.3.100 in FFmpeg 7.0
#if LIBAVCODEC_VERSION_MAJOR < 70
must be 
#if LIBAVCODEC_VERSION_MAJOR < 61
Comment 3 Leslie Zhai 2024-04-13 07:41:11 UTC
(In reply to marillat from comment #2)
> (In reply to Leslie Zhai from comment #1)
> > Hi,
> > https://github.com/KDE/k3b/commit/712ef4adc992fd848dfd769f346f87216029c285
> 
> For the record LIBAVCODEC_VERSION_MAJOR come from the library soname
> We have libavcodec.so.61.3.100 in FFmpeg 7.0
> #if LIBAVCODEC_VERSION_MAJOR < 70
> must be 
> #if LIBAVCODEC_VERSION_MAJOR < 61

Thanks for pointing out my fault! Fixed:  https://github.com/KDE/k3b/commit/071535a79c3d2b074163cbb0881117a995ed17cd
Comment 4 Albert Astals Cid 2024-04-14 21:26:09 UTC
Can you please point to invent instead of the github mirror¿
Comment 5 Leslie Zhai 2024-04-15 00:47:15 UTC
(In reply to Albert Astals Cid from comment #4)
> Can you please point to invent instead of the github mirror¿

Hi Albert,

I will point to invent, I thought it was internal unavailable without KDE Identity :P

Thanks,
Leslie Zhai