summaryrefslogtreecommitdiffstats
path: root/k3b/k3b-2.0.2-ffmpeg0.8.patch
blob: b87efde43f3b476b02a82cc7332526943197edaa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
--- plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp.ffmpeg	2011-01-15 21:47:29.000000000 +0100
+++ plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp	2011-06-24 16:53:55.000000000 +0200
@@ -109,7 +109,7 @@
 #else
     ::AVCodecContext* codecContext =  d->formatContext->streams[0]->codec;
 #endif
-    if( codecContext->codec_type != CODEC_TYPE_AUDIO ) {
+    if( codecContext->codec_type != AVMEDIA_TYPE_AUDIO ) {
         kDebug() << "(K3bFFMpegFile) not a simple audio stream: " << m_filename;
         return false;
     }
@@ -224,9 +224,11 @@
 
 QString K3bFFMpegFile::title() const
 {
+    AVMetadataTag *title;
+    title = av_metadata_get(d->formatContext->metadata, "title", NULL, 0);
     // FIXME: is this UTF8 or something??
-    if( d->formatContext->title[0] != '\0' )
-        return QString::fromLocal8Bit( d->formatContext->title );
+    if( title )
+        return QString::fromLocal8Bit( title->value );
     else
         return QString();
 }
@@ -234,9 +236,11 @@
 
 QString K3bFFMpegFile::author() const
 {
+    AVMetadataTag *author;
+    author = av_metadata_get(d->formatContext->metadata, "author", NULL, 0);
     // FIXME: is this UTF8 or something??
-    if( d->formatContext->author[0] != '\0' )
-        return QString::fromLocal8Bit( d->formatContext->author );
+    if( author )
+        return QString::fromLocal8Bit( author->value );
     else
         return QString();
 }
@@ -244,9 +248,11 @@
 
 QString K3bFFMpegFile::comment() const
 {
+    AVMetadataTag *comment;
+    comment = av_metadata_get(d->formatContext->metadata, "comment", NULL, 0);
     // FIXME: is this UTF8 or something??
-    if( d->formatContext->comment[0] != '\0' )
-        return QString::fromLocal8Bit( d->formatContext->comment );
+    if( comment )
+        return QString::fromLocal8Bit( comment->value );
     else
         return QString();
 }
@@ -308,8 +314,14 @@
 
 #if LIBAVCODEC_VERSION_MAJOR < 52
         int len = ::avcodec_decode_audio(
-#else
+#elif LIBAVCODEC_VERSION_MAJOR == 52
         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
 #ifdef FFMPEG_BUILD_PRE_4629
             &d->formatContext->streams[0]->codec,
@@ -318,7 +330,11 @@
 #endif
             (short*)d->alignedOutputBuffer,
             &d->outputBufferSize,
+#if LIBAVCODEC_VERSION_MAJOR < 53
             d->packetData, d->packetSize );
+#else
+	    &avpkt);
+#endif
 
         if( d->packetSize <= 0 || len < 0 )
             ::av_free_packet( &d->packet );