[arch-commits] Commit in performous/trunk (PKGBUILD ffmpeg5.patch)
Antonio Rojas
arojas at gemini.archlinux.org
Sat Jan 29 19:20:27 UTC 2022
Date: Saturday, January 29, 2022 @ 19:20:26
Author: arojas
Revision: 1119933
ffmpeg 5 rebuild
Added:
performous/trunk/ffmpeg5.patch
Modified:
performous/trunk/PKGBUILD
---------------+
PKGBUILD | 9 +++++---
ffmpeg5.patch | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 63 insertions(+), 3 deletions(-)
Modified: PKGBUILD
===================================================================
--- PKGBUILD 2022-01-29 19:19:52 UTC (rev 1119932)
+++ PKGBUILD 2022-01-29 19:20:26 UTC (rev 1119933)
@@ -3,7 +3,7 @@
pkgname=performous
pkgver=1.1
-pkgrel=34
+pkgrel=35
pkgdesc='A free game like "Singstar", "Rockband" or "Stepmania"'
arch=('x86_64')
url="https://performous.org/"
@@ -17,7 +17,8 @@
performous-opencv4.patch
performous-boost-1.69.patch
performous-boost-1.70.patch
- performous-boost-1.73.patch)
+ performous-boost-1.73.patch
+ ffmpeg5.patch)
sha512sums=('6659aa03960e68d7af65b072e179e42b122d2a39d25229c6daf765146379a115a52e51c1dc2bc69081ea17fe7a22f1d7007b7cf9e09bc32d134c3ad8e3444dd1'
'dde4ac66d92a5a269237abb27fc5140bf87fd07b1d1e333d0e47c13b05a66b08347883380a575f0635c871236519710e791d99d3bd06700dd48341f5e50fd8b1'
'f85b9a5c1b1bf0f1f5df7fb13945856cbca19bc5e49e3bb6f3cff302110b08275e97496ec70f23a8e9c77246b92ddde826520000888d6a4c2e888a8bae311f17'
@@ -24,7 +25,8 @@
'854d969de951a5f380ddd1523b3d66639ef19b16af161466dfef3c697280c95884a3e34258dc86bb7eef1143ca24de44ae2dfccb5ce76fd333784b62f0762f56'
'6e2d619ba55294ad901f84e3d3a30fe08f092521b4e19041ce4eb19dddc3d8021dfd5697947489a8312246c71ff7b544af4562fa4dfc744f9c27c7bc59b8e9bd'
'7a4a11f0150930ea0527067519487629e714bc732eb111c1d4ca9b13cd8d0775182b22f8a96093223f7aab8524f63bdf901886169e6559adcd5e6b6a9b14edb4'
- 'd291621b191c0e55a47232e63a75d4059e2a983c78f9ad7d3a9709293fe22486f307d641ccecf2f0a56ff784b8a3cb6be35a531cb8adf5d35ff2ee3d333d5c40')
+ 'd291621b191c0e55a47232e63a75d4059e2a983c78f9ad7d3a9709293fe22486f307d641ccecf2f0a56ff784b8a3cb6be35a531cb8adf5d35ff2ee3d333d5c40'
+ '1acd93b4fe28cadd887890c72d0a38975c777e4d0ce58c621cbf4600a4f49e643679cca7123ae34fc7adf022db366ac0906934f46f77880acb326fe1145aba1a')
prepare() {
cd performous-${pkgver}
@@ -34,6 +36,7 @@
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
}
build() {
Added: ffmpeg5.patch
===================================================================
--- ffmpeg5.patch (rev 0)
+++ ffmpeg5.patch 2022-01-29 19:20:26 UTC (rev 1119933)
@@ -0,0 +1,57 @@
+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;
+ }
More information about the arch-commits
mailing list