[arch-commits] Commit in wf-recorder/repos (3 files)
Brett Cornwall
ainola at gemini.archlinux.org
Sat Feb 5 04:33:03 UTC 2022
Date: Saturday, February 5, 2022 @ 04:33:02
Author: ainola
Revision: 1126398
archrelease: copy trunk to community-testing-x86_64
Added:
wf-recorder/repos/community-testing-x86_64/
wf-recorder/repos/community-testing-x86_64/PKGBUILD
(from rev 1126397, wf-recorder/trunk/PKGBUILD)
wf-recorder/repos/community-testing-x86_64/ffmpeg5.patch
(from rev 1126397, wf-recorder/trunk/ffmpeg5.patch)
---------------+
PKGBUILD | 53 ++++++++++++++++++
ffmpeg5.patch | 159 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 212 insertions(+)
Copied: wf-recorder/repos/community-testing-x86_64/PKGBUILD (from rev 1126397, wf-recorder/trunk/PKGBUILD)
===================================================================
--- community-testing-x86_64/PKGBUILD (rev 0)
+++ community-testing-x86_64/PKGBUILD 2022-02-05 04:33:02 UTC (rev 1126398)
@@ -0,0 +1,53 @@
+# Maintainer: Brett Cornwall <ainola at archlinux.org>
+# Contributor: Lennard Hofmann
+
+pkgname=wf-recorder
+pkgver=0.2.1
+pkgrel=5
+pkgdesc="Screen recorder for wlroots-based compositors such as sway"
+arch=("x86_64")
+url="https://github.com/ammen99/wf-recorder"
+license=('MIT')
+depends=(
+ 'libavcodec.so'
+ 'libavdevice.so'
+ 'libavformat.so'
+ 'libavutil.so'
+ 'libswresample.so'
+ 'libswscale.so'
+ 'ocl-icd'
+ 'wayland'
+)
+makedepends=(
+ 'meson'
+ 'opencl-headers'
+ 'scdoc'
+ 'wayland-protocols'
+)
+optdepends=(
+ 'slurp: Select a region to record'
+)
+options=(debug)
+source=("$pkgname-$pkgver.tar.gz::https://github.com/ammen99/wf-recorder/archive/v$pkgver.tar.gz"
+ ffmpeg5.patch)
+sha256sums=('45cf04cf58cf241c22fa2fbb70481a3747ad33e6930e4bdba7b9cc7018789ad1'
+ '8012b4f09d3a826d06e1ec880aabbd12068a6fa913fd4d577a88e25a09e17b64')
+
+prepare() {
+ # Fix build with FFmpeg 5
+ patch -d $pkgname-$pkgver -p1 < ffmpeg5.patch
+}
+
+build() {
+ meson "$pkgname-$pkgver" build \
+ -Dman-pages=enabled \
+ -Dopencl=enabled \
+ --prefix=/usr \
+ --buildtype=plain
+ ninja -C build
+}
+
+package() {
+ DESTDIR="$pkgdir/" ninja -C build install
+ install -Dm644 "$pkgname-$pkgver/LICENSE" -t "$pkgdir/usr/share/licenses/$pkgname"
+}
Copied: wf-recorder/repos/community-testing-x86_64/ffmpeg5.patch (from rev 1126397, wf-recorder/trunk/ffmpeg5.patch)
===================================================================
--- community-testing-x86_64/ffmpeg5.patch (rev 0)
+++ community-testing-x86_64/ffmpeg5.patch 2022-02-05 04:33:02 UTC (rev 1126398)
@@ -0,0 +1,159 @@
+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