commit:     ec329317cce1415d6cfb7211ebc343a7b74f56b0
Author:     Pacho Ramos <pacho <AT> gentoo <DOT> org>
AuthorDate: Sat Jun 17 09:56:39 2017 +0000
Commit:     Pacho Ramos <pacho <AT> gentoo <DOT> org>
CommitDate: Sat Jun 17 09:57:00 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ec329317

games-emulation/pcsxr: Fix compatibility with ffmpeg-3 (#602396 by shinydoofy)

Package-Manager: Portage-2.3.6, Repoman-2.3.2

 .../pcsxr/files/pcsxr-1.9.94-ffmpeg3.patch         |  62 +++++++++++
 .../files/pcsxr-1.9.94-zlib-uncompress2.patch      |   8 +-
 games-emulation/pcsxr/pcsxr-1.9.94-r2.ebuild       | 115 +++++++++++++++++++++
 3 files changed, 181 insertions(+), 4 deletions(-)

diff --git a/games-emulation/pcsxr/files/pcsxr-1.9.94-ffmpeg3.patch 
b/games-emulation/pcsxr/files/pcsxr-1.9.94-ffmpeg3.patch
new file mode 100644
index 00000000000..345ed9993ea
--- /dev/null
+++ b/games-emulation/pcsxr/files/pcsxr-1.9.94-ffmpeg3.patch
@@ -0,0 +1,62 @@
+--- a/libpcsxcore/cdriso.c     2013-11-09 16:24:14.000000000 +0100
++++ b/libpcsxcore/cdriso.c     2016-12-12 01:02:25.652521029 +0100
+@@ -266,14 +266,14 @@
+               }
+ 
+               if (!decoded_frame) {
+-                      if (!(decoded_frame = avcodec_alloc_frame())) {
++                      if (!(decoded_frame = av_frame_alloc())) {
+                               SysMessage(_(" -> Error allocating audio frame 
buffer. This track will not be available."));
+                               avformat_close_input(&inAudioFormat);
+-                              avcodec_free_frame(&decoded_frame);
++                              av_frame_free(&decoded_frame);
+                               return 1; // error decoding frame
+                       }
+               } else {
+-                      avcodec_get_frame_defaults(decoded_frame);
++                      av_frame_unref(decoded_frame);
+               }
+               len = avcodec_decode_audio4(c, decoded_frame, &got_frame, 
&avpkt);
+               if (len > 0 && got_frame) {
+@@ -285,7 +285,7 @@
+                       fwrite(decoded_frame->data[0], 1, data_size, outfile);
+               }
+               av_free_packet(&avpkt);
+-              //avcodec_free_frame(&decoded_frame);
++              //av_frame_free(&decoded_frame);
+       } while (moreFrames >= 0); // TODO: check for possible leaks
+ 
+       // file will be closed later on, now just flush it
+@@ -294,7 +294,7 @@
+       avformat_close_input(&inAudioFormat);
+       //avcodec_close(c);
+       //av_free(c);
+-      avcodec_free_frame(&decoded_frame);
++      av_frame_free(&decoded_frame);
+       return 0;
+ }
+ #endif
+@@ -340,12 +340,12 @@
+       while (avpkt.size > 0) {
+               int got_frame = 0;
+               if (!decoded_frame) {
+-                      if (!(decoded_frame = avcodec_alloc_frame())) {
++                      if (!(decoded_frame = av_frame_alloc())) {
+                               SysPrintf(" -> Error allocating audio frame 
buffer. Track will not be available.");
+                               return 1; // error decoding frame
+                       }
+               } else {
+-                      avcodec_get_frame_defaults(decoded_frame);
++                      av_frame_unref(decoded_frame);
+               }
+ 
+               len = avcodec_decode_audio4(c, decoded_frame, &got_frame, 
&avpkt);
+@@ -383,7 +383,7 @@
+ 
+       avcodec_close(c);
+       av_free(c);
+-      avcodec_free_frame(&decoded_frame);
++      av_frame_free(&decoded_frame);
+       return 0;
+ }
+ #endif

diff --git a/games-emulation/pcsxr/files/pcsxr-1.9.94-zlib-uncompress2.patch 
b/games-emulation/pcsxr/files/pcsxr-1.9.94-zlib-uncompress2.patch
index b2691855b3a..616084b797c 100644
--- a/games-emulation/pcsxr/files/pcsxr-1.9.94-zlib-uncompress2.patch
+++ b/games-emulation/pcsxr/files/pcsxr-1.9.94-zlib-uncompress2.patch
@@ -10,8 +10,8 @@ Subject: [PATCH] Fix build against zlib-1.2.9+ (having 
uncompress2)
 
 diff --git a/pcsxr/configure.ac b/pcsxr/configure.ac
 index 300bb185..128b4f97 100644
---- a/pcsxr/configure.ac
-+++ b/pcsxr/configure.ac
+--- a/configure.ac
++++ b/configure.ac
 @@ -113,6 +113,9 @@ if test "x$have_xtest" = xno; then
        AC_MSG_ERROR([unable to find xtest headers])
  fi
@@ -24,8 +24,8 @@ index 300bb185..128b4f97 100644
  AC_ARG_ENABLE(libcdio, [  --enable-libcdio        use GNU libcdio for CD-ROM 
support (default=no)],
 diff --git a/pcsxr/libpcsxcore/cdriso.c b/pcsxr/libpcsxcore/cdriso.c
 index 04e866d9..fb7f28a5 100644
---- a/pcsxr/libpcsxcore/cdriso.c
-+++ b/pcsxr/libpcsxcore/cdriso.c
+--- a/libpcsxcore/cdriso.c
++++ b/libpcsxcore/cdriso.c
 @@ -1219,6 +1219,7 @@ static int cdread_sub_mixed(FILE *f, unsigned int base, 
void *dest, int sector)
        return ret;
  }

diff --git a/games-emulation/pcsxr/pcsxr-1.9.94-r2.ebuild 
b/games-emulation/pcsxr/pcsxr-1.9.94-r2.ebuild
new file mode 100644
index 00000000000..319b46f2fd2
--- /dev/null
+++ b/games-emulation/pcsxr/pcsxr-1.9.94-r2.ebuild
@@ -0,0 +1,115 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+inherit autotools ltprune versionator
+
+DESCRIPTION="PCSX-Reloaded: a fork of PCSX, the discontinued Playstation 
emulator"
+HOMEPAGE="http://pcsxr.codeplex.com";
+# codeplex doesn't support direct downloads but GPL-2 doesn't mind me
+# mirroring it.
+SRC_URI="https://dev.gentoo.org/~mgorny/dist/${P}.zip";
+
+LICENSE="GPL-2 public-domain"
+SLOT="0"
+KEYWORDS="~amd64"
+
+IUSE="alsa cdio ffmpeg libav nls openal opengl oss pulseaudio +sdl"
+REQUIRED_USE="?? ( alsa openal oss pulseaudio sdl )"
+
+# pcsxr supports both SDL1 and SDL2 but uses the newer version installed
+# since SDL is not properly slotted in Gentoo, just fix it on SDL2
+
+RDEPEND="
+       dev-libs/glib:2=
+       media-libs/libsdl:0=[joystick]
+       sys-libs/zlib:0=
+       x11-libs/gtk+:3=
+       x11-libs/libX11:0=
+       x11-libs/libXext:0=
+       x11-libs/libXtst:0=
+       x11-libs/libXv:0=
+       alsa? ( media-libs/alsa-lib:0= )
+       cdio? ( dev-libs/libcdio:0= )
+       ffmpeg? (
+               !libav? ( >=media-video/ffmpeg-3:0= )
+               libav? ( media-video/libav:0= ) )
+       nls? ( virtual/libintl:0= )
+       openal? ( media-libs/openal:0= )
+       opengl? ( virtual/opengl:0=
+               x11-libs/libXxf86vm:0= )
+       pulseaudio? ( media-sound/pulseaudio:0= )
+       sdl? ( media-libs/libsdl:0=[sound] )
+"
+DEPEND="${RDEPEND}
+       app-arch/unzip
+       dev-util/intltool
+       x11-proto/videoproto
+       nls? ( sys-devel/gettext:0 )
+       x86? ( dev-lang/nasm )
+"
+
+# it's only the .po file check that fails :)
+RESTRICT=test
+
+PATCHES=(
+       "${FILESDIR}"/${P}-disable-sdl2.patch
+       "${FILESDIR}"/${P}-zlib-uncompress2.patch
+       "${FILESDIR}"/${P}-ffmpeg3.patch
+)
+
+S="${WORKDIR}/${PN}"
+
+src_prepare() {
+       default
+       eautoreconf
+}
+
+src_configure() {
+       local sound_backend
+
+       if use alsa; then
+               sound_backend=alsa
+       elif use oss; then
+               sound_backend=oss
+       elif use pulseaudio; then
+               sound_backend=pulseaudio
+       elif use sdl; then
+               sound_backend=sdl
+       elif use openal; then
+               sound_backend=openal
+       else
+               sound_backend=null
+       fi
+
+       local myconf=(
+               $(use_enable nls)
+               $(use_enable cdio libcdio)
+               $(use_enable opengl)
+               $(use_enable ffmpeg ccdda)
+               --enable-sound=${sound_backend}
+       )
+
+       econf "${myconf[@]}"
+}
+
+src_install() {
+       default
+       prune_libtool_files --all
+
+       dodoc doc/{keys,tweaks}.txt
+}
+
+pkg_postinst() {
+       local vr
+       for vr in ${REPLACING_VERSIONS}; do
+               if ! version_is_at_least 1.9.94-r1 ${vr}; then
+                       ewarn "Starting with pcsxr-1.9.94-r1, the plugin 
install path has changed."
+                       ewarn "In order for pcsxr to find plugins, you will 
need to remove stale"
+                       ewarn "symlinks from ~/.pcsxr/plugins. You can do this 
using the following"
+                       ewarn "command (as your regular user):"
+                       ewarn
+                       ewarn " $ find ~/.pcsxr/plugins/ -type l -delete"
+               fi
+       done
+}

Reply via email to