]> git.pld-linux.org Git - packages/simplescreenrecorder.git/blob - ffmpeg6.patch
- add upstream fix for ffmpeg 6, rel 2
[packages/simplescreenrecorder.git] / ffmpeg6.patch
1 From 768957a8de1534f0aa91bfc5d7af3c32f222beb8 Mon Sep 17 00:00:00 2001
2 From: Maarten Baert <maarten-baert@hotmail.com>
3 Date: Sun, 20 Mar 2022 22:52:43 +0100
4 Subject: [PATCH] Fix for compatibility with newer FFmpeg versions
5
6 ---
7  src/AV/Output/AudioEncoder.cpp | 3 ++-
8  src/AV/Output/Muxer.cpp        | 6 ++++--
9  src/AV/Output/VideoEncoder.cpp | 3 ++-
10  3 files changed, 8 insertions(+), 4 deletions(-)
11
12 diff --git a/src/AV/Output/AudioEncoder.cpp b/src/AV/Output/AudioEncoder.cpp
13 index 34d015cf..3efde703 100644
14 --- a/src/AV/Output/AudioEncoder.cpp
15 +++ b/src/AV/Output/AudioEncoder.cpp
16 @@ -77,7 +77,8 @@ unsigned int AudioEncoder::GetSampleRate() {
17  }
18  
19  bool AudioEncoder::AVCodecIsSupported(const QString& codec_name) {
20 -       AVCodec *codec = avcodec_find_encoder_by_name(codec_name.toUtf8().constData());
21 +       // we have to break const correctness for compatibility with older ffmpeg versions
22 +       AVCodec *codec = (AVCodec*) avcodec_find_encoder_by_name(codec_name.toUtf8().constData());
23         if(codec == NULL)
24                 return false;
25         if(!av_codec_is_encoder(codec))
26 diff --git a/src/AV/Output/Muxer.cpp b/src/AV/Output/Muxer.cpp
27 index ad583803..bc6dd71c 100644
28 --- a/src/AV/Output/Muxer.cpp
29 +++ b/src/AV/Output/Muxer.cpp
30 @@ -194,7 +194,8 @@ unsigned int Muxer::GetQueuedPacketCount(unsigned int stream_index) {
31  void Muxer::Init() {
32  
33         // get the format we want (this is just a pointer, we don't have to free this)
34 -       AVOutputFormat *format = av_guess_format(m_container_name.toUtf8().constData(), NULL, NULL);
35 +       // we have to break const correctness for compatibility with older ffmpeg versions
36 +       AVOutputFormat *format = (AVOutputFormat*) av_guess_format(m_container_name.toUtf8().constData(), NULL, NULL);
37         if(format == NULL) {
38                 Logger::LogError("[Muxer::Init] " + Logger::tr("Error: Can't find chosen output format!"));
39                 throw LibavException();
40 @@ -262,7 +263,8 @@ void Muxer::Free() {
41  }
42  
43  AVCodec* Muxer::FindCodec(const QString& codec_name) {
44 -       AVCodec *codec = avcodec_find_encoder_by_name(codec_name.toUtf8().constData());
45 +       // we have to break const correctness for compatibility with older ffmpeg versions
46 +       AVCodec *codec = (AVCodec*) avcodec_find_encoder_by_name(codec_name.toUtf8().constData());
47         if(codec == NULL) {
48                 Logger::LogError("[Muxer::FindCodec] " + Logger::tr("Error: Can't find codec!"));
49                 throw LibavException();
50 diff --git a/src/AV/Output/VideoEncoder.cpp b/src/AV/Output/VideoEncoder.cpp
51 index 8087e8ed..d09d7047 100644
52 --- a/src/AV/Output/VideoEncoder.cpp
53 +++ b/src/AV/Output/VideoEncoder.cpp
54 @@ -95,7 +95,8 @@ unsigned int VideoEncoder::GetFrameRate() {
55  }
56  
57  bool VideoEncoder::AVCodecIsSupported(const QString& codec_name) {
58 -       AVCodec *codec = avcodec_find_encoder_by_name(codec_name.toUtf8().constData());
59 +       // we have to break const correctness for compatibility with older ffmpeg versions
60 +       AVCodec *codec = (AVCodec*) avcodec_find_encoder_by_name(codec_name.toUtf8().constData());
61         if(codec == NULL)
62                 return false;
63         if(!av_codec_is_encoder(codec))
This page took 0.05675 seconds and 3 git commands to generate.