Author: rdieter
Update of /cvs/free/rpms/k3b-extras-freeworld/devel
In directory old02.ovh.rpmfusion.lan:/tmp/cvs-serv9099
Modified Files:
k3b-extras-freeworld.spec
Added Files:
0330-CMake-checks-for-FFmpeg-API-changes.patch
0331-Introduce-a-macro-for-referencing-the-ffmpeg-codec.patch
k3b-ffmpeg-review-113295-1.patch
Log Message:
* Fri Nov 01 2013 Rex Dieter <rdieter(a)fedoraproject.org> 1:2.0.2-14
- re-enable ffmpeg support (kde-bug#325486,kde-review#113295)
0330-CMake-checks-for-FFmpeg-API-changes.patch:
CMakeLists.txt | 47 +++++++++++++++++++++
config-k3b.h.cmake | 11 +++++
plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp | 61 +++++++++++++++-------------
3 files changed, 91 insertions(+), 28 deletions(-)
--- NEW FILE 0330-CMake-checks-for-FFmpeg-API-changes.patch ---
diff -up k3b-2.0.2/CMakeLists.txt.0330 k3b-2.0.2/CMakeLists.txt
--- k3b-2.0.2/CMakeLists.txt.0330 2011-01-15 14:52:01.000000000 -0600
+++ k3b-2.0.2/CMakeLists.txt 2013-11-01 08:15:37.219798696 -0500
@@ -100,6 +100,53 @@ if(K3B_BUILD_FFMPEG_DECODER_PLUGIN)
"Needed for the K3b FFmpeg decoder plugin which can decode virtually all audio
types."
"http://ffmpeg.org/"
FALSE "" "")
+ if(FFMPEG_FOUND)
+ include(CMakePushCheckState)
+ cmake_push_check_state()
+
+ if(CMAKE_COMPILER_IS_GNUCC)
+ # FindKDE4Internal.cmake screws things up
+ set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} -std=c99)
+ endif(CMAKE_COMPILER_IS_GNUCC)
+
+ if(FFMPEG_INCLUDE_DIR_OLD_STYLE)
+ set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES}
${FFMPEG_INCLUDE_DIR_OLD_STYLE})
+ set(FFMPEG_HEADERS ffmpeg/avcodec.h ffmpeg/avformat.h)
+ else(FFMPEG_INCLUDE_DIR_OLD_STYLE)
+ set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${FFMPEG_INCLUDE_DIR}
${FFMPEG_INCLUDE_DIRS})
+ set(FFMPEG_HEADERS libavcodec/avcodec.h libavformat/avformat.h)
+ set(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
-DNEWFFMPEGAVCODECPATH)
+ endif(FFMPEG_INCLUDE_DIR_OLD_STYLE)
+ set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${FFMPEG_LIBRARIES})
+
+ check_symbol_exists(avformat_open_input "${FFMPEG_HEADERS}"
HAVE_FFMPEG_AVFORMAT_OPEN_INPUT)
+ check_symbol_exists(av_dump_format "${FFMPEG_HEADERS}"
HAVE_FFMPEG_AV_DUMP_FORMAT)
+ check_symbol_exists(avformat_find_stream_info "${FFMPEG_HEADERS}"
HAVE_FFMPEG_AVFORMAT_FIND_STREAM_INFO)
+ check_symbol_exists(avformat_close_input "${FFMPEG_HEADERS}"
HAVE_FFMPEG_AVFORMAT_CLOSE_INPUT)
+ check_symbol_exists(avcodec_open2 "${FFMPEG_HEADERS}"
HAVE_FFMPEG_AVCODEC_OPEN2)
+ check_symbol_exists(avcodec_decode_audio2 "${FFMPEG_HEADERS}"
HAVE_FFMPEG_AVCODEC_DECODE_AUDIO2)
+ check_symbol_exists(avcodec_decode_audio3 "${FFMPEG_HEADERS}"
HAVE_FFMPEG_AVCODEC_DECODE_AUDIO3)
+ check_symbol_exists(avcodec_decode_audio4 "${FFMPEG_HEADERS}"
HAVE_FFMPEG_AVCODEC_DECODE_AUDIO4)
+ include(CheckCSourceCompiles)
+ check_c_source_compiles("
+ #ifdef NEWFFMPEGAVCODECPATH
+ #include <libavcodec/avcodec.h>
+ #else
+ #include <ffmpeg/avcodec.h>
+ #endif
+ int main() { enum AVMediaType t = AVMEDIA_TYPE_UNKNOWN; return 0; }
+ " HAVE_FFMPEG_AVMEDIA_TYPE)
+ check_c_source_compiles("
+ #ifdef NEWFFMPEGAVCODECPATH
+ #include <libavcodec/avcodec.h>
+ #else
+ #include <ffmpeg/avcodec.h>
+ #endif
+ int main() { enum CodecID t = CODEC_ID_MP3; return 0; }
+ " HAVE_FFMPEG_CODEC_MP3)
+
+ cmake_pop_check_state()
+ endif(FFMPEG_FOUND)
endif(K3B_BUILD_FFMPEG_DECODER_PLUGIN)
if(K3B_BUILD_FLAC_DECODER_PLUGIN)
diff -up k3b-2.0.2/config-k3b.h.cmake.0330 k3b-2.0.2/config-k3b.h.cmake
--- k3b-2.0.2/config-k3b.h.cmake.0330 2013-11-01 08:15:37.219798696 -0500
+++ k3b-2.0.2/config-k3b.h.cmake 2013-11-01 08:16:20.375033275 -0500
@@ -22,3 +22,14 @@
#cmakedefine HAVE_BYTESWAP_H 1
#cmakedefine WORDS_BIGENDIAN 1
+
+#cmakedefine HAVE_FFMPEG_AVFORMAT_OPEN_INPUT
+#cmakedefine HAVE_FFMPEG_AV_DUMP_FORMAT
+#cmakedefine HAVE_FFMPEG_AVFORMAT_FIND_STREAM_INFO
+#cmakedefine HAVE_FFMPEG_AVFORMAT_CLOSE_INPUT
+#cmakedefine HAVE_FFMPEG_AVCODEC_OPEN2
+#cmakedefine HAVE_FFMPEG_AVCODEC_DECODE_AUDIO2
+#cmakedefine HAVE_FFMPEG_AVCODEC_DECODE_AUDIO3
+#cmakedefine HAVE_FFMPEG_AVCODEC_DECODE_AUDIO4
+#cmakedefine HAVE_FFMPEG_AVMEDIA_TYPE
+#cmakedefine HAVE_FFMPEG_CODEC_MP3
diff -up k3b-2.0.2/plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp.0330
k3b-2.0.2/plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp
--- k3b-2.0.2/plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp.0330 2013-11-01
08:15:37.215798767 -0500
+++ k3b-2.0.2/plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp 2013-11-01 08:15:37.219798696
-0500
@@ -42,6 +42,28 @@ extern "C" {
#define FFMPEG_BUILD_PRE_4629
#endif
+#ifndef HAVE_FFMPEG_AVFORMAT_OPEN_INPUT
+// this works because the parameters/options are not used
+# define avformat_open_input(c,s,f,o) av_open_input_file(c,s,f,0,o)
+#endif
+#ifndef HAVE_FFMPEG_AV_DUMP_FORMAT
+# define av_dump_format(c,x,f,y) dump_format(c,x,f,y)
+#endif
+#ifndef HAVE_FFMPEG_AVFORMAT_FIND_STREAM_INFO
+# define avformat_find_stream_info(c,o) av_find_stream_info(c)
+#endif
+#ifndef HAVE_FFMPEG_AVFORMAT_CLOSE_INPUT
+# define avformat_close_input(c) av_close_input_file(*c)
+#endif
+#ifndef HAVE_FFMPEG_AVCODEC_OPEN2
+# define avcodec_open2(a,c,o) avcodec_open(a,c)
+#endif
+#ifndef HAVE_FFMPEG_AVMEDIA_TYPE
+# define AVMEDIA_TYPE_AUDIO CODEC_TYPE_AUDIO
+#endif
+#ifndef HAVE_FFMPEG_CODEC_MP3
+# define CODEC_ID_MP3 CODEC_ID_MP3LAME
+#endif
K3bFFMpegWrapper* K3bFFMpegWrapper::s_instance = 0;
@@ -88,18 +110,14 @@ bool K3bFFMpegFile::open()
close();
// open the file
-#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(53,2,0)
int err = ::avformat_open_input( &d->formatContext, m_filename.toLocal8Bit(),
0, 0 );
-#else
- int err = ::av_open_input_file( &d->formatContext, m_filename.toLocal8Bit(),
0, 0, 0 );
-#endif
if( err < 0 ) {
kDebug() << "(K3bFFMpegFile) unable to open " << m_filename
<< " with error " << err;
return false;
}
// analyze the streams
- ::av_find_stream_info( d->formatContext );
+ ::avformat_find_stream_info( d->formatContext, 0 );
// we only handle files containing one audio stream
if( d->formatContext->nb_streams != 1 ) {
@@ -113,12 +131,7 @@ bool K3bFFMpegFile::open()
#else
::AVCodecContext* codecContext = d->formatContext->streams[0]->codec;
#endif
- if( codecContext->codec_type !=
-#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(52, 64, 0)
- AVMEDIA_TYPE_AUDIO)
-#else
- CODEC_TYPE_AUDIO)
-#endif
+ if( codecContext->codec_type != AVMEDIA_TYPE_AUDIO)
{
kDebug() << "(K3bFFMpegFile) not a simple audio stream: "
<< m_filename;
return false;
@@ -133,7 +146,7 @@ bool K3bFFMpegFile::open()
// open the codec on our context
kDebug() << "(K3bFFMpegFile) found codec for " << m_filename;
- if( ::avcodec_open( codecContext, d->codec ) < 0 ) {
+ if( ::avcodec_open2( codecContext, d->codec, 0 ) < 0 ) {
kDebug() << "(K3bFFMpegDecoderFactory) could not open codec.";
return false;
}
@@ -147,11 +160,7 @@ bool K3bFFMpegFile::open()
}
// dump some debugging info
-#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(53,2,0)
::av_dump_format( d->formatContext, 0, m_filename.toLocal8Bit(), 0 );
-#else
- ::dump_format( d->formatContext, 0, m_filename.toLocal8Bit(), 0 );
-#endif
return true;
}
@@ -173,7 +182,7 @@ void K3bFFMpegFile::close()
}
if( d->formatContext ) {
- ::av_close_input_file( d->formatContext );
+ ::avformat_close_input( &d->formatContext );
d->formatContext = 0;
}
}
@@ -222,11 +231,7 @@ QString K3bFFMpegFile::typeComment() con
return i18n("Windows Media v1");
case CODEC_ID_WMAV2:
return i18n("Windows Media v2");
-#if LIBAVCODEC_VERSION_MAJOR < 52
- case CODEC_ID_MP3LAME:
-#else
case CODEC_ID_MP3:
-#endif
return i18n("MPEG 1 Layer III");
case CODEC_ID_AAC:
return i18n("Advanced Audio Coding (AAC)");
@@ -329,14 +334,14 @@ int K3bFFMpegFile::fillOutputBuffer()
d->outputBufferPos = d->alignedOutputBuffer;
d->outputBufferSize = AVCODEC_MAX_AUDIO_FRAME_SIZE;
-#if LIBAVCODEC_VERSION_MAJOR < 52
- int len = ::avcodec_decode_audio(
-#else
- #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(52, 64, 0)
+#ifdef HAVE_FFMPEG_AVCODEC_DECODE_AUDIO3
int len = ::avcodec_decode_audio3(
- #else
+#else
+# ifdef HAVE_FFMPEG_AVCODEC_DECODE_AUDIO2
int len = ::avcodec_decode_audio2(
- #endif
+# else
+ int len = ::avcodec_decode_audio(
+# endif
#endif
#ifdef FFMPEG_BUILD_PRE_4629
@@ -346,7 +351,7 @@ int K3bFFMpegFile::fillOutputBuffer()
#endif
(short*)d->alignedOutputBuffer,
&d->outputBufferSize,
-#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(52, 64, 0)
+#ifdef HAVE_FFMPEG_AVCODEC_DECODE_AUDIO3
&d->packet );
#else
d->packetData, d->packetSize );
0331-Introduce-a-macro-for-referencing-the-ffmpeg-codec.patch:
k3bffmpegwrapper.cpp | 41 +++++++++--------------------------------
1 file changed, 9 insertions(+), 32 deletions(-)
--- NEW FILE 0331-Introduce-a-macro-for-referencing-the-ffmpeg-codec.patch ---
From d27648fc8946735913176dff0c497c806f63dc8a Mon Sep 17 00:00:00 2001
From: Alex Merry <kde(a)randomguy3.me.uk>
Date: Fri, 24 Aug 2012 03:07:15 +0100
Subject: [PATCH 331/351] Introduce a macro for referencing the ffmpeg codec
This simplifies the code somewhat.
REVIEW: 106153
---
plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp | 40 +++++++----------------------
1 file changed, 9 insertions(+), 31 deletions(-)
diff --git a/plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp
b/plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp
index 0a8fabc..a5ef087 100644
--- a/plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp
+++ b/plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp
@@ -39,7 +39,9 @@ extern "C" {
#if LIBAVFORMAT_BUILD < 4629
-#define FFMPEG_BUILD_PRE_4629
+#define FFMPEG_CODEC(s) (&s->codec)
+#else
+#define FFMPEG_CODEC(s) (s->codec)
#endif
#ifndef HAVE_FFMPEG_AVFORMAT_OPEN_INPUT
@@ -126,11 +128,7 @@ bool K3bFFMpegFile::open()
}
// urgh... ugly
-#ifdef FFMPEG_BUILD_PRE_4629
- ::AVCodecContext* codecContext = &d->formatContext->streams[0]->codec;
-#else
- ::AVCodecContext* codecContext = d->formatContext->streams[0]->codec;
-#endif
+ ::AVCodecContext* codecContext = FFMPEG_CODEC(d->formatContext->streams[0]);
if( codecContext->codec_type != AVMEDIA_TYPE_AUDIO)
{
kDebug() << "(K3bFFMpegFile) not a simple audio stream: "
<< m_filename;
@@ -173,11 +171,7 @@ void K3bFFMpegFile::close()
d->packetData = 0;
if( d->codec ) {
-#ifdef FFMPEG_BUILD_PRE_4629
- ::avcodec_close( &d->formatContext->streams[0]->codec );
-#else
- ::avcodec_close( d->formatContext->streams[0]->codec );
-#endif
+ ::avcodec_close( FFMPEG_CODEC(d->formatContext->streams[0]) );
d->codec = 0;
}
@@ -196,31 +190,19 @@ K3b::Msf K3bFFMpegFile::length() const
int K3bFFMpegFile::sampleRate() const
{
-#ifdef FFMPEG_BUILD_PRE_4629
- return d->formatContext->streams[0]->codec.sample_rate;
-#else
- return d->formatContext->streams[0]->codec->sample_rate;
-#endif
+ return FFMPEG_CODEC(d->formatContext->streams[0])->sample_rate;
}
int K3bFFMpegFile::channels() const
{
-#ifdef FFMPEG_BUILD_PRE_4629
- return d->formatContext->streams[0]->codec.channels;
-#else
- return d->formatContext->streams[0]->codec->channels;
-#endif
+ return FFMPEG_CODEC(d->formatContext->streams[0])->channels;
}
int K3bFFMpegFile::type() const
{
-#ifdef FFMPEG_BUILD_PRE_4629
- return d->formatContext->streams[0]->codec.codec_id;
-#else
- return d->formatContext->streams[0]->codec->codec_id;
-#endif
+ return FFMPEG_CODEC(d->formatContext->streams[0])->codec_id;
}
@@ -344,11 +326,7 @@ int K3bFFMpegFile::fillOutputBuffer()
# endif
#endif
-#ifdef FFMPEG_BUILD_PRE_4629
- &d->formatContext->streams[0]->codec,
-#else
- d->formatContext->streams[0]->codec,
-#endif
+ FFMPEG_CODEC(d->formatContext->streams[0]),
(short*)d->alignedOutputBuffer,
&d->outputBufferSize,
#ifdef HAVE_FFMPEG_AVCODEC_DECODE_AUDIO3
--
1.8.4.2
k3b-ffmpeg-review-113295-1.patch:
CMakeLists.txt | 9 ++++++++-
plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp | 18 ++++++++++++++++++
plugins/decoder/ffmpeg/k3bffmpegwrapper.h | 1 +
3 files changed, 27 insertions(+), 1 deletion(-)
--- NEW FILE k3b-ffmpeg-review-113295-1.patch ---
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ca1531d8e601e423002f6ffa490f2d5bb8dbf5d8..eaf116d14a7de5b330db3823e93477653319177c
100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -142,12 +142,19 @@ if(K3B_BUILD_FFMPEG_DECODER_PLUGIN)
int main() { enum AVMediaType t = AVMEDIA_TYPE_UNKNOWN; return 0; }
" HAVE_FFMPEG_AVMEDIA_TYPE)
check_c_source_compiles("
+ #define CALC_FFMPEG_VERSION(a,b,c) ( a<<16 | b<<8 | c )
#ifdef NEWFFMPEGAVCODECPATH
#include <libavcodec/avcodec.h>
#else
#include <ffmpeg/avcodec.h>
#endif
- int main() { enum CodecID t = CODEC_ID_MP3; return 0; }
+ int main() {
+ #if LIBAVCODEC_BUILD >= CALC_FFMPEG_VERSION(54,25,0)
+ # Not needed here. AV_CODEC_ID_MP3 exists. return 0;
+ #else
+ enum CodecID t = CODEC_ID_MP3; return 0;
+ #endif
+ }
" HAVE_FFMPEG_CODEC_MP3)
cmake_pop_check_state()
diff --git a/plugins/decoder/ffmpeg/k3bffmpegwrapper.h
b/plugins/decoder/ffmpeg/k3bffmpegwrapper.h
index 1ec36b6e465a08f7fe42c80b926e98683be75a5e..88c44f3ec484be4ce0aaa719e219e4a61ec4ac25
100644
--- a/plugins/decoder/ffmpeg/k3bffmpegwrapper.h
+++ b/plugins/decoder/ffmpeg/k3bffmpegwrapper.h
@@ -18,6 +18,7 @@
#include "k3bmsf.h"
+#define CALC_FFMPEG_VERSION(a,b,c) ( a<<16 | b<<8 | c )
/**
diff --git a/plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp
b/plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp
index a5ef087a5ac3a2dc8b7d385b9c3a2e16bf6622bb..5e97cbd7e8b0790f355e6d8b29b8dc55ea099617
100644
--- a/plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp
+++ b/plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp
@@ -67,6 +67,13 @@ extern "C" {
# define CODEC_ID_MP3 CODEC_ID_MP3LAME
#endif
+// Has been deprecated for ages. Now removed. For now do what ffmpeg does
+//
http://ffmpeg.org/pipermail/ffmpeg-cvslog/2012-August/053785.html
+// 192000 = 1 second of 48khz 32bit audio
+#ifndef AVCODEC_MAX_AUDIO_FRAME_SIZE
+#define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000
+#endif
+
K3bFFMpegWrapper* K3bFFMpegWrapper::s_instance = 0;
@@ -209,6 +216,16 @@ int K3bFFMpegFile::type() const
QString K3bFFMpegFile::typeComment() const
{
switch( type() ) {
+#if LIBAVCODEC_BUILD >= CALC_FFMPEG_VERSION(54,25,0)
+ case AV_CODEC_ID_WMAV1:
+ return i18n("Windows Media v1");
+ case AV_CODEC_ID_WMAV2:
+ return i18n("Windows Media v2");
+ case AV_CODEC_ID_MP3:
+ return i18n("MPEG 1 Layer III");
+ case AV_CODEC_ID_AAC:
+ return i18n("Advanced Audio Coding (AAC)");
+#else
case CODEC_ID_WMAV1:
return i18n("Windows Media v1");
case CODEC_ID_WMAV2:
@@ -217,6 +234,7 @@ QString K3bFFMpegFile::typeComment() const
return i18n("MPEG 1 Layer III");
case CODEC_ID_AAC:
return i18n("Advanced Audio Coding (AAC)");
+#endif
default:
return QString::fromLocal8Bit( d->codec->name );
}
Index: k3b-extras-freeworld.spec
===================================================================
RCS file: /cvs/free/rpms/k3b-extras-freeworld/devel/k3b-extras-freeworld.spec,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -r1.40 -r1.41
--- k3b-extras-freeworld.spec 4 Oct 2013 16:30:20 -0000 1.40
+++ k3b-extras-freeworld.spec 1 Nov 2013 13:29:12 -0000 1.41
@@ -1,9 +1,6 @@
# undefine these to disable
-# upstream bug (with patch) fix for ffmpeg-2.x,
http://bugs.kde.org/325486
-%if 0%{?fedora} < 20
%define ffmpeg_decoder 1
-%endif
%define lame_encoder 1
%define mad_decoder 1
@@ -11,7 +8,7 @@
Summary: Additional codec plugins for the k3b CD/DVD burning application
Epoch: 1
Version: 2.0.2
-Release: 13%{?dist}
+Release: 14%{?dist}
License: GPLv2+
URL:
http://www.k3b.org/
@@ -24,6 +21,13 @@
Patch244: 0244-Fixed-compilation-with-new-FFMPEG.patch
Patch290: 0290-fix-for-newer-kde-4.7-FindFFMPEG.cmake.patch
Patch312: 0312-Fix-K3B-to-build-with-recent-FFMPEG-versions.patch
+# rebased 0330 to apply to 2.0 branch
+Patch330: 0330-CMake-checks-for-FFmpeg-API-changes.patch
+Patch331: 0331-Introduce-a-macro-for-referencing-the-ffmpeg-codec.patch
+
+#
https://git.reviewboard.kde.org/r/113295/
+# see also
http://bugs.kde.org/325486
+Patch500: k3b-ffmpeg-review-113295-1.patch
BuildRequires: desktop-file-utils
BuildRequires: gettext
@@ -68,6 +72,10 @@
%patch244 -p1 -b .0244
%patch290 -p1 -b .0290
%patch312 -p1 -b .0313
+%patch330 -p1 -b .0330
+%patch331 -p1 -b .0331
+
+%patch500 -p1 -b .ffmpeg-review-113295-1
%build
@@ -109,6 +117,9 @@
%changelog
+* Fri Nov 01 2013 Rex Dieter <rdieter(a)fedoraproject.org> 1:2.0.2-14
+- re-enable ffmpeg support (kde-bug#325486,kde-review#113295)
+
* Tue Oct 01 2013 Rex Dieter <rdieter(a)fedoraproject.org> 1:2.0.2-13
- cleanup/rebuild