summaryrefslogtreecommitdiffstats
path: root/libraries/libopenshot/patches/0002-constify-some-AVCodecIDs-necessary-for-new-ffmpeg.patch
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/libopenshot/patches/0002-constify-some-AVCodecIDs-necessary-for-new-ffmpeg.patch')
-rw-r--r--libraries/libopenshot/patches/0002-constify-some-AVCodecIDs-necessary-for-new-ffmpeg.patch94
1 files changed, 94 insertions, 0 deletions
diff --git a/libraries/libopenshot/patches/0002-constify-some-AVCodecIDs-necessary-for-new-ffmpeg.patch b/libraries/libopenshot/patches/0002-constify-some-AVCodecIDs-necessary-for-new-ffmpeg.patch
new file mode 100644
index 0000000000..5d82696550
--- /dev/null
+++ b/libraries/libopenshot/patches/0002-constify-some-AVCodecIDs-necessary-for-new-ffmpeg.patch
@@ -0,0 +1,94 @@
+From: nick black <dankamongmen@gmail.com>
+Date: Sun, 21 Nov 2021 23:25:37 -0500
+Subject: [PATCH] constify some AVCodecIDs, necessary for new ffmpeg
+
+Signed-off-by: nick black <dankamongmen@gmail.com>
+---
+ src/FFmpegReader.cpp | 6 +++---
+ src/FFmpegWriter.cpp | 12 ++++++------
+ 2 files changed, 9 insertions(+), 9 deletions(-)
+
+diff --git a/src/FFmpegReader.cpp b/src/FFmpegReader.cpp
+index c1eaa74..497cff0 100644
+--- a/src/FFmpegReader.cpp
++++ b/src/FFmpegReader.cpp
+@@ -255,10 +255,10 @@ void FFmpegReader::Open() {
+ pStream = pFormatCtx->streams[videoStream];
+
+ // Find the codec ID from stream
+- AVCodecID codecId = AV_FIND_DECODER_CODEC_ID(pStream);
++ const AVCodecID codecId = AV_FIND_DECODER_CODEC_ID(pStream);
+
+ // Get codec and codec context from stream
+- AVCodec *pCodec = avcodec_find_decoder(codecId);
++ const AVCodec *pCodec = avcodec_find_decoder(codecId);
+ AVDictionary *opts = NULL;
+ int retry_decode_open = 2;
+ // If hw accel is selected but hardware cannot handle repeat with software decoding
+@@ -512,7 +512,7 @@ void FFmpegReader::Open() {
+ AVCodecID codecId = AV_FIND_DECODER_CODEC_ID(aStream);
+
+ // Get codec and codec context from stream
+- AVCodec *aCodec = avcodec_find_decoder(codecId);
++ const AVCodec *aCodec = avcodec_find_decoder(codecId);
+ aCodecCtx = AV_GET_CODEC_CONTEXT(aStream, aCodec);
+
+ // Set number of threads equal to number of processors (not to exceed 16)
+diff --git a/src/FFmpegWriter.cpp b/src/FFmpegWriter.cpp
+index 8707756..823b345 100644
+--- a/src/FFmpegWriter.cpp
++++ b/src/FFmpegWriter.cpp
+@@ -166,7 +166,7 @@ void FFmpegWriter::initialize_streams() {
+ void FFmpegWriter::SetVideoOptions(bool has_video, std::string codec, Fraction fps, int width, int height, Fraction pixel_ratio, bool interlaced, bool top_field_first, int bit_rate) {
+ // Set the video options
+ if (codec.length() > 0) {
+- AVCodec *new_codec;
++ const AVCodec *new_codec;
+ // Check if the codec selected is a hardware accelerated codec
+ #if USE_HW_ACCEL
+ #if defined(__linux__)
+@@ -288,7 +288,7 @@ void FFmpegWriter::SetVideoOptions(std::string codec, int width, int height, Fr
+ void FFmpegWriter::SetAudioOptions(bool has_audio, std::string codec, int sample_rate, int channels, ChannelLayout channel_layout, int bit_rate) {
+ // Set audio options
+ if (codec.length() > 0) {
+- AVCodec *new_codec = avcodec_find_encoder_by_name(codec.c_str());
++ const AVCodec *new_codec = avcodec_find_encoder_by_name(codec.c_str());
+ if (new_codec == NULL)
+ throw InvalidCodec("A valid audio codec could not be found for this file.", path);
+ else {
+@@ -1048,7 +1048,7 @@ AVStream *FFmpegWriter::add_audio_stream() {
+ AVStream *st;
+
+ // Find the audio codec
+- AVCodec *codec = avcodec_find_encoder_by_name(info.acodec.c_str());
++ const AVCodec *codec = avcodec_find_encoder_by_name(info.acodec.c_str());
+ if (codec == NULL)
+ throw InvalidCodec("A valid audio codec could not be found for this file.", path);
+
+@@ -1133,7 +1133,7 @@ AVStream *FFmpegWriter::add_video_stream() {
+ AVStream *st;
+
+ // Find the video codec
+- AVCodec *codec = avcodec_find_encoder_by_name(info.vcodec.c_str());
++ const AVCodec *codec = avcodec_find_encoder_by_name(info.vcodec.c_str());
+ if (codec == NULL)
+ throw InvalidCodec("A valid video codec could not be found for this file.", path);
+
+@@ -1313,7 +1313,7 @@ AVStream *FFmpegWriter::add_video_stream() {
+
+ // open audio codec
+ void FFmpegWriter::open_audio(AVFormatContext *oc, AVStream *st) {
+- AVCodec *codec;
++ const AVCodec *codec;
+ AV_GET_CODEC_FROM_STREAM(st, audio_codec_ctx)
+
+ // Set number of threads equal to number of processors (not to exceed 16)
+@@ -1384,7 +1384,7 @@ void FFmpegWriter::open_audio(AVFormatContext *oc, AVStream *st) {
+
+ // open video codec
+ void FFmpegWriter::open_video(AVFormatContext *oc, AVStream *st) {
+- AVCodec *codec;
++ const AVCodec *codec;
+ AV_GET_CODEC_FROM_STREAM(st, video_codec_ctx)
+
+ // Set number of threads equal to number of processors (not to exceed 16)