[arch-commits] Commit in performous/trunk (9 files)

Antonio Rojas arojas at gemini.archlinux.org
Mon Jun 6 16:24:43 UTC 2022


    Date: Monday, June 6, 2022 @ 16:24:43
  Author: arojas
Revision: 1226805

Update to 1.2.0, opencv 4.6 rebuild

Added:
  performous/trunk/ffmpeg5.patch
Modified:
  performous/trunk/PKGBUILD
Deleted:
  performous/trunk/boost-1.67.patch
  performous/trunk/ffmpeg5.patch
  performous/trunk/performous-boost-1.69.patch
  performous/trunk/performous-boost-1.70.patch
  performous/trunk/performous-boost-1.73.patch
  performous/trunk/performous-libswresample.patch
  performous/trunk/performous-opencv4.patch

--------------------------------+
 PKGBUILD                       |   38 +--
 boost-1.67.patch               |   22 --
 ffmpeg5.patch                  |   88 +++------
 performous-boost-1.69.patch    |   22 --
 performous-boost-1.70.patch    |   10 -
 performous-boost-1.73.patch    |   26 --
 performous-libswresample.patch |  380 ---------------------------------------
 performous-opencv4.patch       |   41 ----
 8 files changed, 41 insertions(+), 586 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2022-06-06 16:22:46 UTC (rev 1226804)
+++ PKGBUILD	2022-06-06 16:24:43 UTC (rev 1226805)
@@ -2,41 +2,23 @@
 # Contributor: Christoph Zeiler <archNOSPAM_at_moonblade.dot.org>
 
 pkgname=performous
-pkgver=1.1
-pkgrel=35
+pkgver=1.2.0
+pkgrel=1
 pkgdesc='A free game like "Singstar", "Rockband" or "Stepmania"'
 arch=('x86_64')
 url="https://performous.org/"
 license=('GPL')
-depends=('boost-libs' 'libepoxy' 'libxml++2.6' 'portaudio' 'portmidi' 'librsvg' 'ffmpeg' 'opencv' 'sdl2')
-makedepends=('cmake' 'pkgconfig' 'help2man' 'boost' 'mesa')
+depends=('boost-libs' 'libepoxy' 'libxml++2.6' 'portaudio' 'portmidi' 'librsvg' 'ffmpeg' 'opencv' 'sdl2' 'aubio')
+makedepends=('cmake' 'pkgconfig' 'help2man' 'boost' 'mesa' 'git' 'glm')
 optdepends=('performous-freesongs: free songs for performous')
-source=($pkgname-$pkgver.tar.gz::https://github.com/performous/${pkgname}/archive/${pkgver}.tar.gz
-        boost-1.67.patch
-        performous-libswresample.patch
-        performous-opencv4.patch
-        performous-boost-1.69.patch
-        performous-boost-1.70.patch
-        performous-boost-1.73.patch
+source=($pkgname-$pkgver.tar.gz::https://github.com/performous/performous/archive/refs/tags/${pkgver}.tar.gz
         ffmpeg5.patch)
-sha512sums=('6659aa03960e68d7af65b072e179e42b122d2a39d25229c6daf765146379a115a52e51c1dc2bc69081ea17fe7a22f1d7007b7cf9e09bc32d134c3ad8e3444dd1'
-            'dde4ac66d92a5a269237abb27fc5140bf87fd07b1d1e333d0e47c13b05a66b08347883380a575f0635c871236519710e791d99d3bd06700dd48341f5e50fd8b1'
-            'f85b9a5c1b1bf0f1f5df7fb13945856cbca19bc5e49e3bb6f3cff302110b08275e97496ec70f23a8e9c77246b92ddde826520000888d6a4c2e888a8bae311f17'
-            '854d969de951a5f380ddd1523b3d66639ef19b16af161466dfef3c697280c95884a3e34258dc86bb7eef1143ca24de44ae2dfccb5ce76fd333784b62f0762f56'
-            '6e2d619ba55294ad901f84e3d3a30fe08f092521b4e19041ce4eb19dddc3d8021dfd5697947489a8312246c71ff7b544af4562fa4dfc744f9c27c7bc59b8e9bd'
-            '7a4a11f0150930ea0527067519487629e714bc732eb111c1d4ca9b13cd8d0775182b22f8a96093223f7aab8524f63bdf901886169e6559adcd5e6b6a9b14edb4'
-            'd291621b191c0e55a47232e63a75d4059e2a983c78f9ad7d3a9709293fe22486f307d641ccecf2f0a56ff784b8a3cb6be35a531cb8adf5d35ff2ee3d333d5c40'
-            '1acd93b4fe28cadd887890c72d0a38975c777e4d0ce58c621cbf4600a4f49e643679cca7123ae34fc7adf022db366ac0906934f46f77880acb326fe1145aba1a')
+sha512sums=('a8fbbe3768f46915eacb65adcc1592295e4c6a84775ca55def01ebcff2218b1860daee0d4d5fcccc407d8df71da1ac25da667b47dd4a17239041a3d5fbfa1c56'
+            '4affb318c7fd6ac65ea4facfb2c5270ed6ec1816de69f1e77204c036cfb1c8cd548bb3e2e28bcd6169d531183fc8799669a86de95f4325e0b58254e596a0d5dc')
 
 prepare() {
-  cd performous-${pkgver}
-  patch -Np1 -i ../boost-1.67.patch
-  patch -Np1 -i ../performous-libswresample.patch
-  patch -p1 -i ../performous-opencv4.patch # Fix build with openCV 4
-  patch -p1 -i ../performous-boost-1.69.patch # Fix build with boost 1.69
-  patch -p1 -i ../performous-boost-1.70.patch # Fix build with boost 1.70
-  patch -p1 -i ../performous-boost-1.73.patch # Fix build with boost 1.73
-  patch -p1 -i ../ffmpeg5.patch # Fix build with FFmpeg 5
+  cd performous-$pkgver
+  patch -p1 -i ../ffmpeg5.patch # Fix build with FFMpeg 5
 }
 
 build() {
@@ -47,7 +29,7 @@
 
   cmake .. \
     -DCMAKE_INSTALL_PREFIX=/usr \
-    -DCMAKE_CXX_FLAGS="${CXXFLAGS} -I/usr/include/harfbuzz" # Workaround build failure with pango 1.44
+    -DCMAKE_BUILD_TYPE=None
   make
 }
 

Deleted: boost-1.67.patch
===================================================================
--- boost-1.67.patch	2022-06-06 16:22:46 UTC (rev 1226804)
+++ boost-1.67.patch	2022-06-06 16:24:43 UTC (rev 1226805)
@@ -1,22 +0,0 @@
-Only in performous-1.1: build
-diff -upr performous-1.1.orig/game/audio.cc performous-1.1/game/audio.cc
---- performous-1.1.orig/game/audio.cc	2016-01-23 12:40:01.000000000 +0200
-+++ performous-1.1/game/audio.cc	2018-06-03 03:29:35.251425495 +0300
-@@ -77,7 +77,7 @@ class AudioClock {
- 	static ptime getTime() { return microsec_clock::universal_time(); }
- 	// Conversion helpers
- 	static double getSeconds(time_duration t) { return 1e-6 * t.total_microseconds(); }
--	static time_duration getDuration(double seconds) { return microseconds(1e6 * seconds); }
-+	static time_duration getDuration(double seconds) { return microseconds(static_cast<long long>(1e6 * seconds)); }
- 
- 	mutable boost::mutex m_mutex;
- 	ptime m_baseTime; ///< A reference time (corresponds to m_basePos)
-@@ -149,7 +149,7 @@ class Music {
- 	int64_t m_pos; ///< Current sample position
- 	bool m_preview;
- 	AudioClock m_clock;
--	time_duration durationOf(int64_t samples) const { return microseconds(1e6 * samples / srate / 2.0); }
-+	time_duration durationOf(int64_t samples) const { return microseconds(static_cast<long long>(1e6 * samples / srate / 2.0)); }
- public:
- 	bool suppressCenterChannel;
- 	double fadeLevel;

Deleted: ffmpeg5.patch
===================================================================
--- ffmpeg5.patch	2022-06-06 16:22:46 UTC (rev 1226804)
+++ ffmpeg5.patch	2022-06-06 16:24:43 UTC (rev 1226805)
@@ -1,57 +0,0 @@
-diff --git a/game/ffmpeg.cc b/game/ffmpeg.cc
-index fc4ca441..58c3e646 100644
---- a/game/ffmpeg.cc
-+++ b/game/ffmpeg.cc
-@@ -82,17 +82,17 @@ FFmpeg::~FFmpeg() {
- 
- void FFmpeg::open() {
- 	boost::mutex::scoped_lock l(s_avcodec_mutex);
--	av_register_all();
- 	av_log_set_level(AV_LOG_ERROR);
- 	if (avformat_open_input(&m_formatContext, m_filename.string().c_str(), nullptr, nullptr)) throw std::runtime_error("Cannot open input file");
- 	if (avformat_find_stream_info(m_formatContext, nullptr) < 0) throw std::runtime_error("Cannot find stream information");
- 	m_formatContext->flags |= AVFMT_FLAG_GENPTS;
- 	// Find a track and open the codec
--	AVCodec* codec = nullptr;
-+	const AVCodec* codec = nullptr;
- 	m_streamId = av_find_best_stream(m_formatContext, (AVMediaType)m_mediaType, -1, -1, &codec, 0);
- 	if (m_streamId < 0) throw std::runtime_error("No suitable track found");
- 
--	AVCodecContext* cc = m_formatContext->streams[m_streamId]->codec;
-+        AVCodecContext* cc = avcodec_alloc_context3(avcodec_find_decoder(m_formatContext->streams[m_streamId]->codecpar->codec_id));
-+        avcodec_parameters_to_context(cc, m_formatContext->streams[m_streamId]->codecpar);
- 	if (avcodec_open2(cc, codec, nullptr) < 0) throw std::runtime_error("Cannot open codec");
- 	cc->workaround_bugs = FF_BUG_AUTODETECT;
- 	m_codecContext = cc;
-@@ -177,7 +177,7 @@ void FFmpeg::decodePacket() {
- 		ReadFramePacket(AVFormatContext* s): m_s(s) {
- 			if (av_read_frame(s, this) < 0) throw FFmpeg::eof_error();
- 		}
--		~ReadFramePacket() { av_free_packet(this); }
-+		~ReadFramePacket() { av_packet_unref(this); }
- 	};
- 
- 	// Read an AVPacket and decode it into AVFrames
-@@ -192,16 +192,16 @@ void FFmpeg::decodePacket() {
- #else
- 		boost::shared_ptr<AVFrame> frame(av_frame_alloc(), [](AVFrame* ptr) { av_frame_free(&ptr); });
- #endif
--		int frameFinished = 0;
--		int decodeSize = (m_mediaType == AVMEDIA_TYPE_VIDEO ?
--		  avcodec_decode_video2(m_codecContext, frame.get(), &frameFinished, &packet) :
--		  avcodec_decode_audio4(m_codecContext, frame.get(), &frameFinished, &packet));
-+                int ret = avcodec_receive_frame(m_codecContext, frame.get());
-+                if (ret < 0) return;
-+                int frameFinished = (ret == 0);
-+                int decodeSize = avcodec_send_packet(m_codecContext, &packet);
- 		if (decodeSize < 0) return; // Packet didn't produce any output (could be waiting for B frames or something)
- 		packetSize -= decodeSize; // Move forward within the packet
- 		if (!frameFinished) continue;
- 		// Update current position if timecode is available
--		if (frame->pkt_pts != int64_t(AV_NOPTS_VALUE)) {
--			m_position = double(frame->pkt_pts) * av_q2d(m_formatContext->streams[m_streamId]->time_base);
-+		if (frame->pts != int64_t(AV_NOPTS_VALUE)) {
-+			m_position = double(frame->pts) * av_q2d(m_formatContext->streams[m_streamId]->time_base);
- 			if (m_formatContext->start_time != int64_t(AV_NOPTS_VALUE))
- 				m_position -= double(m_formatContext->start_time) / AV_TIME_BASE;
- 		}

Added: ffmpeg5.patch
===================================================================
--- ffmpeg5.patch	                        (rev 0)
+++ ffmpeg5.patch	2022-06-06 16:24:43 UTC (rev 1226805)
@@ -0,0 +1,31 @@
+From 80d5b08d34a97db16fe12f82e9060570087ef0f0 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?S=C3=A9bastien=20Gonzalve?=
+ <sebastien.gonzalve at aliceadsl.fr>
+Date: Tue, 3 May 2022 20:26:25 +0200
+Subject: [PATCH] Fix ffmpeg compilation on FC36
+
+The new version stats:
+
+2021-04-27 - 46dac8cf3d - lavf 59.0.100 - avformat.h
+  av_find_best_stream now uses a const AVCodec ** parameter
+  for the returned decoder.
+
+So performous needs a patch to add const when needed.
+---
+ game/ffmpeg.cc | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/game/ffmpeg.cc b/game/ffmpeg.cc
+index 5005ed5aa..216ca6697 100644
+--- a/game/ffmpeg.cc
++++ b/game/ffmpeg.cc
+@@ -251,6 +251,9 @@ FFmpeg::FFmpeg(fs::path const& _filename, int mediaType) : m_filename(_filename)
+ 	if (err < 0) throw Error(*this, err);
+ 	m_formatContext->flags |= AVFMT_FLAG_GENPTS;
+ 	// Find a track and open the codec
++#if (LIBAVFORMAT_VERSION_INT) >= (AV_VERSION_INT(59, 0, 100))
++	const
++#endif
+ 	AVCodec* codec = nullptr;
+ 	m_streamId = av_find_best_stream(m_formatContext.get(), static_cast<AVMediaType>(mediaType), -1, -1, &codec, 0);
+ 	if (m_streamId < 0) throw Error(*this, m_streamId);

Deleted: performous-boost-1.69.patch
===================================================================
--- performous-boost-1.69.patch	2022-06-06 16:22:46 UTC (rev 1226804)
+++ performous-boost-1.69.patch	2022-06-06 16:24:43 UTC (rev 1226805)
@@ -1,22 +0,0 @@
-diff -ru performous-1.1.orig/game/backgrounds.hh performous-1.1/game/backgrounds.hh
---- performous-1.1.orig/game/backgrounds.hh	2019-01-15 10:39:54.147584168 +0000
-+++ performous-1.1/game/backgrounds.hh	2019-01-15 10:40:41.284376151 +0000
-@@ -7,6 +7,7 @@
- #include <boost/scoped_ptr.hpp>
- #include <boost/thread/mutex.hpp>
- #include <boost/thread/thread.hpp>
-+#include <boost/noncopyable.hpp>
- #include <vector>
- 
- /// songs class for songs screen
-diff -ru performous-1.1.orig/game/songs.hh performous-1.1/game/songs.hh
---- performous-1.1.orig/game/songs.hh	2019-01-15 10:39:54.147584168 +0000
-+++ performous-1.1/game/songs.hh	2019-01-15 10:41:03.901102679 +0000
-@@ -6,6 +6,7 @@
- #include <boost/scoped_ptr.hpp>
- #include <boost/thread/mutex.hpp>
- #include <boost/thread/thread.hpp>
-+#include <boost/noncopyable.hpp>
- #include <set>
- #include <sstream>
- #include <vector>

Deleted: performous-boost-1.70.patch
===================================================================
--- performous-boost-1.70.patch	2022-06-06 16:22:46 UTC (rev 1226804)
+++ performous-boost-1.70.patch	2022-06-06 16:24:43 UTC (rev 1226805)
@@ -1,10 +0,0 @@
---- a/game/svg.cc
-+++ b/game/svg.cc
-@@ -4,6 +4,7 @@
- #include "configuration.hh"
- #include "../common/image.hh"
- 
-+#include <boost/smart_ptr/shared_ptr.hpp>
- #include <librsvg/rsvg.h>
- #include <iostream>
- 

Deleted: performous-boost-1.73.patch
===================================================================
--- performous-boost-1.73.patch	2022-06-06 16:22:46 UTC (rev 1226804)
+++ performous-boost-1.73.patch	2022-06-06 16:24:43 UTC (rev 1226805)
@@ -1,26 +0,0 @@
-diff --git a/game/engine.cc b/game/engine.cc
-index 9f0f7ef..560ce71 100644
---- a/game/engine.cc
-+++ b/game/engine.cc
-@@ -8,6 +8,8 @@
- #include <iostream>
- #include <list>
- 
-+using namespace boost::placeholders;
-+
- const double Engine::TIMESTEP = 0.01;
- 
- Engine::Engine(Audio& audio, VocalTrackPtrs vocals, Database& database):
-diff --git a/game/surface.cc b/game/surface.cc
-index 75356fe..34951f9 100644
---- a/game/surface.cc
-+++ b/game/surface.cc
-@@ -16,6 +16,8 @@
- 
- using std::uint32_t;
- 
-+using namespace boost::placeholders;
-+
- Shader& getShader(std::string const& name) {
- 	return Game::getSingletonPtr()->window().shader(name);  // FIXME
- }
\ No newline at end of file

Deleted: performous-libswresample.patch
===================================================================
--- performous-libswresample.patch	2022-06-06 16:22:46 UTC (rev 1226804)
+++ performous-libswresample.patch	2022-06-06 16:24:43 UTC (rev 1226805)
@@ -1,380 +0,0 @@
-diff --git a/.gitignore b/.gitignore
-index 8f3cd966..908da8e1 100644
---- a/.gitignore
-+++ b/.gitignore
-@@ -7,4 +7,5 @@ CMakeLists.txt.user*
- dylibbundler.log
- performous-app-build.sh
- osx-utils/out
--osx-utils/Performous.dmg
-\ No newline at end of file
-+osx-utils/Performous.dmg
-+.vscode/
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 73993f92..2a7ec01a 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -86,7 +86,7 @@ endif()
- include(CPack)
- SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Niek Nooijens")
- SET(CPACK_PACKAGE_CONTACT "nieknooijens at gmail.com")
--SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6, libavcodec54, libavformat54, libavresample1, libsdl2-2.0-0, libportaudiocpp0, libboost-all-dev, libswscale2, libxml++2.6-2, libopencv-dev, librsvg2-2, libpango-1.0-0, libcairo2, libjpeg8, libpng12-0, libportmidi0 ")
-+SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6, libavcodec54, libavformat54, libswresample2, libsdl2-2.0-0, libportaudiocpp0, libboost-all-dev, libswscale2, libxml++2.6-2, libopencv-dev, librsvg2-2, libpango-1.0-0, libcairo2, libjpeg8, libpng12-0, libportmidi0 ")
- SET(CPACK_DEBIAN_PACKAGE_DESCRIPTION_SUMMARY "A free music rhythm game similar to SingStar, Guitar Hero and DDR")
- SET(CPACK_DEBIAN_PACKAGE_VERSION ${PROJECT_VERSION})
- SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64")
-diff --git a/cmake/Modules/FindSWResample.cmake b/cmake/Modules/FindSWResample.cmake
-new file mode 100644
-index 00000000..ce4dffd1
---- /dev/null
-+++ b/cmake/Modules/FindSWResample.cmake
-@@ -0,0 +1,44 @@
-+# - Try to find FFMPEG libswresample
-+# Once done, this will define
-+#
-+#  SWResample_FOUND - the library is available
-+#  SWResample_INCLUDE_DIRS - the include directories
-+#  SWResample_LIBRARIES - the libraries
-+#  SWResample_INCLUDE - the file to include (may be used in config.h)
-+#
-+# See documentation on how to write CMake scripts at
-+# http://www.cmake.org/Wiki/CMake:How_To_Find_Libraries
-+
-+include(LibFindMacros)
-+
-+libfind_package(SWResample AVUtil)
-+
-+libfind_pkg_check_modules(SWResample_PKGCONF libswresample)
-+
-+find_path(SWResample_INCLUDE_DIR
-+  NAMES libswresample/swresample.h ffmpeg/swresample.h swresample.h
-+  HINTS ${SWResample_PKGCONF_INCLUDE_DIRS}
-+  PATH_SUFFIXES ffmpeg
-+)
-+
-+if(SWResample_INCLUDE_DIR)
-+  foreach(suffix libswresample/ ffmpeg/ "")
-+    if(NOT SWResample_INCLUDE)
-+      if(EXISTS "${SWResample_INCLUDE_DIR}/${suffix}swresample.h")
-+        set(SWResample_INCLUDE "${suffix}swresample.h")
-+      endif(EXISTS "${SWResample_INCLUDE_DIR}/${suffix}swresample.h")
-+    endif(NOT SWResample_INCLUDE)
-+  endforeach(suffix)
-+
-+  if(NOT SWResample_INCLUDE)
-+    message(FATAL_ERROR "Found swresample.h include dir, but not the header file. Maybe you need to clear CMake cache?")
-+  endif(NOT SWResample_INCLUDE)
-+endif(SWResample_INCLUDE_DIR)
-+
-+find_library(SWResample_LIBRARY
-+  NAMES libswresample.dll.a swresample
-+  HINTS ${SWResample_PKGCONF_LIBRARY_DIRS}
-+)
-+
-+libfind_process(SWResample)
-+
-diff --git a/game/CMakeLists.txt b/game/CMakeLists.txt
-index c75dbf62..dd57328f 100644
---- a/game/CMakeLists.txt
-+++ b/game/CMakeLists.txt
-@@ -71,7 +71,7 @@ include_directories(${LibEpoxy_INCLUDE_DIRS})
- list(APPEND LIBS ${LibEpoxy_LIBRARIES})
- 
- # Find all the libs that don't require extra parameters
--foreach(lib ${OUR_LIBS} SDL2 PangoCairo LibRSVG LibXML++ AVFormat AVResample SWScale Z Jpeg Png PortAudio Fontconfig)
-+foreach(lib ${OUR_LIBS} SDL2 PangoCairo LibRSVG LibXML++ AVFormat SWResample SWScale Z Jpeg Png PortAudio Fontconfig)
- 	find_package(${lib} REQUIRED)
- 	message(STATUS "${lib} includes: ${${lib}_INCLUDE_DIRS}")
- 	include_directories(${${lib}_INCLUDE_DIRS})
-diff --git a/game/config.cmake.hh b/game/config.cmake.hh
-index 118c5e77..3a89b423 100644
---- a/game/config.cmake.hh
-+++ b/game/config.cmake.hh
-@@ -15,8 +15,8 @@
- #define AVCODEC_INCLUDE <@AVCodec_INCLUDE@>
- #define AVFORMAT_INCLUDE <@AVFormat_INCLUDE@>
- #define SWSCALE_INCLUDE <@SWScale_INCLUDE@>
-+#define SWRESAMPLE_INCLUDE <@SWResample_INCLUDE@>
- //libav 0.9 fix
--#define AVRESAMPLE_INCLUDE <@AVResample_INCLUDE@>
- #define AVUTIL_INCLUDE <@AVUtil_INCLUDE@>
- #define AVUTIL_OPT_INCLUDE <@AVUtil_INCLUDE_DIRS@/libavutil/opt.h> //HACK to get AVOption class!
- #define AVUTIL_MATH_INCLUDE <@AVUtil_INCLUDE_DIRS@/libavutil/mathematics.h>
-diff --git a/game/ffmpeg.cc b/game/ffmpeg.cc
-index fc4ca441..651aa60e 100644
---- a/game/ffmpeg.cc
-+++ b/game/ffmpeg.cc
-@@ -12,7 +12,7 @@ extern "C" {
- #include AVCODEC_INCLUDE
- #include AVFORMAT_INCLUDE
- #include SWSCALE_INCLUDE
--#include AVRESAMPLE_INCLUDE
-+#include SWRESAMPLE_INCLUDE
- #include AVUTIL_INCLUDE
- #include AVUTIL_OPT_INCLUDE
- #include AVUTIL_MATH_INCLUDE
-@@ -58,7 +58,7 @@ FFmpeg::FFmpeg(fs::path const& _filename, unsigned int rate):
- 			  " avutil:" + ffversion(LIBAVUTIL_VERSION_INT) +
- 			  " avcodec:" + ffversion(LIBAVCODEC_VERSION_INT) +
- 			  " avformat:" + ffversion(LIBAVFORMAT_VERSION_INT) +
--			  " avresample:" + ffversion(LIBAVRESAMPLE_VERSION_INT) +
-+			  " swresample:" + ffversion(LIBSWRESAMPLE_VERSION_INT) +
- 			  " swscale:" + ffversion(LIBSWSCALE_VERSION_INT)
- 			  << std::endl;
- 		} else {
-@@ -66,7 +66,7 @@ FFmpeg::FFmpeg(fs::path const& _filename, unsigned int rate):
- 			  " avutil:" + ffversion(LIBAVUTIL_VERSION_INT) + "/" + ffversion(avutil_version()) +
- 			  " avcodec:" + ffversion(LIBAVCODEC_VERSION_INT) + "/" + ffversion(avcodec_version()) +
- 			  " avformat:" + ffversion(LIBAVFORMAT_VERSION_INT) + "/" + ffversion(avformat_version()) +
--			  " avresample:" + ffversion(LIBAVRESAMPLE_VERSION_INT) + "/" + ffversion(avresample_version()) +
-+			  " swresample:" + ffversion(LIBSWRESAMPLE_VERSION_INT) + "/" + ffversion(swresample_version()) +
- 			  " swscale:" + ffversion(LIBSWSCALE_VERSION_INT) + "/" + ffversion(swscale_version())
- 			  << std::endl;
- 		}
-@@ -99,14 +99,14 @@ void FFmpeg::open() {
- 
- 	switch (m_mediaType) {
- 	case AVMEDIA_TYPE_AUDIO:
--		m_resampleContext = avresample_alloc_context();
-+		m_resampleContext = swr_alloc();
- 		av_opt_set_int(m_resampleContext, "in_channel_layout", m_codecContext->channel_layout ? m_codecContext->channel_layout : av_get_default_channel_layout(m_codecContext->channels), 0);
- 		av_opt_set_int(m_resampleContext, "out_channel_layout", av_get_default_channel_layout(AUDIO_CHANNELS), 0);
- 		av_opt_set_int(m_resampleContext, "in_sample_rate", m_codecContext->sample_rate, 0);
- 		av_opt_set_int(m_resampleContext, "out_sample_rate", m_rate, 0);
- 		av_opt_set_int(m_resampleContext, "in_sample_fmt", m_codecContext->sample_fmt, 0);
- 		av_opt_set_int(m_resampleContext, "out_sample_fmt", AV_SAMPLE_FMT_S16, 0);
--		avresample_open(m_resampleContext);
-+		swr_init(m_resampleContext);
- 		if (!m_resampleContext) throw std::runtime_error("Cannot create resampling context");
- 		audioQueue.setSamplesPerSecond(AUDIO_CHANNELS * m_rate);
- 		break;
-@@ -147,7 +147,7 @@ void FFmpeg::operator()() {
- 	videoQueue.reset();
- 	// TODO: use RAII for freeing resources (to prevent memory leaks)
- 	boost::mutex::scoped_lock l(s_avcodec_mutex); // avcodec_close is not thread-safe
--	if (m_resampleContext) avresample_close(m_resampleContext);
-+	if (m_resampleContext) swr_close(m_resampleContext);
- 	if (m_codecContext) avcodec_close(m_codecContext);
- #if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(53, 17, 0)
- 	if (m_formatContext) avformat_close_input(&m_formatContext);
-@@ -229,13 +229,11 @@ void FFmpeg::processAudio(AVFrame* frame) {
- 	// resample to output
- 	int16_t *output;
- 	int out_linesize;
--	int out_samples = avresample_available(m_resampleContext) +
--		av_rescale_rnd(avresample_get_delay(m_resampleContext) +
--		frame->nb_samples, frame->sample_rate, m_rate, AV_ROUND_UP);
-+	int out_samples = swr_get_out_samples(m_resampleContext, frame->nb_samples);
- 	av_samples_alloc((uint8_t**)&output, &out_linesize, AUDIO_CHANNELS, out_samples,
- 		AV_SAMPLE_FMT_S16, 0);
--	out_samples = avresample_convert(m_resampleContext, (uint8_t**)&output, 0, out_samples,
--		&frame->data[0], 0, frame->nb_samples);
-+	out_samples = swr_convert(m_resampleContext, (uint8_t**)&output, out_samples,
-+		(const uint8_t**)&frame->data[0], frame->nb_samples);
- 	// The output is now an interleaved array of 16-bit samples
- 	std::vector<int16_t> m_output(output, output+out_samples*AUDIO_CHANNELS);
- 	audioQueue.push(m_output,m_position);
-diff --git a/game/ffmpeg.hh b/game/ffmpeg.hh
-index 7f817078..5b67c4e7 100644
---- a/game/ffmpeg.hh
-+++ b/game/ffmpeg.hh
-@@ -162,7 +162,7 @@ extern "C" {
-   struct AVCodecContext;
-   struct AVFormatContext;
-   struct AVFrame;
--  struct AVAudioResampleContext;
-+  struct SwrContext;
-   struct SwsContext;
- }
- 
-@@ -203,7 +203,7 @@ class FFmpeg {
- 	int m_mediaType;  // enum AVMediaType
- 	AVFormatContext* m_formatContext;
- 	AVCodecContext* m_codecContext;
--	AVAudioResampleContext* m_resampleContext;
-+	SwrContext* m_resampleContext;
- 	SwsContext* m_swsContext;
- 	// Make sure the thread starts only after initializing everything else
- 	boost::scoped_ptr<boost::thread> m_thread;
-diff --git a/patch b/patch
-new file mode 100644
-index 00000000..5e0eaba0
---- /dev/null
-+++ b/patch
-@@ -0,0 +1,175 @@
-+diff --git a/.gitignore b/.gitignore
-+index 8f3cd966..908da8e1 100644
-+--- a/.gitignore
-++++ b/.gitignore
-+@@ -7,4 +7,5 @@ CMakeLists.txt.user*
-+ dylibbundler.log
-+ performous-app-build.sh
-+ osx-utils/out
-+-osx-utils/Performous.dmg
-+\ No newline at end of file
-++osx-utils/Performous.dmg
-++.vscode/
-+diff --git a/CMakeLists.txt b/CMakeLists.txt
-+index 73993f92..2a7ec01a 100644
-+--- a/CMakeLists.txt
-++++ b/CMakeLists.txt
-+@@ -86,7 +86,7 @@ endif()
-+ include(CPack)
-+ SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Niek Nooijens")
-+ SET(CPACK_PACKAGE_CONTACT "nieknooijens at gmail.com")
-+-SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6, libavcodec54, libavformat54, libavresample1, libsdl2-2.0-0, libportaudiocpp0, libboost-all-dev, libswscale2, libxml++2.6-2, libopencv-dev, librsvg2-2, libpango-1.0-0, libcairo2, libjpeg8, libpng12-0, libportmidi0 ")
-++SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6, libavcodec54, libavformat54, libswresample2, libsdl2-2.0-0, libportaudiocpp0, libboost-all-dev, libswscale2, libxml++2.6-2, libopencv-dev, librsvg2-2, libpango-1.0-0, libcairo2, libjpeg8, libpng12-0, libportmidi0 ")
-+ SET(CPACK_DEBIAN_PACKAGE_DESCRIPTION_SUMMARY "A free music rhythm game similar to SingStar, Guitar Hero and DDR")
-+ SET(CPACK_DEBIAN_PACKAGE_VERSION ${PROJECT_VERSION})
-+ SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64")
-+diff --git a/cmake/Modules/FindSWResample.cmake b/cmake/Modules/FindSWResample.cmake
-+new file mode 100644
-+index 00000000..ce4dffd1
-+--- /dev/null
-++++ b/cmake/Modules/FindSWResample.cmake
-+@@ -0,0 +1,44 @@
-++# - Try to find FFMPEG libswresample
-++# Once done, this will define
-++#
-++#  SWResample_FOUND - the library is available
-++#  SWResample_INCLUDE_DIRS - the include directories
-++#  SWResample_LIBRARIES - the libraries
-++#  SWResample_INCLUDE - the file to include (may be used in config.h)
-++#
-++# See documentation on how to write CMake scripts at
-++# http://www.cmake.org/Wiki/CMake:How_To_Find_Libraries
-++
-++include(LibFindMacros)
-++
-++libfind_package(SWResample AVUtil)
-++
-++libfind_pkg_check_modules(SWResample_PKGCONF libswresample)
-++
-++find_path(SWResample_INCLUDE_DIR
-++  NAMES libswresample/swresample.h ffmpeg/swresample.h swresample.h
-++  HINTS ${SWResample_PKGCONF_INCLUDE_DIRS}
-++  PATH_SUFFIXES ffmpeg
-++)
-++
-++if(SWResample_INCLUDE_DIR)
-++  foreach(suffix libswresample/ ffmpeg/ "")
-++    if(NOT SWResample_INCLUDE)
-++      if(EXISTS "${SWResample_INCLUDE_DIR}/${suffix}swresample.h")
-++        set(SWResample_INCLUDE "${suffix}swresample.h")
-++      endif(EXISTS "${SWResample_INCLUDE_DIR}/${suffix}swresample.h")
-++    endif(NOT SWResample_INCLUDE)
-++  endforeach(suffix)
-++
-++  if(NOT SWResample_INCLUDE)
-++    message(FATAL_ERROR "Found swresample.h include dir, but not the header file. Maybe you need to clear CMake cache?")
-++  endif(NOT SWResample_INCLUDE)
-++endif(SWResample_INCLUDE_DIR)
-++
-++find_library(SWResample_LIBRARY
-++  NAMES libswresample.dll.a swresample
-++  HINTS ${SWResample_PKGCONF_LIBRARY_DIRS}
-++)
-++
-++libfind_process(SWResample)
-++
-+diff --git a/game/CMakeLists.txt b/game/CMakeLists.txt
-+index c75dbf62..dd57328f 100644
-+--- a/game/CMakeLists.txt
-++++ b/game/CMakeLists.txt
-+@@ -71,7 +71,7 @@ include_directories(${LibEpoxy_INCLUDE_DIRS})
-+ list(APPEND LIBS ${LibEpoxy_LIBRARIES})
-+ 
-+ # Find all the libs that don't require extra parameters
-+-foreach(lib ${OUR_LIBS} SDL2 PangoCairo LibRSVG LibXML++ AVFormat AVResample SWScale Z Jpeg Png PortAudio Fontconfig)
-++foreach(lib ${OUR_LIBS} SDL2 PangoCairo LibRSVG LibXML++ AVFormat SWResample SWScale Z Jpeg Png PortAudio Fontconfig)
-+ 	find_package(${lib} REQUIRED)
-+ 	message(STATUS "${lib} includes: ${${lib}_INCLUDE_DIRS}")
-+ 	include_directories(${${lib}_INCLUDE_DIRS})
-+diff --git a/game/config.cmake.hh b/game/config.cmake.hh
-+index 118c5e77..3a89b423 100644
-+--- a/game/config.cmake.hh
-++++ b/game/config.cmake.hh
-+@@ -15,8 +15,8 @@
-+ #define AVCODEC_INCLUDE <@AVCodec_INCLUDE@>
-+ #define AVFORMAT_INCLUDE <@AVFormat_INCLUDE@>
-+ #define SWSCALE_INCLUDE <@SWScale_INCLUDE@>
-++#define SWRESAMPLE_INCLUDE <@SWResample_INCLUDE@>
-+ //libav 0.9 fix
-+-#define AVRESAMPLE_INCLUDE <@AVResample_INCLUDE@>
-+ #define AVUTIL_INCLUDE <@AVUtil_INCLUDE@>
-+ #define AVUTIL_OPT_INCLUDE <@AVUtil_INCLUDE_DIRS@/libavutil/opt.h> //HACK to get AVOption class!
-+ #define AVUTIL_MATH_INCLUDE <@AVUtil_INCLUDE_DIRS@/libavutil/mathematics.h>
-+diff --git a/game/ffmpeg.cc b/game/ffmpeg.cc
-+index fc4ca441..651aa60e 100644
-+--- a/game/ffmpeg.cc
-++++ b/game/ffmpeg.cc
-+@@ -12,7 +12,7 @@ extern "C" {
-+ #include AVCODEC_INCLUDE
-+ #include AVFORMAT_INCLUDE
-+ #include SWSCALE_INCLUDE
-+-#include AVRESAMPLE_INCLUDE
-++#include SWRESAMPLE_INCLUDE
-+ #include AVUTIL_INCLUDE
-+ #include AVUTIL_OPT_INCLUDE
-+ #include AVUTIL_MATH_INCLUDE
-+@@ -58,7 +58,7 @@ FFmpeg::FFmpeg(fs::path const& _filename, unsigned int rate):
-+ 			  " avutil:" + ffversion(LIBAVUTIL_VERSION_INT) +
-+ 			  " avcodec:" + ffversion(LIBAVCODEC_VERSION_INT) +
-+ 			  " avformat:" + ffversion(LIBAVFORMAT_VERSION_INT) +
-+-			  " avresample:" + ffversion(LIBAVRESAMPLE_VERSION_INT) +
-++			  " swresample:" + ffversion(LIBSWRESAMPLE_VERSION_INT) +
-+ 			  " swscale:" + ffversion(LIBSWSCALE_VERSION_INT)
-+ 			  << std::endl;
-+ 		} else {
-+@@ -66,7 +66,7 @@ FFmpeg::FFmpeg(fs::path const& _filename, unsigned int rate):
-+ 			  " avutil:" + ffversion(LIBAVUTIL_VERSION_INT) + "/" + ffversion(avutil_version()) +
-+ 			  " avcodec:" + ffversion(LIBAVCODEC_VERSION_INT) + "/" + ffversion(avcodec_version()) +
-+ 			  " avformat:" + ffversion(LIBAVFORMAT_VERSION_INT) + "/" + ffversion(avformat_version()) +
-+-			  " avresample:" + ffversion(LIBAVRESAMPLE_VERSION_INT) + "/" + ffversion(avresample_version()) +
-++			  " swresample:" + ffversion(LIBSWRESAMPLE_VERSION_INT) + "/" + ffversion(swresample_version()) +
-+ 			  " swscale:" + ffversion(LIBSWSCALE_VERSION_INT) + "/" + ffversion(swscale_version())
-+ 			  << std::endl;
-+ 		}
-+@@ -99,14 +99,14 @@ void FFmpeg::open() {
-+ 
-+ 	switch (m_mediaType) {
-+ 	case AVMEDIA_TYPE_AUDIO:
-+-		m_resampleContext = avresample_alloc_context();
-++		m_resampleContext = swr_alloc();
-+ 		av_opt_set_int(m_resampleContext, "in_channel_layout", m_codecContext->channel_layout ? m_codecContext->channel_layout : av_get_default_channel_layout(m_codecContext->channels), 0);
-+ 		av_opt_set_int(m_resampleContext, "out_channel_layout", av_get_default_channel_layout(AUDIO_CHANNELS), 0);
-+ 		av_opt_set_int(m_resampleContext, "in_sample_rate", m_codecContext->sample_rate, 0);
-+ 		av_opt_set_int(m_resampleContext, "out_sample_rate", m_rate, 0);
-+ 		av_opt_set_int(m_resampleContext, "in_sample_fmt", m_codecContext->sample_fmt, 0);
-+ 		av_opt_set_int(m_resampleContext, "out_sample_fmt", AV_SAMPLE_FMT_S16, 0);
-+-		avresample_open(m_resampleContext);
-++		swr_init(m_resampleContext);
-+ 		if (!m_resampleContext) throw std::runtime_error("Cannot create resampling context");
-+ 		audioQueue.setSamplesPerSecond(AUDIO_CHANNELS * m_rate);
-+ 		break;
-+@@ -147,7 +147,7 @@ void FFmpeg::operator()() {
-+ 	videoQueue.reset();
-+ 	// TODO: use RAII for freeing resources (to prevent memory leaks)
-+ 	boost::mutex::scoped_lock l(s_avcodec_mutex); // avcodec_close is not thread-safe
-+-	if (m_resampleContext) avresample_close(m_resampleContext);
-++	if (m_resampleContext) swr_close(m_resampleContext);
-+ 	if (m_codecContext) avcodec_close(m_codecContext);
-+ #if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(53, 17, 0)
-+ 	if (m_formatContext) avformat_close_input(&m_formatContext);
-+@@ -229,13 +229,11 @@ void FFmpeg::processAudio(AVFrame* frame) {
-+ 	// resample to output
-+ 	int16_t *output;
-+ 	int out_linesize;
-+-	int out_samples = avresample_available(m_resampleContext) +
-+-		av_rescale_rnd(avresample_get_delay(m_resampleContext) +
-+-		frame->nb_samples, frame->sample_rate, m_rate, AV_ROUND_UP);
-++	int out_samples = swr_get_out_samples(m_resampleContext, frame->nb_samples);
-+ 	av_samples_alloc((uint8_t**)&output, &out_linesize, AUDIO_CHANNELS, out_samples,
-+ 		AV_SAMPLE_FMT_S16, 0);
-+-	out_samples = avresample_convert(m_resampleContext, (uint8_t**)&output, 0, out_samples,
-+-		&frame->data[0], 0, frame->nb_samples);
-++	out_samples = swr_convert(m_resampleContext, (uint8_t**)&output, out_samples,
-++		(const uint8_t**)&frame->data[0], frame->nb_samples);
-+ 	// The output is now an interleaved array of 16-bit samples
-+ 	std::vector<int16_t> m_output(output, output+out_samples*AUDIO_C
-\ No newline at end of file

Deleted: performous-opencv4.patch
===================================================================
--- performous-opencv4.patch	2022-06-06 16:22:46 UTC (rev 1226804)
+++ performous-opencv4.patch	2022-06-06 16:24:43 UTC (rev 1226805)
@@ -1,41 +0,0 @@
---- performous-1.1/game/webcam.cc.orig	2018-11-20 20:50:27.857909212 +0000
-+++ performous-1.1/game/webcam.cc	2018-11-20 20:51:55.798134386 +0000
-@@ -7,6 +7,7 @@
- 
- #ifdef USE_OPENCV
- #include <opencv2/opencv.hpp>
-+#include <opencv2/videoio.hpp>
- 
- #else
- // Dummy classes
-@@ -31,21 +32,21 @@
- 			throw std::runtime_error("Could not initialize webcam capturing!");
- 	}
- 	// Try to get at least VGA resolution
--	if (m_capture->get(CV_CAP_PROP_FRAME_WIDTH) < 640
--	  || m_capture->get(CV_CAP_PROP_FRAME_HEIGHT) < 480) {
--		m_capture->set(CV_CAP_PROP_FRAME_WIDTH, 640);
--		m_capture->set(CV_CAP_PROP_FRAME_HEIGHT, 480);
-+	if (m_capture->get(cv::CAP_PROP_FRAME_WIDTH) < 640
-+	  || m_capture->get(cv::CAP_PROP_FRAME_HEIGHT) < 480) {
-+		m_capture->set(cv::CAP_PROP_FRAME_WIDTH, 640);
-+		m_capture->set(cv::CAP_PROP_FRAME_HEIGHT, 480);
- 	}
- 	// Print actual values
- 	std::cout << "Webcam frame properties: "
--	  << m_capture->get(CV_CAP_PROP_FRAME_WIDTH) << "x"
--	  << m_capture->get(CV_CAP_PROP_FRAME_HEIGHT) << std::endl;
-+	  << m_capture->get(cv::CAP_PROP_FRAME_WIDTH) << "x"
-+	  << m_capture->get(cv::CAP_PROP_FRAME_HEIGHT) << std::endl;
- 
- 	// Initialize the video writer
- 	#ifdef SAVE_WEBCAM_VIDEO
--	float fps = m_capture->get(CV_CAP_PROP_FPS);
--	int framew = m_capture->get(CV_CAP_PROP_FRAME_WIDTH);
--	int frameh = m_capture->get(CV_CAP_PROP_FRAME_HEIGHT);
-+	float fps = m_capture->get(cv::CAP_PROP_FPS);
-+	int framew = m_capture->get(cv::CAP_PROP_FRAME_WIDTH);
-+	int frameh = m_capture->get(cv::CAP_PROP_FRAME_HEIGHT);
- 	int codec = CV_FOURCC('P','I','M','1'); // MPEG-1
- 	std::string out_file = (getHomeDir() / "performous-webcam_out.mpg").string();
- 	m_writer.reset(new cv::VideoWriter(out_file.c_str(), codec, fps > 0 ? fps : 30.0f, cvSize(framew,frameh)));



More information about the arch-commits mailing list