From: Jan Rękorajski Date: Wed, 30 Mar 2016 23:57:41 +0000 (+0900) Subject: - added patch from gentoo to fix building with ffmpeg3 and enabled bcond X-Git-Tag: auto/th/k3b-2.0.3-2 X-Git-Url: http://git.pld-linux.org/gitweb.cgi?p=packages%2Fk3b.git;a=commitdiff_plain;h=7c5d0ad2ba601a04c42730ac3a2293c75f9cf960 - added patch from gentoo to fix building with ffmpeg3 and enabled bcond --- diff --git a/ffmpeg3.patch b/ffmpeg3.patch new file mode 100644 index 0000000..9c5ac42 --- /dev/null +++ b/ffmpeg3.patch @@ -0,0 +1,138 @@ +From 52d3d64863d2fab4128f524870851f18f5cae1fc Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Old=C5=99ich=20Jedli=C4=8Dka?= +Date: Sat, 14 Feb 2015 15:31:07 +0100 +Subject: [PATCH] Fixed compilation with newer ffmpeg/libav. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Oldřich Jedlička +--- + plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp | 60 ++++++++++++++++++++++++----- + 1 file changed, 50 insertions(+), 10 deletions(-) + +diff --git a/plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp b/plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp +index 5451fd3..2f80fd6 100644 +--- a/plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp ++++ b/plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp +@@ -86,8 +86,12 @@ public: + K3b::Msf length; + + // for decoding. ffmpeg requires 16-byte alignment. ++#ifdef HAVE_FFMPEG_AVCODEC_DECODE_AUDIO4 ++ ::AVFrame* frame; ++#else + char outputBuffer[AVCODEC_MAX_AUDIO_FRAME_SIZE + 15]; + char* alignedOutputBuffer; ++#endif + char* outputBufferPos; + int outputBufferSize; + ::AVPacket packet; +@@ -102,14 +106,29 @@ K3bFFMpegFile::K3bFFMpegFile( const QString& filename ) + d = new Private; + d->formatContext = 0; + d->codec = 0; ++#ifdef HAVE_FFMPEG_AVCODEC_DECODE_AUDIO4 ++# if LIBAVCODEC_BUILD < AV_VERSION_INT(55,28,1) ++ d->frame = avcodec_alloc_frame(); ++# else ++ d->frame = av_frame_alloc(); ++# endif ++#else + int offset = 0x10 - (reinterpret_cast(&d->outputBuffer) & 0xf); + d->alignedOutputBuffer = &d->outputBuffer[offset]; ++#endif + } + + + K3bFFMpegFile::~K3bFFMpegFile() + { + close(); ++#ifdef HAVE_FFMPEG_AVCODEC_DECODE_AUDIO4 ++# if LIBAVCODEC_BUILD < AV_VERSION_INT(55,28,1) ++ av_free(d->frame); ++# else ++ av_frame_free(&d->frame); ++# endif ++#endif + delete d; + } + +@@ -326,26 +345,36 @@ int K3bFFMpegFile::fillOutputBuffer() + return 0; + } + ++#ifdef HAVE_FFMPEG_AVCODEC_DECODE_AUDIO4 ++ int gotFrame = 0; ++ int len = ::avcodec_decode_audio4( ++#else + d->outputBufferPos = d->alignedOutputBuffer; + d->outputBufferSize = AVCODEC_MAX_AUDIO_FRAME_SIZE; +- +-#ifdef HAVE_FFMPEG_AVCODEC_DECODE_AUDIO3 ++# ifdef HAVE_FFMPEG_AVCODEC_DECODE_AUDIO3 + int len = ::avcodec_decode_audio3( +-#else +-# ifdef HAVE_FFMPEG_AVCODEC_DECODE_AUDIO2 +- int len = ::avcodec_decode_audio2( + # else ++# ifdef HAVE_FFMPEG_AVCODEC_DECODE_AUDIO2 ++ int len = ::avcodec_decode_audio2( ++# else + int len = ::avcodec_decode_audio( ++# endif + # endif + #endif + + FFMPEG_CODEC(d->formatContext->streams[0]), ++#ifdef HAVE_FFMPEG_AVCODEC_DECODE_AUDIO4 ++ d->frame, ++ &gotFrame, ++ &d->packet ); ++#else + (short*)d->alignedOutputBuffer, + &d->outputBufferSize, +-#ifdef HAVE_FFMPEG_AVCODEC_DECODE_AUDIO3 ++# ifdef HAVE_FFMPEG_AVCODEC_DECODE_AUDIO3 + &d->packet ); +-#else ++# else + d->packetData, d->packetSize ); ++# endif + #endif + + if( d->packetSize <= 0 || len < 0 ) +@@ -355,6 +384,17 @@ int K3bFFMpegFile::fillOutputBuffer() + return -1; + } + ++#ifdef HAVE_FFMPEG_AVCODEC_DECODE_AUDIO4 ++ if ( gotFrame ) { ++ d->outputBufferSize = ::av_samples_get_buffer_size( ++ NULL, ++ FFMPEG_CODEC(d->formatContext->streams[0])->channels, ++ d->frame->nb_samples, ++ FFMPEG_CODEC(d->formatContext->streams[0])->sample_fmt, ++ 1 ); ++ d->outputBufferPos = reinterpret_cast( d->frame->data[0] ); ++ } ++#endif + d->packetSize -= len; + d->packetData += len; + } +@@ -420,9 +460,9 @@ K3bFFMpegFile* K3bFFMpegWrapper::open( const QString& filename ) const + // mp3 being one of them sadly. Most importantly: allow the libsndfile decoder to do + // its thing. + // +- if( file->type() == CODEC_ID_WMAV1 || +- file->type() == CODEC_ID_WMAV2 || +- file->type() == CODEC_ID_AAC ) ++ if( file->type() == AV_CODEC_ID_WMAV1 || ++ file->type() == AV_CODEC_ID_WMAV2 || ++ file->type() == AV_CODEC_ID_AAC ) + #endif + return file; + } +-- +2.0.5 + diff --git a/k3b.spec b/k3b.spec index 7a0d7e9..5da6247 100644 --- a/k3b.spec +++ b/k3b.spec @@ -6,7 +6,7 @@ # c) kde4-konqueror-4.4.2-1.i686 # d) kde4-konqueror-4.4.1-1.i686 -%bcond_with ffmpeg +%bcond_without ffmpeg %define qtver 4.6.3 %define kdever 4.4.5 @@ -23,6 +23,7 @@ Group: X11/Libraries Source0: http://download.kde.org/stable/k3b/%{name}-%{version}a.tar.xz # Source0-md5: 52e78aabe8e483347d04e88be0aed150 Patch0: cmake-duplicate-doc.patch +Patch1: ffmpeg3.patch URL: http://k3b.plainblack.com/ BuildRequires: Qt3Support-devel >= %{qtver} BuildRequires: QtNetwork-devel >= %{qtver} @@ -142,7 +143,8 @@ Pliki nagłówkowe biblioteki libk3bcore. %prep %setup -q -%patch0 -p1 +%patch0 -p1 +%patch1 -p1 %build install -d build