Control: tags 1072455 + patch
Control: tags 1072455 + pending

Dear maintainer,

I've prepared an NMU for telegram-desktop (versioned as 4.14.9+ds-1.1) and
uploaded it to unstable.

Regards.


-- 
WBR, wRAR
diff -Nru telegram-desktop-4.14.9+ds/debian/changelog telegram-desktop-4.14.9+ds/debian/changelog
--- telegram-desktop-4.14.9+ds/debian/changelog	2024-01-21 22:09:47.000000000 +0500
+++ telegram-desktop-4.14.9+ds/debian/changelog	2024-08-25 18:49:49.000000000 +0500
@@ -1,3 +1,10 @@
+telegram-desktop (4.14.9+ds-1.1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix building with ffmpeg 6.1+ (Closes: #1072455).
+
+ -- Andrey Rakhmatullin <w...@debian.org>  Sun, 25 Aug 2024 18:49:49 +0500
+
 telegram-desktop (4.14.9+ds-1) unstable; urgency=medium
 
   * New upstream release.
diff -Nru telegram-desktop-4.14.9+ds/debian/patches/1003-Fixed-build-with-ffmpeg-6.1.patch telegram-desktop-4.14.9+ds/debian/patches/1003-Fixed-build-with-ffmpeg-6.1.patch
--- telegram-desktop-4.14.9+ds/debian/patches/1003-Fixed-build-with-ffmpeg-6.1.patch	1970-01-01 05:00:00.000000000 +0500
+++ telegram-desktop-4.14.9+ds/debian/patches/1003-Fixed-build-with-ffmpeg-6.1.patch	2024-08-25 18:23:37.000000000 +0500
@@ -0,0 +1,110 @@
+From 44799566b28418bf2418d549605a1eacd471a61b Mon Sep 17 00:00:00 2001
+From: Fela <fr...@live.it>
+Date: Sun, 26 Nov 2023 14:38:01 +0400
+Subject: [PATCH] Fixed build with ffmpeg 6.1
+
+---
+ tgcalls/group/AudioStreamingPartInternal.cpp  | 34 +++++++++----------
+ .../AudioStreamingPartPersistentDecoder.cpp   |  4 +--
+ 2 files changed, 19 insertions(+), 19 deletions(-)
+
+diff --git a/tgcalls/group/AudioStreamingPartInternal.cpp b/tgcalls/group/AudioStreamingPartInternal.cpp
+index 7477381..9c430a5 100644
+--- a/Telegram/ThirdParty/tgcalls/tgcalls/group/AudioStreamingPartInternal.cpp
++++ b/Telegram/ThirdParty/tgcalls/tgcalls/group/AudioStreamingPartInternal.cpp
+@@ -311,7 +311,7 @@ void AudioStreamingPartInternal::fillPcmBuffer(AudioStreamingPartPersistentDecod
+     }
+     
+     if (_channelCount == 0) {
+-        _channelCount = _frame->channels;
++        _channelCount = _frame->ch_layout.nb_channels;
+     }
+     
+     if (_channelCount == 0) {
+@@ -319,24 +319,24 @@ void AudioStreamingPartInternal::fillPcmBuffer(AudioStreamingPartPersistentDecod
+         return;
+     }
+     
+-    if (_frame->channels != _channelCount || _frame->channels > 8) {
++    if (_frame->ch_layout.nb_channels != _channelCount || _frame->ch_layout.nb_channels > 8) {
+         _didReadToEnd = true;
+         return;
+     }
+ 
+-    if (_pcmBuffer.size() < _frame->nb_samples * _frame->channels) {
+-        _pcmBuffer.resize(_frame->nb_samples * _frame->channels);
++    if (_pcmBuffer.size() < _frame->nb_samples * _frame->ch_layout.nb_channels) {
++        _pcmBuffer.resize(_frame->nb_samples * _frame->ch_layout.nb_channels);
+     }
+ 
+     switch (_frame->format) {
+     case AV_SAMPLE_FMT_S16: {
+-        memcpy(_pcmBuffer.data(), _frame->data[0], _frame->nb_samples * 2 * _frame->channels);
++        memcpy(_pcmBuffer.data(), _frame->data[0], _frame->nb_samples * 2 * _frame->ch_layout.nb_channels);
+     } break;
+ 
+     case AV_SAMPLE_FMT_S16P: {
+         int16_t *to = _pcmBuffer.data();
+         for (int sample = 0; sample < _frame->nb_samples; ++sample) {
+-            for (int channel = 0; channel < _frame->channels; ++channel) {
++            for (int channel = 0; channel < _frame->ch_layout.nb_channels; ++channel) {
+                 int16_t *shortChannel = (int16_t*)_frame->data[channel];
+                 *to++ = shortChannel[sample];
+             }
+@@ -344,20 +344,20 @@ void AudioStreamingPartInternal::fillPcmBuffer(AudioStreamingPartPersistentDecod
+     } break;
+ 
+     case AV_SAMPLE_FMT_FLT: {
+-		float *floatData = (float *)&_frame->data[0];
+-		for (int i = 0; i < _frame->nb_samples * _frame->channels; i++) {
+-			_pcmBuffer[i] = sampleFloatToInt16(floatData[i]);
+-		}
++        float *floatData = (float *)&_frame->data[0];
++        for (int i = 0; i < _frame->nb_samples * _frame->ch_layout.nb_channels; i++) {
++            _pcmBuffer[i] = sampleFloatToInt16(floatData[i]);
++        }
+     } break;
+ 
+     case AV_SAMPLE_FMT_FLTP: {
+-		int16_t *to = _pcmBuffer.data();
+-		for (int sample = 0; sample < _frame->nb_samples; ++sample) {
+-			for (int channel = 0; channel < _frame->channels; ++channel) {
+-				float *floatChannel = (float*)_frame->data[channel];
+-				*to++ = sampleFloatToInt16(floatChannel[sample]);
+-			}
+-		}
++        int16_t *to = _pcmBuffer.data();
++        for (int sample = 0; sample < _frame->nb_samples; ++sample) {
++            for (int channel = 0; channel < _frame->ch_layout.nb_channels; ++channel) {
++                float *floatChannel = (float*)_frame->data[channel];
++                *to++ = sampleFloatToInt16(floatChannel[sample]);
++            }
++        }
+     } break;
+ 
+     default: {
+diff --git a/tgcalls/group/AudioStreamingPartPersistentDecoder.cpp b/tgcalls/group/AudioStreamingPartPersistentDecoder.cpp
+index 2bcfb1e..05ec542 100644
+--- a/Telegram/ThirdParty/tgcalls/tgcalls/group/AudioStreamingPartPersistentDecoder.cpp
++++ b/Telegram/ThirdParty/tgcalls/tgcalls/group/AudioStreamingPartPersistentDecoder.cpp
+@@ -21,7 +21,7 @@ bool WrappedCodecParameters::isEqual(AVCodecParameters const *other) {
+     if (_value->format != other->format) {
+         return false;
+     }
+-    if (_value->channels != other->channels) {
++    if (_value->ch_layout.nb_channels != other->ch_layout.nb_channels) {
+         return false;
+     }
+     return true;
+@@ -42,7 +42,7 @@ public:
+             } else {
+                 _codecContext->pkt_timebase = timeBase;
+ 
+-                _channelCount = _codecContext->channels;
++                _channelCount = _codecContext->ch_layout.nb_channels;
+ 
+                 ret = avcodec_open2(_codecContext, codec, nullptr);
+                 if (ret < 0) {
+-- 
+2.45.2
+
diff -Nru telegram-desktop-4.14.9+ds/debian/patches/1004-Add-compatibility-with-FFMPEG-7.0.patch telegram-desktop-4.14.9+ds/debian/patches/1004-Add-compatibility-with-FFMPEG-7.0.patch
--- telegram-desktop-4.14.9+ds/debian/patches/1004-Add-compatibility-with-FFMPEG-7.0.patch	1970-01-01 05:00:00.000000000 +0500
+++ telegram-desktop-4.14.9+ds/debian/patches/1004-Add-compatibility-with-FFMPEG-7.0.patch	2024-08-25 18:28:42.000000000 +0500
@@ -0,0 +1,144 @@
+From 3358673ba423b539611be2fbf9ff23de680afeaa Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Robert-Andr=C3=A9=20Mauchin?= <zebo...@gmail.com>
+Date: Fri, 10 May 2024 18:05:08 +0200
+Subject: [PATCH] Add compatibility with FFMPEG 7.0
+
+avio: Constify data pointees of write callbacks
+
+avutil: remove deprecated FF_API_PKT_DURATION
+
+Ref: https://github.com/FFmpeg/FFmpeg/commit/2a68d945cd74265bb71c3d38b7a2e7f7d7e87be5
+     https://github.com/FFmpeg/FFmpeg/commit/02aea61d69d8f81bc285e2131bf25f96a3e27feb
+     https://github.com/FFmpeg/FFmpeg/commit/b8fef7e9c520b3923b32813b6a82c154c74402dc
+---
+ .../ffmpeg/ffmpeg_frame_generator.cpp          |  4 ++++
+ Telegram/SourceFiles/ffmpeg/ffmpeg_utility.cpp |  8 ++++++++
+ Telegram/SourceFiles/ffmpeg/ffmpeg_utility.h   | 18 ++++++++++++++++--
+ .../media/audio/media_audio_capture.cpp        |  4 ++++
+ .../media/clip/media_clip_ffmpeg.cpp           |  4 ++++
+ 5 files changed, 36 insertions(+), 2 deletions(-)
+
+diff --git a/Telegram/SourceFiles/ffmpeg/ffmpeg_frame_generator.cpp b/Telegram/SourceFiles/ffmpeg/ffmpeg_frame_generator.cpp
+index 116d998a2..de478b784 100644
+--- a/Telegram/SourceFiles/ffmpeg/ffmpeg_frame_generator.cpp
++++ b/Telegram/SourceFiles/ffmpeg/ffmpeg_frame_generator.cpp
+@@ -291,7 +291,11 @@ void FrameGenerator::Impl::jumpToStart() {
+ 
+ void FrameGenerator::Impl::resolveNextFrameTiming() {
+ 	const auto base = _format->streams[_streamId]->time_base;
++#if DA_FFMPEG_HAVE_DURATION
++	const auto duration = _next.frame->duration;
++#else
+ 	const auto duration = _next.frame->pkt_duration;
++#endif
+ 	const auto framePts = _next.frame->pts;
+ 	auto framePosition = (framePts * 1000LL * base.num) / base.den;
+ 	_currentFrameDelay = _nextFrameDelay;
+diff --git a/Telegram/SourceFiles/ffmpeg/ffmpeg_utility.cpp b/Telegram/SourceFiles/ffmpeg/ffmpeg_utility.cpp
+index 2a42d0034..0f7083df3 100644
+--- a/Telegram/SourceFiles/ffmpeg/ffmpeg_utility.cpp
++++ b/Telegram/SourceFiles/ffmpeg/ffmpeg_utility.cpp
+@@ -230,7 +230,11 @@ enum AVPixelFormat GetFormatImplementation(
+ IOPointer MakeIOPointer(
+ 		void *opaque,
+ 		int(*read)(void *opaque, uint8_t *buffer, int bufferSize),
++#if DA_FFMPEG_CONST_WRITE_CALLBACK
++		int(*write)(void *opaque, const uint8_t *buffer, int bufferSize),
++#else
+ 		int(*write)(void *opaque, uint8_t *buffer, int bufferSize),
++#endif
+ 		int64_t(*seek)(void *opaque, int64_t offset, int whence)) {
+ 	auto buffer = reinterpret_cast<uchar*>(av_malloc(kAvioBlockSize));
+ 	if (!buffer) {
+@@ -263,7 +267,11 @@ void IODeleter::operator()(AVIOContext *value) {
+ FormatPointer MakeFormatPointer(
+ 		void *opaque,
+ 		int(*read)(void *opaque, uint8_t *buffer, int bufferSize),
++#if DA_FFMPEG_CONST_WRITE_CALLBACK
++		int(*write)(void *opaque, const uint8_t *buffer, int bufferSize),
++#else
+ 		int(*write)(void *opaque, uint8_t *buffer, int bufferSize),
++#endif
+ 		int64_t(*seek)(void *opaque, int64_t offset, int whence)) {
+ 	auto io = MakeIOPointer(opaque, read, write, seek);
+ 	if (!io) {
+diff --git a/Telegram/SourceFiles/ffmpeg/ffmpeg_utility.h b/Telegram/SourceFiles/ffmpeg/ffmpeg_utility.h
+index bc9c8764b..d96daa9c7 100644
+--- a/Telegram/SourceFiles/ffmpeg/ffmpeg_utility.h
++++ b/Telegram/SourceFiles/ffmpeg/ffmpeg_utility.h
+@@ -22,8 +22,14 @@ extern "C" {
+ #include <libavutil/version.h>
+ } // extern "C"
+ 
+-#define DA_FFMPEG_NEW_CHANNEL_LAYOUT (LIBAVUTIL_VERSION_MAJOR > 57 \
+-	|| (LIBAVUTIL_VERSION_MAJOR == 57 && LIBAVUTIL_VERSION_MINOR >= 28))
++#define DA_FFMPEG_NEW_CHANNEL_LAYOUT (LIBAVUTIL_VERSION_INT >= \
++	AV_VERSION_INT(57, 28, 100))
++
++#define DA_FFMPEG_CONST_WRITE_CALLBACK (LIBAVFORMAT_VERSION_INT >= \
++	AV_VERSION_INT(61, 01, 100))
++
++#define DA_FFMPEG_HAVE_DURATION (LIBAVUTIL_VERSION_INT >= \
++	AV_VERSION_INT(58, 02, 100))
+ 
+ class QImage;
+ 
+@@ -112,7 +118,11 @@ using IOPointer = std::unique_ptr<AVIOContext, IODeleter>;
+ [[nodiscard]] IOPointer MakeIOPointer(
+ 	void *opaque,
+ 	int(*read)(void *opaque, uint8_t *buffer, int bufferSize),
++#if DA_FFMPEG_CONST_WRITE_CALLBACK
++	int(*write)(void *opaque, const uint8_t *buffer, int bufferSize),
++#else
+ 	int(*write)(void *opaque, uint8_t *buffer, int bufferSize),
++#endif
+ 	int64_t(*seek)(void *opaque, int64_t offset, int whence));
+ 
+ struct FormatDeleter {
+@@ -122,7 +132,11 @@ using FormatPointer = std::unique_ptr<AVFormatContext, FormatDeleter>;
+ [[nodiscard]] FormatPointer MakeFormatPointer(
+ 	void *opaque,
+ 	int(*read)(void *opaque, uint8_t *buffer, int bufferSize),
++#if DA_FFMPEG_CONST_WRITE_CALLBACK
++	int(*write)(void *opaque, const uint8_t *buffer, int bufferSize),
++#else
+ 	int(*write)(void *opaque, uint8_t *buffer, int bufferSize),
++#endif
+ 	int64_t(*seek)(void *opaque, int64_t offset, int whence));
+ 
+ struct CodecDeleter {
+diff --git a/Telegram/SourceFiles/media/audio/media_audio_capture.cpp b/Telegram/SourceFiles/media/audio/media_audio_capture.cpp
+index b9151db2a..1bbf9b10c 100644
+--- a/Telegram/SourceFiles/media/audio/media_audio_capture.cpp
++++ b/Telegram/SourceFiles/media/audio/media_audio_capture.cpp
+@@ -249,7 +249,11 @@ struct Instance::Inner::Private {
+ 		return nbytes;
+ 	}
+ 
++#if DA_FFMPEG_CONST_WRITE_CALLBACK
++	static int WriteData(void *opaque, const uint8_t *buf, int buf_size) {
++#else
+ 	static int WriteData(void *opaque, uint8_t *buf, int buf_size) {
++#endif
+ 		auto l = reinterpret_cast<Private*>(opaque);
+ 
+ 		if (buf_size <= 0) return 0;
+diff --git a/Telegram/SourceFiles/media/clip/media_clip_ffmpeg.cpp b/Telegram/SourceFiles/media/clip/media_clip_ffmpeg.cpp
+index 9f1c7b234..1188f0232 100644
+--- a/Telegram/SourceFiles/media/clip/media_clip_ffmpeg.cpp
++++ b/Telegram/SourceFiles/media/clip/media_clip_ffmpeg.cpp
+@@ -144,7 +144,11 @@ ReaderImplementation::ReadResult FFMpegReaderImplementation::readNextFrame() {
+ }
+ 
+ void FFMpegReaderImplementation::processReadFrame() {
++#if DA_FFMPEG_HAVE_DURATION
++	int64 duration = _frame->duration;
++#else
+ 	int64 duration = _frame->pkt_duration;
++#endif
+ 	int64 framePts = _frame->pts;
+ 	crl::time frameMs = (framePts * 1000LL * _fmtContext->streams[_streamId]->time_base.num) / _fmtContext->streams[_streamId]->time_base.den;
+ 	_currentFrameDelay = _nextFrameDelay;
+-- 
+2.45.2
+
diff -Nru telegram-desktop-4.14.9+ds/debian/patches/series telegram-desktop-4.14.9+ds/debian/patches/series
--- telegram-desktop-4.14.9+ds/debian/patches/series	2023-12-29 01:03:39.000000000 +0500
+++ telegram-desktop-4.14.9+ds/debian/patches/series	2024-08-25 18:29:00.000000000 +0500
@@ -1,5 +1,7 @@
 1001-Revert-Fix-QGuiApplication-desktopFileName-usage.patch
 1002-Revert-Workaround-cmake-bug-25222.patch
+1003-Fixed-build-with-ffmpeg-6.1.patch
+1004-Add-compatibility-with-FFMPEG-7.0.patch
 2001-Hide-irrelevant-warnings.patch
 2002-Disable-register-custom-scheme.patch
 2003-Do-not-sync-wallpaper.patch

Attachment: signature.asc
Description: PGP signature

Reply via email to