[arch-commits] Commit in telegram-desktop/trunk (PKGBUILD fix-ffmpeg5.patch)

Sven-Hendrik Haase svenstaro at gemini.archlinux.org
Sat Apr 9 17:04:55 UTC 2022


    Date: Saturday, April 9, 2022 @ 17:04:54
  Author: svenstaro
Revision: 1183136

upgpkg: telegram-desktop 3.6.1-2: Build against ffmpeg 5 (Fixes FS#74150)

Added:
  telegram-desktop/trunk/fix-ffmpeg5.patch
Modified:
  telegram-desktop/trunk/PKGBUILD

-------------------+
 PKGBUILD          |   24 +++++++----------
 fix-ffmpeg5.patch |   72 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 83 insertions(+), 13 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2022-04-09 16:55:21 UTC (rev 1183135)
+++ PKGBUILD	2022-04-09 17:04:54 UTC (rev 1183136)
@@ -2,12 +2,12 @@
 # Contributor: hexchain <i at hexchain.org>
 pkgname=telegram-desktop
 pkgver=3.6.1
-pkgrel=1
+pkgrel=2
 pkgdesc='Official Telegram Desktop client'
 arch=('x86_64')
 url="https://desktop.telegram.org/"
 license=('GPL3')
-depends=('hunspell' 'ffmpeg4.4' 'hicolor-icon-theme' 'lz4' 'minizip' 'openal' 'ttf-opensans'
+depends=('hunspell' 'ffmpeg' 'hicolor-icon-theme' 'lz4' 'minizip' 'openal' 'ttf-opensans'
          'qt6-imageformats' 'qt6-svg' 'qt6-wayland' 'qt6-5compat' 'xxhash' 'glibmm'
          'rnnoise' 'pipewire' 'libxtst' 'libxrandr' 'jemalloc' 'abseil-cpp' 'libdispatch')
 makedepends=('cmake' 'git' 'ninja' 'python' 'range-v3' 'tl-expected' 'microsoft-gsl' 'meson'
@@ -14,9 +14,16 @@
              'extra-cmake-modules' 'wayland-protocols' 'plasma-wayland-protocols' 'libtg_owt')
 optdepends=('webkit2gtk: embedded browser features'
             'xdg-desktop-portal: desktop integration')
-source=("https://github.com/telegramdesktop/tdesktop/releases/download/v${pkgver}/tdesktop-${pkgver}-full.tar.gz")
-sha512sums=('dd216c720ea3b1c72669805bb31319746a7ddfe746d188bf2ae0c5cdf0a10b379fc2e888a26fe755d77381fc5d9aa638cedc76b2dce1f1126a9c1ef9c02da2ba')
+source=("https://github.com/telegramdesktop/tdesktop/releases/download/v${pkgver}/tdesktop-${pkgver}-full.tar.gz"
+        fix-ffmpeg5.patch)
+sha512sums=('dd216c720ea3b1c72669805bb31319746a7ddfe746d188bf2ae0c5cdf0a10b379fc2e888a26fe755d77381fc5d9aa638cedc76b2dce1f1126a9c1ef9c02da2ba'
+            '6c6b1e3135ce670ecdceb11aa10fdc177951ae2088b7172249f4050b0a30346a8ebd2691302afe270acded2cef4d6eef930f8375b9a676ffcebd6801e645d6fe')
 
+prepare() {
+    cd tdesktop-$pkgver-full
+    patch -Np1 -d Telegram/ThirdParty/tgcalls -i "$srcdir"/fix-ffmpeg5.patch
+}
+
 build() {
     cd tdesktop-$pkgver-full
 
@@ -23,7 +30,6 @@
     # Fix https://bugs.archlinux.org/task/73220
     export CXXFLAGS+=" -Wp,-U_GLIBCXX_ASSERTIONS"
 
-    export PKG_CONFIG_PATH='/usr/lib/ffmpeg4.4/pkgconfig'
     # Turns out we're allowed to use the official API key that telegram uses for their snap builds:
     # https://github.com/telegramdesktop/tdesktop/blob/8fab9167beb2407c1153930ed03a4badd0c2b59f/snap/snapcraft.yaml#L87-L88
     # Thanks @primeos!
@@ -34,14 +40,6 @@
         -DCMAKE_BUILD_TYPE=Release \
         -DTDESKTOP_API_ID=611335 \
         -DTDESKTOP_API_HASH=d524b414d21f4d37f08684c1df41ac9c
-    # Hack to compile for ffmpeg4.4
-    sed -i "s|/usr/lib/libav|/usr/lib/ffmpeg4.4/libav|g" build/build.ninja
-    sed -i "s|/usr/lib/libsw|/usr/lib/ffmpeg4.4/libsw|g" build/build.ninja
-    sed -i "s|-lavcodec|/usr/lib/ffmpeg4.4/libavcodec.so|g" build/build.ninja
-    sed -i "s|-lavformat|/usr/lib/ffmpeg4.4/libavformat.so|g" build/build.ninja
-    sed -i "s|-lavutil|/usr/lib/ffmpeg4.4/libavutil.so|g" build/build.ninja
-    sed -i "s|-lswscale|/usr/lib/ffmpeg4.4/libswscale.so|g" build/build.ninja
-    sed -i "s|-lswresample|/usr/lib/ffmpeg4.4/libswresample.so|g" build/build.ninja
     ninja -C build
 }
 

Added: fix-ffmpeg5.patch
===================================================================
--- fix-ffmpeg5.patch	                        (rev 0)
+++ fix-ffmpeg5.patch	2022-04-09 17:04:54 UTC (rev 1183136)
@@ -0,0 +1,72 @@
+From e89d9ca78abf7dc4fe7c832c07917696eb993868 Mon Sep 17 00:00:00 2001
+From: Nicholas Guriev <nicholas at guriev.su>
+Date: Mon, 7 Mar 2022 11:52:01 +0300
+Subject: [PATCH] Fix build against FFmpeg v5.0
+
+It has been released on January 17th. This patch keeps source compatibility
+with older versions.
+---
+ tgcalls/group/AudioStreamingPartInternal.cpp          | 5 ++++-
+ tgcalls/group/AudioStreamingPartPersistentDecoder.cpp | 2 +-
+ tgcalls/group/VideoStreamingPart.cpp                  | 5 ++++-
+ 3 files changed, 9 insertions(+), 3 deletions(-)
+
+diff --git a/tgcalls/group/AudioStreamingPartInternal.cpp b/tgcalls/group/AudioStreamingPartInternal.cpp
+index 27a71cb..5639036 100644
+--- a/tgcalls/group/AudioStreamingPartInternal.cpp
++++ b/tgcalls/group/AudioStreamingPartInternal.cpp
+@@ -104,6 +104,9 @@ _avIoContext(std::move(fileData)) {
+ 
+     _frame = av_frame_alloc();
+ 
++#if LIBAVFORMAT_VERSION_MAJOR >= 59
++    const
++#endif
+     AVInputFormat *inputFormat = av_find_input_format(container.c_str());
+     if (!inputFormat) {
+         _didReadToEnd = true;
+@@ -144,7 +147,7 @@ _avIoContext(std::move(fileData)) {
+         
+         _streamId = i;
+ 
+-        _durationInMilliseconds = (int)((inStream->duration + inStream->first_dts) * 1000 / 48000);
++        _durationInMilliseconds = (int)((inStream->duration + av_stream_get_first_dts(inStream)) * 1000 / 48000);
+ 
+         if (inStream->metadata) {
+             AVDictionaryEntry *entry = av_dict_get(inStream->metadata, "TG_META", nullptr, 0);
+diff --git a/tgcalls/group/AudioStreamingPartPersistentDecoder.cpp b/tgcalls/group/AudioStreamingPartPersistentDecoder.cpp
+index e79d430..63ef475 100644
+--- a/tgcalls/group/AudioStreamingPartPersistentDecoder.cpp
++++ b/tgcalls/group/AudioStreamingPartPersistentDecoder.cpp
+@@ -32,7 +32,7 @@ class AudioStreamingPartPersistentDecoderState {
+     AudioStreamingPartPersistentDecoderState(AVCodecParameters const *codecParameters, AVRational timeBase) :
+     _codecParameters(codecParameters),
+     _timeBase(timeBase) {
+-        AVCodec *codec = avcodec_find_decoder(codecParameters->codec_id);
++        const AVCodec *codec = avcodec_find_decoder(codecParameters->codec_id);
+         if (codec) {
+             _codecContext = avcodec_alloc_context3(codec);
+             int ret = avcodec_parameters_to_context(_codecContext, codecParameters);
+diff --git a/tgcalls/group/VideoStreamingPart.cpp b/tgcalls/group/VideoStreamingPart.cpp
+index 981ad83..bcab11b 100644
+--- a/tgcalls/group/VideoStreamingPart.cpp
++++ b/tgcalls/group/VideoStreamingPart.cpp
+@@ -276,6 +276,9 @@ class VideoStreamingPartInternal {
+ 
+         int ret = 0;
+ 
++#if LIBAVFORMAT_VERSION_MAJOR >= 59
++        const
++#endif
+         AVInputFormat *inputFormat = av_find_input_format(container.c_str());
+         if (!inputFormat) {
+             _didReadToEnd = true;
+@@ -319,7 +322,7 @@ class VideoStreamingPartInternal {
+         }
+ 
+         if (videoCodecParameters && videoStream) {
+-            AVCodec *codec = avcodec_find_decoder(videoCodecParameters->codec_id);
++            const AVCodec *codec = avcodec_find_decoder(videoCodecParameters->codec_id);
+             if (codec) {
+                 _codecContext = avcodec_alloc_context3(codec);
+                 ret = avcodec_parameters_to_context(_codecContext, videoCodecParameters);



More information about the arch-commits mailing list