Date: Friday, September 13, 2019 @ 12:40:08 Author: foutrelis Revision: 510316
archrelease: copy trunk to community-staging-x86_64 Added: performous/repos/community-staging-x86_64/ performous/repos/community-staging-x86_64/PKGBUILD (from rev 510315, performous/trunk/PKGBUILD) performous/repos/community-staging-x86_64/boost-1.67.patch (from rev 510315, performous/trunk/boost-1.67.patch) performous/repos/community-staging-x86_64/performous-boost-1.69.patch (from rev 510315, performous/trunk/performous-boost-1.69.patch) performous/repos/community-staging-x86_64/performous-boost-1.70.patch (from rev 510315, performous/trunk/performous-boost-1.70.patch) performous/repos/community-staging-x86_64/performous-libswresample.patch (from rev 510315, performous/trunk/performous-libswresample.patch) performous/repos/community-staging-x86_64/performous-opencv4.patch (from rev 510315, performous/trunk/performous-opencv4.patch) --------------------------------+ PKGBUILD | 52 +++++ boost-1.67.patch | 22 ++ performous-boost-1.69.patch | 22 ++ performous-boost-1.70.patch | 10 + performous-libswresample.patch | 380 +++++++++++++++++++++++++++++++++++++++ performous-opencv4.patch | 41 ++++ 6 files changed, 527 insertions(+) Copied: performous/repos/community-staging-x86_64/PKGBUILD (from rev 510315, performous/trunk/PKGBUILD) =================================================================== --- community-staging-x86_64/PKGBUILD (rev 0) +++ community-staging-x86_64/PKGBUILD 2019-09-13 12:40:08 UTC (rev 510316) @@ -0,0 +1,52 @@ +# Maintainer : Laurent Carlier <lordhea...@gmail.com> +# Contributor: Christoph Zeiler <archNOSPAM_at_moonblade.dot.org> + +pkgname=performous +pkgver=1.1 +pkgrel=21 +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') +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) +sha512sums=('6659aa03960e68d7af65b072e179e42b122d2a39d25229c6daf765146379a115a52e51c1dc2bc69081ea17fe7a22f1d7007b7cf9e09bc32d134c3ad8e3444dd1' + 'dde4ac66d92a5a269237abb27fc5140bf87fd07b1d1e333d0e47c13b05a66b08347883380a575f0635c871236519710e791d99d3bd06700dd48341f5e50fd8b1' + 'f85b9a5c1b1bf0f1f5df7fb13945856cbca19bc5e49e3bb6f3cff302110b08275e97496ec70f23a8e9c77246b92ddde826520000888d6a4c2e888a8bae311f17' + '854d969de951a5f380ddd1523b3d66639ef19b16af161466dfef3c697280c95884a3e34258dc86bb7eef1143ca24de44ae2dfccb5ce76fd333784b62f0762f56' + '6e2d619ba55294ad901f84e3d3a30fe08f092521b4e19041ce4eb19dddc3d8021dfd5697947489a8312246c71ff7b544af4562fa4dfc744f9c27c7bc59b8e9bd' + '7a4a11f0150930ea0527067519487629e714bc732eb111c1d4ca9b13cd8d0775182b22f8a96093223f7aab8524f63bdf901886169e6559adcd5e6b6a9b14edb4') + +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 +} + +build() { + cd performous-${pkgver} + + mkdir -p build + cd build + + cmake .. \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_CXX_FLAGS="${CXXFLAGS} -I/usr/include/harfbuzz" # Workaround build failure with pango 1.44 + make +} + +package() { + cd performous-${pkgver}/build + + make DESTDIR="$pkgdir" install +} Copied: performous/repos/community-staging-x86_64/boost-1.67.patch (from rev 510315, performous/trunk/boost-1.67.patch) =================================================================== --- community-staging-x86_64/boost-1.67.patch (rev 0) +++ community-staging-x86_64/boost-1.67.patch 2019-09-13 12:40:08 UTC (rev 510316) @@ -0,0 +1,22 @@ +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; Copied: performous/repos/community-staging-x86_64/performous-boost-1.69.patch (from rev 510315, performous/trunk/performous-boost-1.69.patch) =================================================================== --- community-staging-x86_64/performous-boost-1.69.patch (rev 0) +++ community-staging-x86_64/performous-boost-1.69.patch 2019-09-13 12:40:08 UTC (rev 510316) @@ -0,0 +1,22 @@ +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> Copied: performous/repos/community-staging-x86_64/performous-boost-1.70.patch (from rev 510315, performous/trunk/performous-boost-1.70.patch) =================================================================== --- community-staging-x86_64/performous-boost-1.70.patch (rev 0) +++ community-staging-x86_64/performous-boost-1.70.patch 2019-09-13 12:40:08 UTC (rev 510316) @@ -0,0 +1,10 @@ +--- 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> + Copied: performous/repos/community-staging-x86_64/performous-libswresample.patch (from rev 510315, performous/trunk/performous-libswresample.patch) =================================================================== --- community-staging-x86_64/performous-libswresample.patch (rev 0) +++ community-staging-x86_64/performous-libswresample.patch 2019-09-13 12:40:08 UTC (rev 510316) @@ -0,0 +1,380 @@ +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 "nieknooij...@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 "nieknooij...@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 Copied: performous/repos/community-staging-x86_64/performous-opencv4.patch (from rev 510315, performous/trunk/performous-opencv4.patch) =================================================================== --- community-staging-x86_64/performous-opencv4.patch (rev 0) +++ community-staging-x86_64/performous-opencv4.patch 2019-09-13 12:40:08 UTC (rev 510316) @@ -0,0 +1,41 @@ +--- 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)));