Gentoo Archives: gentoo-commits

From: "Johannes Huber (johu)" <johu@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in app-cdr/k3b/files: k3b-2.0.3-libav-11.patch
Date: Sat, 30 May 2015 13:40:51
Message-Id: 20150530134046.A3CF2A10@oystercatcher.gentoo.org
1 johu 15/05/30 13:40:46
2
3 Added: k3b-2.0.3-libav-11.patch
4 Log:
5 Revision bump adds patch to fix build with libav-11, bug #509332. Thanks to Oldrich Jedlicka <oldium.pro@××××××.cz>.
6
7 (Portage version: 2.2.20/cvs/Linux x86_64, signed Manifest commit with key 0xF3CFD2BD)
8
9 Revision Changes Path
10 1.1 app-cdr/k3b/files/k3b-2.0.3-libav-11.patch
11
12 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-cdr/k3b/files/k3b-2.0.3-libav-11.patch?rev=1.1&view=markup
13 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-cdr/k3b/files/k3b-2.0.3-libav-11.patch?rev=1.1&content-type=text/plain
14
15 Index: k3b-2.0.3-libav-11.patch
16 ===================================================================
17 From 52d3d64863d2fab4128f524870851f18f5cae1fc Mon Sep 17 00:00:00 2001
18 From: =?UTF-8?q?Old=C5=99ich=20Jedli=C4=8Dka?= <oldium.pro@××××××.cz>
19 Date: Sat, 14 Feb 2015 15:31:07 +0100
20 Subject: [PATCH] Fixed compilation with newer ffmpeg/libav.
21 MIME-Version: 1.0
22 Content-Type: text/plain; charset=UTF-8
23 Content-Transfer-Encoding: 8bit
24
25 Signed-off-by: Oldřich Jedlička <oldium.pro@××××××.cz>
26 ---
27 plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp | 60 ++++++++++++++++++++++++-----
28 1 file changed, 50 insertions(+), 10 deletions(-)
29
30 diff --git a/plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp b/plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp
31 index 5451fd3..2f80fd6 100644
32 --- a/plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp
33 +++ b/plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp
34 @@ -86,8 +86,12 @@ public:
35 K3b::Msf length;
36
37 // for decoding. ffmpeg requires 16-byte alignment.
38 +#ifdef HAVE_FFMPEG_AVCODEC_DECODE_AUDIO4
39 + ::AVFrame* frame;
40 +#else
41 char outputBuffer[AVCODEC_MAX_AUDIO_FRAME_SIZE + 15];
42 char* alignedOutputBuffer;
43 +#endif
44 char* outputBufferPos;
45 int outputBufferSize;
46 ::AVPacket packet;
47 @@ -102,14 +106,29 @@ K3bFFMpegFile::K3bFFMpegFile( const QString& filename )
48 d = new Private;
49 d->formatContext = 0;
50 d->codec = 0;
51 +#ifdef HAVE_FFMPEG_AVCODEC_DECODE_AUDIO4
52 +# if LIBAVCODEC_BUILD < AV_VERSION_INT(55,28,1)
53 + d->frame = avcodec_alloc_frame();
54 +# else
55 + d->frame = av_frame_alloc();
56 +# endif
57 +#else
58 int offset = 0x10 - (reinterpret_cast<intptr_t>(&d->outputBuffer) & 0xf);
59 d->alignedOutputBuffer = &d->outputBuffer[offset];
60 +#endif
61 }
62
63
64 K3bFFMpegFile::~K3bFFMpegFile()
65 {
66 close();
67 +#ifdef HAVE_FFMPEG_AVCODEC_DECODE_AUDIO4
68 +# if LIBAVCODEC_BUILD < AV_VERSION_INT(55,28,1)
69 + av_free(d->frame);
70 +# else
71 + av_frame_free(&d->frame);
72 +# endif
73 +#endif
74 delete d;
75 }
76
77 @@ -326,26 +345,36 @@ int K3bFFMpegFile::fillOutputBuffer()
78 return 0;
79 }
80
81 +#ifdef HAVE_FFMPEG_AVCODEC_DECODE_AUDIO4
82 + int gotFrame = 0;
83 + int len = ::avcodec_decode_audio4(
84 +#else
85 d->outputBufferPos = d->alignedOutputBuffer;
86 d->outputBufferSize = AVCODEC_MAX_AUDIO_FRAME_SIZE;
87 -
88 -#ifdef HAVE_FFMPEG_AVCODEC_DECODE_AUDIO3
89 +# ifdef HAVE_FFMPEG_AVCODEC_DECODE_AUDIO3
90 int len = ::avcodec_decode_audio3(
91 -#else
92 -# ifdef HAVE_FFMPEG_AVCODEC_DECODE_AUDIO2
93 - int len = ::avcodec_decode_audio2(
94 # else
95 +# ifdef HAVE_FFMPEG_AVCODEC_DECODE_AUDIO2
96 + int len = ::avcodec_decode_audio2(
97 +# else
98 int len = ::avcodec_decode_audio(
99 +# endif
100 # endif
101 #endif
102
103 FFMPEG_CODEC(d->formatContext->streams[0]),
104 +#ifdef HAVE_FFMPEG_AVCODEC_DECODE_AUDIO4
105 + d->frame,
106 + &gotFrame,
107 + &d->packet );
108 +#else
109 (short*)d->alignedOutputBuffer,
110 &d->outputBufferSize,
111 -#ifdef HAVE_FFMPEG_AVCODEC_DECODE_AUDIO3
112 +# ifdef HAVE_FFMPEG_AVCODEC_DECODE_AUDIO3
113 &d->packet );
114 -#else
115 +# else
116 d->packetData, d->packetSize );
117 +# endif
118 #endif
119
120 if( d->packetSize <= 0 || len < 0 )
121 @@ -355,6 +384,17 @@ int K3bFFMpegFile::fillOutputBuffer()
122 return -1;
123 }
124
125 +#ifdef HAVE_FFMPEG_AVCODEC_DECODE_AUDIO4
126 + if ( gotFrame ) {
127 + d->outputBufferSize = ::av_samples_get_buffer_size(
128 + NULL,
129 + FFMPEG_CODEC(d->formatContext->streams[0])->channels,
130 + d->frame->nb_samples,
131 + FFMPEG_CODEC(d->formatContext->streams[0])->sample_fmt,
132 + 1 );
133 + d->outputBufferPos = reinterpret_cast<char*>( d->frame->data[0] );
134 + }
135 +#endif
136 d->packetSize -= len;
137 d->packetData += len;
138 }
139 @@ -420,9 +460,9 @@ K3bFFMpegFile* K3bFFMpegWrapper::open( const QString& filename ) const
140 // mp3 being one of them sadly. Most importantly: allow the libsndfile decoder to do
141 // its thing.
142 //
143 - if( file->type() == CODEC_ID_WMAV1 ||
144 - file->type() == CODEC_ID_WMAV2 ||
145 - file->type() == CODEC_ID_AAC )
146 + if( file->type() == AV_CODEC_ID_WMAV1 ||
147 + file->type() == AV_CODEC_ID_WMAV2 ||
148 + file->type() == AV_CODEC_ID_AAC )
149 #endif
150 return file;
151 }
152 --
153 2.0.5