File: 1003-Fix-some-ffmpeg-7.x-related-errors.patch

package info (click to toggle)
telegram-desktop 5.7.2%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 63,488 kB
  • sloc: cpp: 756,228; python: 4,383; ansic: 1,505; javascript: 1,366; sh: 884; makefile: 820; objc: 652; xml: 565
file content (41 lines) | stat: -rw-r--r-- 1,598 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
From da8a4ba8ab58227177b69b7bfeec88f6476609eb Mon Sep 17 00:00:00 2001
Message-Id: <da8a4ba8ab58227177b69b7bfeec88f6476609eb.1731081470.git.nicholas@guriev.su>
From: xiota <github@mentalfossa.com>
Date: Mon, 4 Nov 2024 20:40:37 +0000
Subject: [PATCH] Fix some ffmpeg 7.x related errors

---
 Telegram/SourceFiles/ui/controls/round_video_recorder.cpp | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/Telegram/SourceFiles/ui/controls/round_video_recorder.cpp b/Telegram/SourceFiles/ui/controls/round_video_recorder.cpp
index f01df2165..4ba0e7768 100644
--- a/Telegram/SourceFiles/ui/controls/round_video_recorder.cpp
+++ b/Telegram/SourceFiles/ui/controls/round_video_recorder.cpp
@@ -107,9 +107,15 @@ private:
 		std::array<int64, kMaxStreams> lastDts = { 0 };
 	};
 
+#if DA_FFMPEG_CONST_WRITE_CALLBACK
+	static int Write(void *opaque, const uint8_t *_buf, int buf_size) {
+		uint8_t *buf = const_cast<uint8_t *>(_buf);
+#else
 	static int Write(void *opaque, uint8_t *buf, int buf_size) {
+#endif
 		return static_cast<Private*>(opaque)->write(buf, buf_size);
 	}
+
 	static int64_t Seek(void *opaque, int64_t offset, int whence) {
 		return static_cast<Private*>(opaque)->seek(offset, whence);
 	}
@@ -388,7 +394,6 @@ bool RoundVideoRecorder::Private::initAudio() {
 	_audioCodec->sample_rate = kAudioFrequency;
 #if DA_FFMPEG_NEW_CHANNEL_LAYOUT
 	_audioCodec->ch_layout = AV_CHANNEL_LAYOUT_MONO;
-	_audioCodec->channels = _audioCodec->ch_layout.nb_channels;
 #else
 	_audioCodec->channel_layout = AV_CH_LAYOUT_MONO;
 	_audioCodec->channels = _audioChannels;
-- 
2.30.2