| @@ -1,43 +1,61 @@ | | | @@ -1,43 +1,61 @@ |
1 | $NetBSD: patch-plugins_decoder_ffmpeg_k3bffmpegwrapper.cpp,v 1.1 2012/10/23 08:24:34 markd Exp $ | | 1 | $NetBSD: patch-plugins_decoder_ffmpeg_k3bffmpegwrapper.cpp,v 1.2 2012/11/11 18:32:24 markd Exp $ |
2 | | | 2 | |
3 | commit 61ca30beb978f68e72257408777c6433f33129bd | | 3 | commit 61ca30beb978f68e72257408777c6433f33129bd |
4 | Author: Michal Malek <michalm@jabster.pl> | | 4 | Author: Michal Malek <michalm@jabster.pl> |
5 | Date: Sun Aug 28 20:18:53 2011 +0200 | | 5 | Date: Sun Aug 28 20:18:53 2011 +0200 |
6 | | | 6 | |
7 | Fixed compilation with new FFMPEG | | 7 | Fixed compilation with new FFMPEG |
8 | | | 8 | |
9 | BUG: 274817 | | 9 | BUG: 274817 |
10 | FIXED-IN: 2.0.3 | | 10 | FIXED-IN: 2.0.3 |
11 | | | 11 | |
12 | diff --git a/plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp b/plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp | | 12 | diff --git a/plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp b/plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp |
13 | index 0ad59fc..0c5f366 100644 | | 13 | index 0ad59fc..0c5f366 100644 |
14 | --- plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp | | 14 | --- plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp |
15 | +++ plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp | | 15 | +++ plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp |
| | | 16 | @@ -88,7 +88,7 @@ |
| | | 17 | close(); |
| | | 18 | |
| | | 19 | // open the file |
| | | 20 | - int err = ::av_open_input_file( &d->formatContext, m_filename.toLocal8Bit(), 0, 0, 0 ); |
| | | 21 | + int err = ::avformat_open_input( &d->formatContext, m_filename.toLocal8Bit(), 0, NULL); |
| | | 22 | if( err < 0 ) { |
| | | 23 | kDebug() << "(K3bFFMpegFile) unable to open " << m_filename << " with error " << err; |
| | | 24 | return false; |
16 | @@ -109,7 +109,13 @@ bool K3bFFMpegFile::open() | | 25 | @@ -109,7 +109,13 @@ bool K3bFFMpegFile::open() |
17 | #else | | 26 | #else |
18 | ::AVCodecContext* codecContext = d->formatContext->streams[0]->codec; | | 27 | ::AVCodecContext* codecContext = d->formatContext->streams[0]->codec; |
19 | #endif | | 28 | #endif |
20 | - if( codecContext->codec_type != CODEC_TYPE_AUDIO ) { | | 29 | - if( codecContext->codec_type != CODEC_TYPE_AUDIO ) { |
21 | + if( codecContext->codec_type != | | 30 | + if( codecContext->codec_type != |
22 | +#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(52, 64, 0) | | 31 | +#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(52, 64, 0) |
23 | + AVMEDIA_TYPE_AUDIO) | | 32 | + AVMEDIA_TYPE_AUDIO) |
24 | +#else | | 33 | +#else |
25 | + CODEC_TYPE_AUDIO) | | 34 | + CODEC_TYPE_AUDIO) |
26 | +#endif | | 35 | +#endif |
27 | + { | | 36 | + { |
28 | kDebug() << "(K3bFFMpegFile) not a simple audio stream: " << m_filename; | | 37 | kDebug() << "(K3bFFMpegFile) not a simple audio stream: " << m_filename; |
29 | return false; | | 38 | return false; |
30 | } | | 39 | } |
| | | 40 | @@ -137,7 +143,7 @@ |
| | | 41 | } |
| | | 42 | |
| | | 43 | // dump some debugging info |
| | | 44 | - ::dump_format( d->formatContext, 0, m_filename.toLocal8Bit(), 0 ); |
| | | 45 | + ::av_dump_format( d->formatContext, 0, m_filename.toLocal8Bit(), 0 ); |
| | | 46 | |
| | | 47 | return true; |
| | | 48 | } |
31 | @@ -225,8 +231,11 @@ QString K3bFFMpegFile::typeComment() const | | 49 | @@ -225,8 +231,11 @@ QString K3bFFMpegFile::typeComment() const |
32 | QString K3bFFMpegFile::title() const | | 50 | QString K3bFFMpegFile::title() const |
33 | { | | 51 | { |
34 | // FIXME: is this UTF8 or something?? | | 52 | // FIXME: is this UTF8 or something?? |
35 | - if( d->formatContext->title[0] != '\0' ) | | 53 | - if( d->formatContext->title[0] != '\0' ) |
36 | - return QString::fromLocal8Bit( d->formatContext->title ); | | 54 | - return QString::fromLocal8Bit( d->formatContext->title ); |
37 | + AVDictionaryEntry *ade = av_dict_get( d->formatContext->metadata, "TITLE", NULL, 0 ); | | 55 | + AVDictionaryEntry *ade = av_dict_get( d->formatContext->metadata, "TITLE", NULL, 0 ); |
38 | + if( ade == NULL ) | | 56 | + if( ade == NULL ) |
39 | + return QString(); | | 57 | + return QString(); |
40 | + if( ade->value != '\0' ) | | 58 | + if( ade->value != '\0' ) |
41 | + return QString::fromLocal8Bit( ade->value ); | | 59 | + return QString::fromLocal8Bit( ade->value ); |
42 | else | | 60 | else |
43 | return QString(); | | 61 | return QString(); |