[arch-commits] Commit in k3b/trunk (PKGBUILD ffmpeg5.patch)

Antonio Rojas arojas at gemini.archlinux.org
Tue Jan 25 12:04:10 UTC 2022


    Date: Tuesday, January 25, 2022 @ 12:04:10
  Author: arojas
Revision: 435094

ffmpeg 5 rebuild

Added:
  k3b/trunk/ffmpeg5.patch
Modified:
  k3b/trunk/PKGBUILD

---------------+
 PKGBUILD      |   12 +++++++--
 ffmpeg5.patch |   72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 81 insertions(+), 3 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2022-01-25 11:48:04 UTC (rev 435093)
+++ PKGBUILD	2022-01-25 12:04:10 UTC (rev 435094)
@@ -3,7 +3,7 @@
 
 pkgname=k3b
 pkgver=21.12.1
-pkgrel=1
+pkgrel=2
 epoch=1
 pkgdesc='Feature-rich and easy to handle CD burning application'
 arch=(x86_64)
@@ -19,13 +19,19 @@
             'cdrdao: for disk-at-once (DAO) mode support'
             'cdparanoia: for CD ripping support' 'transcode: for DVD ripping support')
 groups=(kde-applications kde-multimedia)
-source=(https://download.kde.org/stable/release-service/$pkgver/src/$pkgname-$pkgver.tar.xz{,.sig})
+source=(https://download.kde.org/stable/release-service/$pkgver/src/$pkgname-$pkgver.tar.xz{,.sig}
+        ffmpeg5.patch)
 sha256sums=('6610a6d83d7e7fb57e96f968cec12d180ec7f8514308a6e1388aff0e07f55c0f'
-            'SKIP')
+            'SKIP'
+            '4855cef052eebccbbcfabbb59b197cf9ed1703bbf548187a3596692821d89657')
 validpgpkeys=(CA262C6C83DE4D2FB28A332A3A6A4DB839EAA6D7  # Albert Astals Cid <aacid at kde.org>
               F23275E4BF10AFC1DF6914A6DBD2CE893E2D1C87  # Christoph Feck <cfeck at kde.org>
               D81C0CB38EB725EF6691C385BB463350D6EF31EF) # Heiko Becker <heiko.becker at kde.org>
 
+prepare() {
+  patch -d $pkgname-$pkgver -p1 < ffmpeg5.patch # Fix build with FFmpeg 5 - patch from Bernhard Rosenkraenzer
+}
+
 build() {
   cmake -B build -S $pkgname-$pkgver \
     -DCMAKE_INSTALL_LIBEXECDIR=lib \

Added: ffmpeg5.patch
===================================================================
--- ffmpeg5.patch	                        (rev 0)
+++ ffmpeg5.patch	2022-01-25 12:04:10 UTC (rev 435094)
@@ -0,0 +1,72 @@
+diff -up k3b-21.12.1/plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp.omv~ k3b-21.12.1/plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp
+--- k3b-21.12.1/plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp.omv~	2022-01-17 19:44:11.314744839 +0100
++++ k3b-21.12.1/plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp	2022-01-17 19:55:07.045724184 +0100
+@@ -38,7 +38,20 @@ extern "C" {
+ #include <math.h>
+ 
+ 
++#if LIBAVCODEC_VERSION_MAJOR < 59
+ #define FFMPEG_CODEC(s) (s->codec)
++#else
++static QMap<AVStream*,AVCodecContext*> k3b_codec_contexts;
++static inline AVCodecContext *FFMPEG_CODEC(AVStream *s) {
++	if(!k3b_codec_contexts.contains(s)) {
++		const AVCodec *codec = avcodec_find_decoder(s->codecpar->codec_id);
++		AVCodecContext *ctx = avcodec_alloc_context3(codec);
++		avcodec_parameters_to_context(ctx, s->codecpar);
++		k3b_codec_contexts.insert(s, ctx);
++	}
++	return k3b_codec_contexts.value(s);
++}
++#endif
+ 
+ #ifndef HAVE_FFMPEG_AVFORMAT_OPEN_INPUT
+ //      this works because the parameters/options are not used
+@@ -70,7 +83,7 @@ class K3bFFMpegFile::Private
+ {
+ public:
+     ::AVFormatContext* formatContext;
+-    ::AVCodec* codec;
++    const ::AVCodec* codec;
+     ::AVStream *audio_stream;
+ 
+     K3b::Msf length;
+@@ -320,11 +333,28 @@ int K3bFFMpegFile::fillOutputBuffer()
+         }
+ 
+         int gotFrame = 0;
++#if LIBAVCODEC_VERSION_MAJOR < 59
+         int len = ::avcodec_decode_audio4(
+             FFMPEG_CODEC(d->audio_stream),
+             d->frame,
+             &gotFrame,
+             &d->packet );
++#else
++        int ret = ::avcodec_receive_frame(
++            FFMPEG_CODEC(d->audio_stream),
++            d->frame);
++
++        gotFrame = (ret == 0);
++
++        ret = avcodec_send_packet(
++            FFMPEG_CODEC(d->audio_stream),
++            &d->packet );
++        if (ret < 0) {
++            qDebug() << "(K3bFFMpegFile) decoding failed for " << m_filename;
++            return -1;
++        }
++        int len = d->packet.size;
++#endif
+ 
+         if( d->packetSize <= 0 || len < 0 )
+             ::av_packet_unref( &d->packet );
+@@ -393,7 +423,9 @@ bool K3bFFMpegFile::seek( const K3b::Msf
+ 
+ K3bFFMpegWrapper::K3bFFMpegWrapper()
+ {
++#if LIBAVCODEC_VERSION_MAJOR < 59
+     ::av_register_all();
++#endif
+ }
+ 
+ 



More information about the arch-commits mailing list