summaryrefslogtreecommitdiff
path: root/multimedia/libxine/files/patch-libav-0.7
blob: d4358bec2c40417e4f1c61bc5b1800c6831897f0 (plain) (blame)
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
From: Reinhard Tartler <siretart@tauware.de>
Subject: unbreak compilation with Libav 0.7

Index: src/combined/ffmpeg/ff_video_decoder.c
===================================================================
--- xine-lib.orig/src/combined/ffmpeg/ff_video_decoder.c	2011-05-27 19:46:33.550935020 +0200
+++ xine-lib/src/combined/ffmpeg/ff_video_decoder.c	2011-05-27 19:58:40.030934613 +0200
@@ -58,12 +58,28 @@
 
 #define ENABLE_DIRECT_RENDERING
 
+#if LIBAVCODEC_VERSION_MAJOR >= 53 || (LIBAVCODEC_VERSION_MAJOR == 52 && LIBAVCODEC_VERSION_MINOR >= 32)
+#  define AVVIDEO 2
+#else
+#  define AVVIDEO 1
+#  define pp_context	pp_context_t
+#  define pp_mode	pp_mode_t
+#endif
+
 /* reordered_opaque appeared in libavcodec 51.68.0 */
 #define AVCODEC_HAS_REORDERED_OPAQUE
 #if LIBAVCODEC_VERSION_INT < 0x334400
 # undef AVCODEC_HAS_REORDERED_OPAQUE
 #endif
 
+#if LIBAVCODEC_VERSION_MAJOR >= 53 || (LIBAVCODEC_VERSION_MAJOR == 52 && LIBAVCODEC_VERSION_MINOR >= 32)
+#  define AVVIDEO 2
+#else
+#  define AVVIDEO 1
+#  define pp_context	pp_context_t
+#  define pp_mode	pp_mode_t
+#endif
+
 typedef struct ff_video_decoder_s ff_video_decoder_t;
 
 typedef struct ff_video_class_s {
@@ -116,8 +132,8 @@
 
   int               pp_quality;
   int               pp_flags;
-  pp_context_t     *pp_context;
-  pp_mode_t        *pp_mode;
+  pp_context       *pp_context;
+  pp_mode          *pp_mode;
 
   /* mpeg-es parsing */
   mpeg_parser_t    *mpeg_parser;
@@ -1055,12 +1071,26 @@
     }
 
     /* skip decoding b frames if too late */
+#if AVVIDEO > 1
+    this->context->skip_frame = (this->skipframes > 0) ? AVDISCARD_NONREF : AVDISCARD_DEFAULT;
+#else
     this->context->hurry_up = (this->skipframes > 0);
+#endif
 
     lprintf("avcodec_decode_video: size=%d\n", this->mpeg_parser->buffer_size);
+#if AVVIDEO > 1
+    AVPacket avpkt;
+    av_init_packet(&avpkt);
+    avpkt.data = (uint8_t *)this->mpeg_parser->chunk_buffer;
+    avpkt.size = this->mpeg_parser->buffer_size;
+    avpkt.flags = AV_PKT_FLAG_KEY;
+    len = avcodec_decode_video2 (this->context, this->av_frame,
+				 &got_picture, &avpkt);
+#else
     len = avcodec_decode_video (this->context, this->av_frame,
                                 &got_picture, this->mpeg_parser->chunk_buffer,
                                 this->mpeg_parser->buffer_size);
+#endif
     lprintf("avcodec_decode_video: decoded_size=%d, got_picture=%d\n",
             len, got_picture);
     len = current - buf->content - offset;
@@ -1112,7 +1142,13 @@
 
     } else {
 
-      if (this->context->hurry_up) {
+      if (
+#if AVVIDEO > 1
+	  this->context->skip_frame != AVDISCARD_DEFAULT
+#else
+	  this->context->hurry_up
+#endif
+	 ) {
         /* skipped frame, output a bad frame */
         img = this->stream->video_out->get_frame (this->stream->video_out,
                                                   this->bih.biWidth,
@@ -1304,13 +1340,25 @@
         got_picture = 0;
       } else {
         /* skip decoding b frames if too late */
+#if AVVIDEO > 1
+	this->context->skip_frame = (this->skipframes > 0) ? AVDISCARD_NONREF : AVDISCARD_DEFAULT;
+#else
         this->context->hurry_up = (this->skipframes > 0);
-
+#endif
         lprintf("buffer size: %d\n", this->size);
+#if AVVIDEO > 1
+	AVPacket avpkt;
+	av_init_packet(&avpkt);
+	avpkt.data = (uint8_t *)&chunk_buf[offset];
+	avpkt.size = this->size;
+	avpkt.flags = AV_PKT_FLAG_KEY;
+	len = avcodec_decode_video2 (this->context, this->av_frame,
+				     &got_picture, &avpkt);
+#else
         len = avcodec_decode_video (this->context, this->av_frame,
                                     &got_picture, &chunk_buf[offset],
                                     this->size);
-
+#endif
 #ifdef AVCODEC_HAS_REORDERED_OPAQUE
         /* reset consumed pts value */
         this->context->reordered_opaque = ff_tag_pts(this, 0);
Index: src/input/input_cdda.c
===================================================================
--- xine-lib.orig/src/input/input_cdda.c	2011-05-27 19:46:33.570934872 +0200
+++ xine-lib/src/input/input_cdda.c	2011-05-27 19:46:38.340934964 +0200
@@ -89,6 +89,14 @@
 #define CD_LEADOUT_TRACK        0xAA
 #define CD_BLOCK_OFFSET         150
 
+#ifdef HAVE_LIBAVUTIL_SHA1_H
+/* old libavutil/sha1.h was found... */
+#define AVSHA AVSHA1
+#  define av_sha_init(c,b) 	av_sha1_init(c)
+#  define av_sha_update		av_sha1_update
+#  define av_sha_final		av_sha1_final
+#endif
+
 typedef struct _cdrom_toc_entry {
   int   track_mode;
   int   first_frame;
Index: src/post/planar/pp.c
===================================================================
--- xine-lib.orig/src/post/planar/pp.c	2011-05-27 19:46:33.540935109 +0200
+++ xine-lib/src/post/planar/pp.c	2011-05-27 19:51:21.830934917 +0200
@@ -35,6 +35,12 @@
 #  include <libpostproc/postprocess.h>
 #endif
 
+#if LIBPOSTPROC_VERSION_MAJOR < 52
+#  define pp_context	pp_context_t
+#  define pp_mode	pp_mode_t
+#  define PP_PARAMETERS_T
+#endif
+
 #define PP_STRING_SIZE 256 /* size of pp mode string (including all options) */
 
 /* plugin class initialization function */
@@ -76,8 +82,8 @@
 
   /* libpostproc specific stuff */
   int                pp_flags;
-  pp_context_t      *pp_context;
-  pp_mode_t         *pp_mode;
+  pp_context        *pp_context;
+  pp_mode           *pp_mode;
 
   pthread_mutex_t    lock;
 };
Index: src/combined/ffmpeg/ff_audio_decoder.c
===================================================================
--- xine-lib.orig/src/combined/ffmpeg/ff_audio_decoder.c	2011-05-27 19:53:22.700933869 +0200
+++ xine-lib/src/combined/ffmpeg/ff_audio_decoder.c	2011-05-27 19:55:40.820939483 +0200
@@ -46,6 +46,13 @@
 
 #define AUDIOBUFSIZE (64 * 1024)
 
+#if LIBAVCODEC_VERSION_MAJOR >= 53 || (LIBAVCODEC_VERSION_MAJOR == 52 && LIBAVCODEC_VERSION_MINOR >= 32)
+#  define AVAUDIO 3
+#else
+#  define AVAUDIO 2
+#endif
+
+
 typedef struct {
   audio_decoder_class_t   decoder_class;
 } ff_audio_class_t;
@@ -255,6 +262,9 @@
       buf->decoder_info[2]);
 
   } else if (!(buf->decoder_flags & BUF_FLAG_SPECIAL)) {
+#if AVAUDIO > 2
+    AVPacket avpkt;
+#endif
 
     if( !this->decoder_ok ) {
       if ( ! this->context || ! this->codec ) {
@@ -286,11 +296,21 @@
     if (!this->output_open) {
       if (!this->audio_bits || !this->audio_sample_rate || !this->audio_channels) {
         decode_buffer_size = AVCODEC_MAX_AUDIO_FRAME_SIZE;
+#if AVAUDIO > 2
+	av_init_packet (&avpkt);
+	avpkt.data = (uint8_t *)&this->buf[0];
+	avpkt.size = this->size;
+	avpkt.flags = AV_PKT_FLAG_KEY;
+	avcodec_decode_audio3 (this->context,
+			       (int16_t *)this->decode_buffer,
+			       &decode_buffer_size, &avpkt);
+#else
         avcodec_decode_audio2 (this->context,
                               (int16_t *)this->decode_buffer,
                               &decode_buffer_size,
                               &this->buf[0],
                               this->size);
+#endif
 	this->audio_bits = this->context->bits_per_sample;
 	this->audio_sample_rate = this->context->sample_rate;
 	this->audio_channels = this->context->channels;
@@ -311,12 +331,21 @@
       offset = 0;
       while (this->size>0) {
         decode_buffer_size = AVCODEC_MAX_AUDIO_FRAME_SIZE;
+#if AVAUDIO > 2
+	av_init_packet (&avpkt);
+	avpkt.data = (uint8_t *)&this->buf[offset];
+	avpkt.size = this->size;
+	avpkt.flags = AV_PKT_FLAG_KEY;
+	bytes_consumed = avcodec_decode_audio3 (this->context,
+						(int16_t *)this->decode_buffer,
+						&decode_buffer_size, &avpkt);
+#else
         bytes_consumed = avcodec_decode_audio2 (this->context,
                                                (int16_t *)this->decode_buffer,
                                                &decode_buffer_size,
                                                &this->buf[offset],
                                                this->size);
-
+#endif
         if (bytes_consumed<0) {
           xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG,
                    "ffmpeg_audio_dec: error decompressing audio frame\n");