[arch-commits] Commit in wf-recorder/trunk (ffmpeg5.patch)

Brett Cornwall ainola at gemini.archlinux.org
Tue Jun 14 21:52:16 UTC 2022


    Date: Tuesday, June 14, 2022 @ 21:52:15
  Author: ainola
Revision: 1238002

upgpkg: wf-recorder 0.3.0-1

Deleted:
  wf-recorder/trunk/ffmpeg5.patch

---------------+
 ffmpeg5.patch |  159 --------------------------------------------------------
 1 file changed, 159 deletions(-)

Deleted: ffmpeg5.patch
===================================================================
--- ffmpeg5.patch	2022-06-14 21:50:50 UTC (rev 1238001)
+++ ffmpeg5.patch	2022-06-14 21:52:15 UTC (rev 1238002)
@@ -1,159 +0,0 @@
-From 47a3905f670fe12ecbdfe4719df654df1cd183e2 Mon Sep 17 00:00:00 2001
-From: "M. Stoeckl" <github at mstoeckl.com>
-Date: Thu, 13 Jan 2022 04:17:26 -0500
-Subject: [PATCH] Fix build with latest FFmpeg (#157)
-
-Changes to the FFmpeg git repository since version 4.4 include:
-* Removing the deprecated av_register_all
-* Making AVCodec const
-* Removing the long deprecated AVStream.codec field
----
- src/frame-writer.cpp | 37 +++++++++++++++++++++++++++----------
- src/frame-writer.hpp |  6 +++---
- 2 files changed, 30 insertions(+), 13 deletions(-)
-
-diff --git a/src/frame-writer.cpp b/src/frame-writer.cpp
-index 043d772..7614b0c 100644
---- a/src/frame-writer.cpp
-+++ b/src/frame-writer.cpp
-@@ -15,6 +15,8 @@
- static const AVRational US_RATIONAL{1,1000000} ;
- #define AUDIO_RATE 44100
- 
-+// av_register_all was deprecated in 58.9.100, removed in 59.0.100
-+#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(59, 0, 100)
- class FFmpegInitialize
- {
- public :
-@@ -27,6 +29,7 @@ public :
- };
- 
- static FFmpegInitialize ffmpegInitialize;
-+#endif
- 
- void FrameWriter::init_hw_accel()
- {
-@@ -93,7 +96,7 @@ AVPixelFormat FrameWriter::lookup_pixel_format(std::string pix_fmt)
-     std::exit(-1);
- }
- 
--AVPixelFormat FrameWriter::choose_sw_format(AVCodec *codec)
-+AVPixelFormat FrameWriter::choose_sw_format(const AVCodec *codec)
- {
-     auto in_fmt = get_input_format();
- 
-@@ -272,7 +275,7 @@ void FrameWriter::init_video_stream()
-     AVDictionary *options = NULL;
-     load_codec_options(&options);
- 
--    AVCodec* codec = avcodec_find_encoder_by_name(params.codec.c_str());
-+    const AVCodec* codec = avcodec_find_encoder_by_name(params.codec.c_str());
-     if (!codec)
-     {
-         std::cerr << "Failed to find the given codec: " << params.codec << std::endl;
-@@ -286,7 +289,7 @@ void FrameWriter::init_video_stream()
-         std::exit(-1);
-     }
- 
--    videoCodecCtx = videoStream->codec;
-+    videoCodecCtx = avcodec_alloc_context3(codec);
-     videoCodecCtx->width = params.width;
-     videoCodecCtx->height = params.height;
-     videoCodecCtx->time_base = (AVRational){ 1, FPS };
-@@ -321,9 +324,15 @@ void FrameWriter::init_video_stream()
-         std::exit(-1);
-     }
-     av_dict_free(&options);
-+
-+    if ((ret = avcodec_parameters_from_context(videoStream->codecpar, videoCodecCtx)) < 0) {
-+        av_strerror(ret, err, 256);
-+        std::cerr << "avcodec_parameters_from_context failed: " << err << std::endl;
-+        std::exit(-1);
-+    }
- }
- 
--static uint64_t get_codec_channel_layout(AVCodec *codec)
-+static uint64_t get_codec_channel_layout(const AVCodec *codec)
- {
-       int i = 0;
-       if (!codec->channel_layouts)
-@@ -339,7 +348,7 @@ static uint64_t get_codec_channel_layout(AVCodec *codec)
-       return codec->channel_layouts[0];
- }
- 
--static enum AVSampleFormat get_codec_sample_fmt(AVCodec *codec)
-+static enum AVSampleFormat get_codec_sample_fmt(const AVCodec *codec)
- {
-     int i = 0;
-     if (!codec->sample_fmts)
-@@ -356,7 +365,7 @@ static enum AVSampleFormat get_codec_sample_fmt(AVCodec *codec)
- 
- void FrameWriter::init_audio_stream()
- {
--    AVCodec* codec = avcodec_find_encoder_by_name("aac");
-+    const AVCodec* codec = avcodec_find_encoder_by_name("aac");
-     if (!codec)
-     {
-         std::cerr << "Failed to find the aac codec" << std::endl;
-@@ -370,7 +379,7 @@ void FrameWriter::init_audio_stream()
-         std::exit(-1);
-     }
- 
--    audioCodecCtx = audioStream->codec;
-+    audioCodecCtx = avcodec_alloc_context3(codec);
-     audioCodecCtx->bit_rate = lrintf(128000.0f);
-     audioCodecCtx->sample_fmt = get_codec_sample_fmt(codec);
-     audioCodecCtx->channel_layout = get_codec_channel_layout(codec);
-@@ -407,6 +416,14 @@ void FrameWriter::init_audio_stream()
-         std::cerr << "Failed to initialize swr" << std::endl;
-         std::exit(-1);
-     }
-+
-+    int ret;
-+    if ((ret = avcodec_parameters_from_context(audioStream->codecpar, audioCodecCtx)) < 0) {
-+        char errmsg[256];
-+        av_strerror(ret, errmsg, sizeof(errmsg));
-+        std::cerr << "avcodec_parameters_from_context failed: " << err << std::endl;
-+        std::exit(-1);
-+    }
- }
- #endif
- void FrameWriter::init_codecs()
-@@ -697,11 +714,11 @@ FrameWriter::~FrameWriter()
-     if (outputFmt && (!(outputFmt->flags & AVFMT_NOFILE)))
-         avio_closep(&fmtCtx->pb);
- 
--    avcodec_close(videoStream->codec);
-+    avcodec_free_context(&videoCodecCtx);
-     // Freeing all the allocated memory:
-     sws_freeContext(swsCtx);
- 
-     av_frame_free(&encoder_frame);
-     if (params.enable_audio)
--        avcodec_close(audioStream->codec);
-+        avcodec_free_context(&audioCodecCtx);
- 
-     // TODO: free all the hw accel
-     avformat_free_context(fmtCtx);
-diff --git a/src/frame-writer.hpp b/src/frame-writer.hpp
-index cb9ba73..88f1ae2 100644
---- a/src/frame-writer.hpp
-+++ b/src/frame-writer.hpp
-@@ -72,7 +72,7 @@ class FrameWriter
-     void load_codec_options(AVDictionary **dict);
- 
-     SwsContext* swsCtx;
--    AVOutputFormat* outputFmt;
-+    const AVOutputFormat* outputFmt;
-     AVStream* videoStream;
-     AVCodecContext* videoCodecCtx;
-     AVFormatContext* fmtCtx;
-@@ -85,7 +85,7 @@ class FrameWriter
-     AVBufferRef *hw_frame_context = NULL;
- 
-     AVPixelFormat lookup_pixel_format(std::string pix_fmt);
--    AVPixelFormat choose_sw_format(AVCodec *codec);
-+    AVPixelFormat choose_sw_format(const AVCodec *codec);
-     AVPixelFormat get_input_format();
-     void init_hw_accel();
-     void init_sws(AVPixelFormat format);



More information about the arch-commits mailing list