[PATCH] k3b-extras-freeworld: port to FFmpeg-0.8 API
Dominik 'Rathann' Mierzejewski
dominik at greysector.net
Sun Sep 4 00:01:46 CEST 2011
Attached.
--
Fedora http://fedoraproject.org/wiki/User:Rathann
RPMFusion http://rpmfusion.org | MPlayer http://mplayerhq.hu
"Faith manages."
-- Delenn to Lennier in Babylon 5:"Confessions and Lamentations"
-------------- next part --------------
diff -up k3b-2.0.2/plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp.ffmpeg k3b-2.0.2/plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp
--- k3b-2.0.2/plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp.ffmpeg 2011-01-15 21:47:29.000000000 +0100
+++ k3b-2.0.2/plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp 2011-09-03 16:15:35.000000000 +0200
@@ -109,7 +109,11 @@ bool K3bFFMpegFile::open()
#else
::AVCodecContext* codecContext = d->formatContext->streams[0]->codec;
#endif
+#if LIBAVCODEC_VERSION_MAJOR < 53
if( codecContext->codec_type != CODEC_TYPE_AUDIO ) {
+#else
+ if( codecContext->codec_type != AVMEDIA_TYPE_AUDIO ) {
+#endif
kDebug() << "(K3bFFMpegFile) not a simple audio stream: " << m_filename;
return false;
}
@@ -225,8 +229,14 @@ QString K3bFFMpegFile::typeComment() con
QString K3bFFMpegFile::title() const
{
// FIXME: is this UTF8 or something??
+#if FF_API_OLD_METADATA
if( d->formatContext->title[0] != '\0' )
return QString::fromLocal8Bit( d->formatContext->title );
+#else
+ AVDictionaryEntry *entry=av_metadata_get(d->formatContext->metadata,"title",NULL,0);
+ if( entry->value != NULL )
+ return QString::fromLocal8Bit( entry->value );
+#endif
else
return QString();
}
@@ -235,8 +245,14 @@ QString K3bFFMpegFile::title() const
QString K3bFFMpegFile::author() const
{
// FIXME: is this UTF8 or something??
+#if FF_API_OLD_METADATA
if( d->formatContext->author[0] != '\0' )
return QString::fromLocal8Bit( d->formatContext->author );
+#else
+ AVDictionaryEntry *entry=av_metadata_get(d->formatContext->metadata,"author",NULL,0);
+ if( entry->value != NULL )
+ return QString::fromLocal8Bit( entry->value );
+#endif
else
return QString();
}
@@ -245,8 +261,14 @@ QString K3bFFMpegFile::author() const
QString K3bFFMpegFile::comment() const
{
// FIXME: is this UTF8 or something??
+#if FF_API_OLD_METADATA
if( d->formatContext->comment[0] != '\0' )
return QString::fromLocal8Bit( d->formatContext->comment );
+#else
+ AVDictionaryEntry *entry=av_metadata_get(d->formatContext->metadata,"comment",NULL,0);
+ if( entry->value != NULL )
+ return QString::fromLocal8Bit( entry->value );
+#endif
else
return QString();
}
@@ -306,10 +328,19 @@ 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 FF_API_AUDIO_OLD
int len = ::avcodec_decode_audio2(
+#else
+ AVPacket avpkt;
+ av_init_packet(&avpkt);
+ avpkt.data = d->packetData;
+ avpkt.size = d->packetSize;
+ int len = ::avcodec_decode_audio3(
+#endif
#endif
#ifdef FFMPEG_BUILD_PRE_4629
&d->formatContext->streams[0]->codec,
@@ -318,7 +349,11 @@ int K3bFFMpegFile::fillOutputBuffer()
#endif
(short*)d->alignedOutputBuffer,
&d->outputBufferSize,
+#if FF_API_AUDIO_OLD
d->packetData, d->packetSize );
+#else
+ &avpkt );
+#endif
if( d->packetSize <= 0 || len < 0 )
::av_free_packet( &d->packet );
More information about the rpmfusion-developers
mailing list