media-sound/spek: backport upstream patches to build with ffmpeg3; bug #575060
authorAlexis Ballier <aballier@gentoo.org>
Mon, 5 Dec 2016 11:01:55 +0000 (12:01 +0100)
committerAlexis Ballier <aballier@gentoo.org>
Mon, 5 Dec 2016 11:02:06 +0000 (12:02 +0100)
Package-Manager: portage-2.3.2

media-sound/spek/files/spek-0.8.3-ffmpeg3-1.patch [new file with mode: 0644]
media-sound/spek/files/spek-0.8.3-ffmpeg3.patch [new file with mode: 0644]
media-sound/spek/spek-0.8.3-r1.ebuild

diff --git a/media-sound/spek/files/spek-0.8.3-ffmpeg3-1.patch b/media-sound/spek/files/spek-0.8.3-ffmpeg3-1.patch
new file mode 100644 (file)
index 0000000..dee0e3c
--- /dev/null
@@ -0,0 +1,33 @@
+https://github.com/alexkay/spek/commit/ee8bc49ed4a93a14a933ecb0eebfe424111f8413
+
+Index: spek-0.8.3/src/spek-audio.cc
+===================================================================
+--- spek-0.8.3.orig/src/spek-audio.cc
++++ spek-0.8.3/src/spek-audio.cc
+@@ -202,7 +202,7 @@ AudioFileImpl::AudioFileImpl(
+     this->packet.data = nullptr;
+     this->packet.size = 0;
+     this->offset = 0;
+-    this->frame = avcodec_alloc_frame();
++    this->frame = av_frame_alloc();
+     this->buffer_size = 0;
+     this->buffer = nullptr;
+     this->frames_per_interval = 0;
+@@ -218,7 +218,7 @@ AudioFileImpl::~AudioFileImpl()
+     if (this->frame) {
+         // TODO: Remove this check after Debian switches to libav 9.
+ #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(54, 28, 0)
+-        avcodec_free_frame(&this->frame);
++        av_frame_free(&this->frame);
+ #else
+         av_freep(&this->frame);
+ #endif
+@@ -258,7 +258,7 @@ int AudioFileImpl::read()
+     for (;;) {
+         while (this->packet.size > 0) {
+-            avcodec_get_frame_defaults(this->frame);
++          av_frame_unref(this->frame);
+             auto codec_context = this->format_context->streams[this->audio_stream]->codec;
+             int got_frame = 0;
+             int len = avcodec_decode_audio4(codec_context, this->frame, &got_frame, &this->packet);
diff --git a/media-sound/spek/files/spek-0.8.3-ffmpeg3.patch b/media-sound/spek/files/spek-0.8.3-ffmpeg3.patch
new file mode 100644 (file)
index 0000000..ad82a38
--- /dev/null
@@ -0,0 +1,37 @@
+commit 1ef950dcbf89dd8adf816009b54009f487828a45
+Author: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
+Date:   Sun Mar 27 14:19:42 2016 -0700
+
+    Replace deprecated FFmpeg API
+
+diff --git a/src/spek-audio.cc b/src/spek-audio.cc
+index b7633bc..21ea7a4 100644
+--- a/src/spek-audio.cc
++++ b/src/spek-audio.cc
+@@ -222,7 +222,7 @@ AudioFileImpl::~AudioFileImpl()
+         this->packet.data -= this->offset;
+         this->packet.size += this->offset;
+         this->offset = 0;
+-        av_free_packet(&this->packet);
++        av_packet_unref(&this->packet);
+     }
+     if (this->format_context) {
+         if (this->audio_stream >= 0) {
+@@ -326,7 +326,7 @@ int AudioFileImpl::read()
+             this->packet.data -= this->offset;
+             this->packet.size += this->offset;
+             this->offset = 0;
+-            av_free_packet(&this->packet);
++            av_packet_unref(&this->packet);
+         }
+         int res = 0;
+@@ -334,7 +334,7 @@ int AudioFileImpl::read()
+             if (this->packet.stream_index == this->audio_stream) {
+                 break;
+             }
+-            av_free_packet(&this->packet);
++            av_packet_unref(&this->packet);
+         }
+         if (res < 0) {
+             // End of file or error.
index 8a9099526c7fb7e4468ab51241a81ef4e53ecef3..4becb5f06c863699199315588d012d3af34aa93b 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 1999-2014 Gentoo Foundation
+# Copyright 1999-2016 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 # $Id$
 
@@ -41,6 +41,8 @@ src_prepare() {
        epatch \
                "${FILESDIR}"/${PN}-0.8.1-disable-updates.patch \
                "${FILESDIR}"/${P}-replace-gnu+11-with-c++11.patch \
-               "${FILESDIR}"/${P}-stdlib.patch
+               "${FILESDIR}"/${P}-stdlib.patch \
+               "${FILESDIR}"/${P}-ffmpeg3.patch \
+               "${FILESDIR}"/${P}-ffmpeg3-1.patch
        eautoreconf
 }