From 8979066878cc8cd74d66fde68a173c5b35b26282 Mon Sep 17 00:00:00 2001 From: xiota 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 f01df2165be3fd..4ba0e7768bd129 100644 --- a/Telegram/SourceFiles/ui/controls/round_video_recorder.cpp +++ b/Telegram/SourceFiles/ui/controls/round_video_recorder.cpp @@ -107,9 +107,15 @@ class RoundVideoRecorder::Private final { std::array 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(_buf); +#else static int Write(void *opaque, uint8_t *buf, int buf_size) { +#endif return static_cast(opaque)->write(buf, buf_size); } + static int64_t Seek(void *opaque, int64_t offset, int whence) { return static_cast(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;