]> git.pld-linux.org Git - packages/xbmc.git/blob - xbmc-ffmpeg10.patch
b31f508840b677a0e8cb928751d798cb77184c9e
[packages/xbmc.git] / xbmc-ffmpeg10.patch
1 diff -urN xbmc-11.0/lib/DllAvCodec.h xbmc-11.0-ffmpeg-1.0/lib/DllAvCodec.h
2 --- xbmc-11.0/lib/DllAvCodec.h  2012-03-21 23:07:50.000000000 +0100
3 +++ xbmc-11.0-ffmpeg-1.0/lib/DllAvCodec.h       2012-11-08 23:16:18.536405054 +0100
4 @@ -24,7 +24,7 @@
5    #include "config.h"
6  #endif
7  #include "DynamicDll.h"
8 -#include "DllAvCore.h"
9 +#include "DllAvUtil.h"
10  #include "utils/log.h"
11  
12  extern "C" {
13 @@ -60,7 +60,6 @@
14    #endif
15  
16    /* From non-public audioconvert.h */
17 -  int64_t avcodec_guess_channel_layout(int nb_channels, enum CodecID codec_id, const char *fmt_name);
18    struct AVAudioConvert;
19    typedef struct AVAudioConvert AVAudioConvert;
20    AVAudioConvert *av_audio_convert_alloc(enum AVSampleFormat out_fmt, int out_channels,
21 @@ -76,28 +75,6 @@
22  #endif
23  }
24  
25 -/* Some convenience macros introduced at this particular revision of libavcodec.
26 - */
27 -#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(52,25,0)
28 -#define CH_LAYOUT_5POINT0_BACK      (CH_LAYOUT_SURROUND|CH_BACK_LEFT|CH_BACK_RIGHT)
29 -#define CH_LAYOUT_5POINT1_BACK      (CH_LAYOUT_5POINT0_BACK|CH_LOW_FREQUENCY)
30 -#undef CH_LAYOUT_7POINT1_WIDE
31 -#define CH_LAYOUT_7POINT1_WIDE      (CH_LAYOUT_5POINT1_BACK|\
32 -                                           CH_FRONT_LEFT_OF_CENTER|CH_FRONT_RIGHT_OF_CENTER)
33 -#endif
34 -
35 -#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(52,64,0)
36 -// API added on: 2010-03-31
37 -#define AVMediaType            CodecType
38 -#define AVMEDIA_TYPE_UNKNOWN    CODEC_TYPE_UNKNOWN
39 -#define AVMEDIA_TYPE_VIDEO      CODEC_TYPE_VIDEO
40 -#define AVMEDIA_TYPE_AUDIO      CODEC_TYPE_AUDIO
41 -#define AVMEDIA_TYPE_DATA       CODEC_TYPE_DATA
42 -#define AVMEDIA_TYPE_SUBTITLE   CODEC_TYPE_SUBTITLE
43 -#define AVMEDIA_TYPE_ATTACHMENT CODEC_TYPE_ATTACHMENT
44 -#define AVMEDIA_TYPE_NB         CODEC_TYPE_NB
45 -#endif
46 -
47  #include "threads/SingleLock.h"
48  
49  class DllAvCodecInterface
50 @@ -106,20 +83,20 @@
51    virtual ~DllAvCodecInterface() {}
52    virtual void avcodec_register_all(void)=0;
53    virtual void avcodec_flush_buffers(AVCodecContext *avctx)=0;
54 -  virtual int avcodec_open_dont_call(AVCodecContext *avctx, AVCodec *codec)=0;
55 +  virtual int avcodec_open2_dont_call(AVCodecContext *avctx, AVCodec *codec, AVDictionary **options)=0;
56    virtual AVCodec *avcodec_find_decoder(enum CodecID id)=0;
57    virtual AVCodec *avcodec_find_encoder(enum CodecID id)=0;
58    virtual int avcodec_close_dont_call(AVCodecContext *avctx)=0;
59    virtual AVFrame *avcodec_alloc_frame(void)=0;
60    virtual int avpicture_fill(AVPicture *picture, uint8_t *ptr, PixelFormat pix_fmt, int width, int height)=0;
61    virtual int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture, int *got_picture_ptr, AVPacket *avpkt)=0;
62 -  virtual int avcodec_decode_audio3(AVCodecContext *avctx, int16_t *samples, int *frame_size_ptr, AVPacket *avpkt)=0;
63 +  virtual int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt)=0;
64    virtual int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, int *got_sub_ptr, AVPacket *avpkt)=0;
65    virtual int avcodec_encode_audio(AVCodecContext *avctx, uint8_t *buf, int buf_size, const short *samples)=0;
66    virtual int avpicture_get_size(PixelFormat pix_fmt, int width, int height)=0;
67 -  virtual AVCodecContext *avcodec_alloc_context(void)=0;
68 +  virtual AVCodecContext *avcodec_alloc_context3(AVCodec *codec)=0;
69    virtual void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)=0;
70 -  virtual void avcodec_get_context_defaults(AVCodecContext *s)=0;
71 +  virtual void avcodec_get_context_defaults3(AVCodecContext *s, AVCodec *codec)=0;
72    virtual AVCodecParserContext *av_parser_init(int codec_id)=0;
73    virtual int av_parser_parse2(AVCodecParserContext *s,AVCodecContext *avctx, uint8_t **poutbuf, int *poutbuf_size,
74                      const uint8_t *buf, int buf_size,
75 @@ -137,7 +114,6 @@
76    virtual enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum PixelFormat *fmt)=0;
77    virtual int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic)=0;
78    virtual void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic)=0;
79 -  virtual int avcodec_thread_init(AVCodecContext *s, int thread_count)=0;
80    virtual AVCodec *av_codec_next(AVCodec *c)=0;
81    virtual AVAudioConvert *av_audio_convert_alloc(enum AVSampleFormat out_fmt, int out_channels,
82                                                   enum AVSampleFormat in_fmt , int in_channels,
83 @@ -148,7 +124,6 @@
84                                 const void * const  in[6], const int  in_stride[6], int len)=0;
85    virtual int av_dup_packet(AVPacket *pkt)=0;
86    virtual void av_init_packet(AVPacket *pkt)=0;
87 -  virtual int64_t avcodec_guess_channel_layout(int nb_channels, enum CodecID codec_id, const char *fmt_name)=0;
88  };
89  
90  #if (defined USE_EXTERNAL_FFMPEG)
91 @@ -166,12 +141,12 @@
92      ::avcodec_register_all();
93    }
94    virtual void avcodec_flush_buffers(AVCodecContext *avctx) { ::avcodec_flush_buffers(avctx); }
95 -  virtual int avcodec_open(AVCodecContext *avctx, AVCodec *codec)
96 +  virtual int avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVDictionary **options)
97    {
98      CSingleLock lock(DllAvCodec::m_critSection);
99 -    return ::avcodec_open(avctx, codec);
100 +    return ::avcodec_open2(avctx, codec, options);
101    }
102 -  virtual int avcodec_open_dont_call(AVCodecContext *avctx, AVCodec *codec) { *(int *)0x0 = 0; return 0; }
103 +  virtual int avcodec_open2_dont_call(AVCodecContext *avctx, AVCodec *codec, AVDictionary **options) { *(int *)0x0 = 0; return 0; }
104    virtual int avcodec_close_dont_call(AVCodecContext *avctx) { *(int *)0x0 = 0; return 0; }
105    virtual AVCodec *avcodec_find_decoder(enum CodecID id) { return ::avcodec_find_decoder(id); }
106    virtual AVCodec *avcodec_find_encoder(enum CodecID id) { return ::avcodec_find_encoder(id); }
107 @@ -182,33 +157,21 @@
108    }
109    virtual AVFrame *avcodec_alloc_frame() { return ::avcodec_alloc_frame(); }
110    virtual int avpicture_fill(AVPicture *picture, uint8_t *ptr, PixelFormat pix_fmt, int width, int height) { return ::avpicture_fill(picture, ptr, pix_fmt, width, height); }
111 -#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(52,23,0)
112 -  // API added on: 2009-04-07
113    virtual int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture, int *got_picture_ptr, AVPacket *avpkt) { return ::avcodec_decode_video2(avctx, picture, got_picture_ptr, avpkt); }
114 -  virtual int avcodec_decode_audio3(AVCodecContext *avctx, int16_t *samples, int *frame_size_ptr, AVPacket *avpkt) { return ::avcodec_decode_audio3(avctx, samples, frame_size_ptr, avpkt); }
115 +  virtual int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt) { return ::avcodec_decode_audio4(avctx, frame, got_frame_ptr, avpkt); }
116    virtual int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, int *got_sub_ptr, AVPacket *avpkt) { return ::avcodec_decode_subtitle2(avctx, sub, got_sub_ptr, avpkt); }
117 -#else
118 -  virtual int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture, int *got_picture_ptr, AVPacket *avpkt) { return ::avcodec_decode_video(avctx, picture, got_picture_ptr, avpkt->data, avpkt->size); }
119 -  virtual int avcodec_decode_audio3(AVCodecContext *avctx, int16_t *samples, int *frame_size_ptr, AVPacket *avpkt) { return ::avcodec_decode_audio2(avctx, samples, frame_size_ptr, avpkt->data, avpkt->size); }
120 -  virtual int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, int *got_sub_ptr, AVPacket *avpkt) { return ::avcodec_decode_subtitle(avctx, sub, got_sub_ptr, avpkt->data, avpkt->size); }
121 -#endif
122    virtual int avcodec_encode_audio(AVCodecContext *avctx, uint8_t *buf, int buf_size, const short *samples) { return ::avcodec_encode_audio(avctx, buf, buf_size, samples); }
123    virtual int avpicture_get_size(PixelFormat pix_fmt, int width, int height) { return ::avpicture_get_size(pix_fmt, width, height); }
124 -  virtual AVCodecContext *avcodec_alloc_context() { return ::avcodec_alloc_context(); }
125 +  virtual AVCodecContext *avcodec_alloc_context3(AVCodec *codec) { return ::avcodec_alloc_context3(codec); }
126    virtual void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode) { ::avcodec_string(buf, buf_size, enc, encode); }
127 -  virtual void avcodec_get_context_defaults(AVCodecContext *s) { ::avcodec_get_context_defaults(s); }
128 +  virtual void avcodec_get_context_defaults3(AVCodecContext *s, AVCodec *codec) { ::avcodec_get_context_defaults3(s, codec); }
129  
130    virtual AVCodecParserContext *av_parser_init(int codec_id) { return ::av_parser_init(codec_id); }
131    virtual int av_parser_parse2(AVCodecParserContext *s,AVCodecContext *avctx, uint8_t **poutbuf, int *poutbuf_size,
132                      const uint8_t *buf, int buf_size,
133                      int64_t pts, int64_t dts, int64_t pos)
134    {
135 -#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(52,21,0)
136 -    // API added on : 2009-03-05
137      return ::av_parser_parse2(s, avctx, poutbuf, poutbuf_size, buf, buf_size, pts, dts, pos);
138 -#else
139 -    return ::av_parser_parse(s, avctx, poutbuf, poutbuf_size, buf, buf_size, pts, dts);
140 -#endif
141    }
142    virtual void av_parser_close(AVCodecParserContext *s) { ::av_parser_close(s); }
143  
144 @@ -225,7 +188,6 @@
145    virtual int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic) { return ::avcodec_default_get_buffer(s, pic); }
146    virtual void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic) { ::avcodec_default_release_buffer(s, pic); }
147    virtual enum PixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum PixelFormat *fmt) { return ::avcodec_default_get_format(s, fmt); }
148 -  virtual int avcodec_thread_init(AVCodecContext *s, int thread_count) { return ::avcodec_thread_init(s, thread_count); }
149    virtual AVCodec *av_codec_next(AVCodec *c) { return ::av_codec_next(c); }
150    virtual AVAudioConvert *av_audio_convert_alloc(enum AVSampleFormat out_fmt, int out_channels,
151                                                   enum AVSampleFormat in_fmt , int in_channels,
152 @@ -241,7 +203,6 @@
153  
154    virtual int av_dup_packet(AVPacket *pkt) { return ::av_dup_packet(pkt); }
155    virtual void av_init_packet(AVPacket *pkt) { return ::av_init_packet(pkt); }
156 -  virtual int64_t avcodec_guess_channel_layout(int nb_channels, enum CodecID codec_id, const char *fmt_name) { return ::avcodec_guess_channel_layout(nb_channels, codec_id, fmt_name); }
157  
158    // DLL faking.
159    virtual bool ResolveExports() { return true; }
160 @@ -256,17 +217,16 @@
161  {
162    DECLARE_DLL_WRAPPER(DllAvCodec, DLL_PATH_LIBAVCODEC)
163    DEFINE_FUNC_ALIGNED1(void, __cdecl, avcodec_flush_buffers, AVCodecContext*)
164 -  DEFINE_FUNC_ALIGNED2(int, __cdecl, avcodec_open_dont_call, AVCodecContext*, AVCodec *)
165 +  DEFINE_FUNC_ALIGNED3(int, __cdecl, avcodec_open2_dont_call, AVCodecContext*, AVCodec *, AVDictionary **)
166    DEFINE_FUNC_ALIGNED4(int, __cdecl, avcodec_decode_video2, AVCodecContext*, AVFrame*, int*, AVPacket*)
167 -  DEFINE_FUNC_ALIGNED4(int, __cdecl, avcodec_decode_audio3, AVCodecContext*, int16_t*, int*, AVPacket*)
168 +  DEFINE_FUNC_ALIGNED4(int, __cdecl, avcodec_decode_audio4, AVCodecContext*, AVFrame*, int*, AVPacket*)
169    DEFINE_FUNC_ALIGNED4(int, __cdecl, avcodec_decode_subtitle2, AVCodecContext*, AVSubtitle*, int*, AVPacket*)
170    DEFINE_FUNC_ALIGNED4(int, __cdecl, avcodec_encode_audio, AVCodecContext*, uint8_t*, int, const short*)
171 -  DEFINE_FUNC_ALIGNED0(AVCodecContext*, __cdecl, avcodec_alloc_context)
172 +  DEFINE_FUNC_ALIGNED1(AVCodecContext*, __cdecl, avcodec_alloc_context3, AVCodec *)
173    DEFINE_FUNC_ALIGNED1(AVCodecParserContext*, __cdecl, av_parser_init, int)
174    DEFINE_FUNC_ALIGNED9(int, __cdecl, av_parser_parse2, AVCodecParserContext*,AVCodecContext*, uint8_t**, int*, const uint8_t*, int, int64_t, int64_t, int64_t)
175    DEFINE_METHOD1(int, av_dup_packet, (AVPacket *p1))
176    DEFINE_METHOD1(void, av_init_packet, (AVPacket *p1))
177 -  DEFINE_METHOD3(int64_t, avcodec_guess_channel_layout, (int p1, enum CodecID p2, const char *p3))
178  
179    LOAD_SYMBOLS();
180  
181 @@ -278,7 +238,7 @@
182    DEFINE_METHOD5(int, avpicture_fill, (AVPicture *p1, uint8_t *p2, PixelFormat p3, int p4, int p5))
183    DEFINE_METHOD3(int, avpicture_get_size, (PixelFormat p1, int p2, int p3))
184    DEFINE_METHOD4(void, avcodec_string, (char *p1, int p2, AVCodecContext *p3, int p4))
185 -  DEFINE_METHOD1(void, avcodec_get_context_defaults, (AVCodecContext *p1))
186 +  DEFINE_METHOD2(void, avcodec_get_context_defaults3, (AVCodecContext *p1, AVCodec *p2))
187    DEFINE_METHOD1(void, av_parser_close, (AVCodecParserContext *p1))
188    DEFINE_METHOD1(void, avpicture_free, (AVPicture *p1))
189    DEFINE_METHOD1(AVBitStreamFilterContext*, av_bitstream_filter_init, (const char *p1))
190 @@ -290,7 +250,6 @@
191    DEFINE_METHOD2(void, avcodec_default_release_buffer, (AVCodecContext *p1, AVFrame *p2))
192    DEFINE_METHOD2(enum PixelFormat, avcodec_default_get_format, (struct AVCodecContext *p1, const enum PixelFormat *p2))
193  
194 -  DEFINE_METHOD2(int, avcodec_thread_init, (AVCodecContext *p1, int p2))
195    DEFINE_METHOD1(AVCodec*, av_codec_next, (AVCodec *p1))
196    DEFINE_METHOD6(AVAudioConvert*, av_audio_convert_alloc, (enum AVSampleFormat p1, int p2,
197                                                             enum AVSampleFormat p3, int p4,
198 @@ -301,7 +260,7 @@
199                                                 const void * const p4[6], const int p5[6], int p6))
200    BEGIN_METHOD_RESOLVE()
201      RESOLVE_METHOD(avcodec_flush_buffers)
202 -    RESOLVE_METHOD_RENAME(avcodec_open,avcodec_open_dont_call)
203 +    RESOLVE_METHOD_RENAME(avcodec_open2,avcodec_open2_dont_call)
204      RESOLVE_METHOD_RENAME(avcodec_close,avcodec_close_dont_call)
205      RESOLVE_METHOD(avcodec_find_decoder)
206      RESOLVE_METHOD(avcodec_find_encoder)
207 @@ -309,13 +268,13 @@
208      RESOLVE_METHOD_RENAME(avcodec_register_all, avcodec_register_all_dont_call)
209      RESOLVE_METHOD(avpicture_fill)
210      RESOLVE_METHOD(avcodec_decode_video2)
211 -    RESOLVE_METHOD(avcodec_decode_audio3)
212 +    RESOLVE_METHOD(avcodec_decode_audio4)
213      RESOLVE_METHOD(avcodec_decode_subtitle2)
214      RESOLVE_METHOD(avcodec_encode_audio)
215      RESOLVE_METHOD(avpicture_get_size)
216 -    RESOLVE_METHOD(avcodec_alloc_context)
217 +    RESOLVE_METHOD(avcodec_alloc_context3)
218      RESOLVE_METHOD(avcodec_string)
219 -    RESOLVE_METHOD(avcodec_get_context_defaults)
220 +    RESOLVE_METHOD(avcodec_get_context_defaults3)
221      RESOLVE_METHOD(av_parser_init)
222      RESOLVE_METHOD(av_parser_parse2)
223      RESOLVE_METHOD(av_parser_close)
224 @@ -328,26 +287,24 @@
225      RESOLVE_METHOD(avcodec_default_get_buffer)
226      RESOLVE_METHOD(avcodec_default_release_buffer)
227      RESOLVE_METHOD(avcodec_default_get_format)
228 -    RESOLVE_METHOD(avcodec_thread_init)
229      RESOLVE_METHOD(av_codec_next)
230      RESOLVE_METHOD(av_audio_convert_alloc)
231      RESOLVE_METHOD(av_audio_convert_free)
232      RESOLVE_METHOD(av_audio_convert)
233      RESOLVE_METHOD(av_dup_packet)
234      RESOLVE_METHOD(av_init_packet)
235 -    RESOLVE_METHOD(avcodec_guess_channel_layout)
236    END_METHOD_RESOLVE()
237  
238    /* dependencies of libavcodec */
239 -  DllAvCore m_dllAvCore;
240 +  DllAvUtil m_dllAvUtil;
241    // DllAvUtil loaded implicitely by m_dllAvCore
242  
243  public:
244      static CCriticalSection m_critSection;
245 -    int avcodec_open(AVCodecContext *avctx, AVCodec *codec)
246 +    int avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVDictionary **options)
247      {
248        CSingleLock lock(DllAvCodec::m_critSection);
249 -      return avcodec_open_dont_call(avctx,codec);
250 +      return avcodec_open2_dont_call(avctx,codec, options);
251      }
252      int avcodec_close(AVCodecContext *avctx)
253      {
254 @@ -361,7 +318,7 @@
255      }
256      virtual bool Load()
257      {
258 -      if (!m_dllAvCore.Load())
259 +      if (!m_dllAvUtil.Load())
260         return false;
261        return DllDynamic::Load();
262      }
263 diff -urN xbmc-11.0/lib/DllAvCore.h xbmc-11.0-ffmpeg-1.0/lib/DllAvCore.h
264 --- xbmc-11.0/lib/DllAvCore.h   2012-03-21 23:07:50.000000000 +0100
265 +++ xbmc-11.0-ffmpeg-1.0/lib/DllAvCore.h        1970-01-01 01:00:00.000000000 +0100
266 @@ -1,182 +0,0 @@
267 -#pragma once
268 -/*
269 - *      Copyright (C) 2005-2010 Team XBMC
270 - *      http://www.xbmc.org
271 - *
272 - *  This Program is free software; you can redistribute it and/or modify
273 - *  it under the terms of the GNU General Public License as published by
274 - *  the Free Software Foundation; either version 2, or (at your option)
275 - *  any later version.
276 - *
277 - *  This Program is distributed in the hope that it will be useful,
278 - *  but WITHOUT ANY WARRANTY; without even the implied warranty of
279 - *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
280 - *  GNU General Public License for more details.
281 - *
282 - *  You should have received a copy of the GNU General Public License
283 - *  along with XBMC; see the file COPYING.  If not, write to the Free
284 - *  Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
285 - *  Boston, MA  02110-1301, USA.
286 - *  http://www.gnu.org/copyleft/gpl.html
287 - *
288 - */
289 -
290 -#if (defined HAVE_CONFIG_H) && (!defined WIN32)
291 -  #include "config.h"
292 -#endif
293 -#include "DynamicDll.h"
294 -#include "DllAvUtil.h"
295 -#include "utils/log.h"
296 -
297 -extern "C" {
298 -#ifdef USE_EXTERNAL_FFMPEG
299 -  #ifdef HAVE_LIBAVUTIL_SAMPLEFMT_H
300 -    // libavcore was merged to libavutil on 2010-02-15
301 -    #include <libavutil/audioconvert.h>
302 -    #include <libavutil/samplefmt.h>
303 -  #endif
304 -
305 -  #ifdef HAVE_LIBAVCORE_AVCORE_H
306 -    #include <libavcore/avcore.h>
307 -  #endif
308 -  #ifdef HAVE_LIBAVCORE_SAMPLEFMT_H
309 -    #include <libavcore/samplefmt.h>
310 -  #endif
311 -
312 -  /* Needed for old FFmpeg versions as used below */
313 -  #ifdef HAVE_LIBAVCODEC_AVCODEC_H
314 -    #include <libavcodec/avcodec.h>
315 -  #else
316 -    #include <ffmpeg/avcodec.h>
317 -  #endif
318 -#else
319 -  #include "libavcore/avcore.h"
320 -  #include "libavcore/samplefmt.h"
321 -#endif
322 -}
323 -
324 -/* Compatibility for old external FFmpeg versions. */
325 -
326 -#ifdef USE_EXTERNAL_FFMPEG
327 -
328 -#ifndef LIBAVCORE_VERSION_INT
329 -// API added on: 2010-07-21, removed on 2010-02-15
330 -#define LIBAVCORE_VERSION_INT 0
331 -#endif
332 -
333 -#ifndef AV_SAMPLE_FMT_NONE
334 -// API added on: 2010-11-02
335 -#define AVSampleFormat     SampleFormat
336 -#define AV_SAMPLE_FMT_NONE SAMPLE_FMT_NONE
337 -#define AV_SAMPLE_FMT_U8   SAMPLE_FMT_U8
338 -#define AV_SAMPLE_FMT_S16  SAMPLE_FMT_S16
339 -#define AV_SAMPLE_FMT_S32  SAMPLE_FMT_S32
340 -#define AV_SAMPLE_FMT_FLT  SAMPLE_FMT_FLT
341 -#define AV_SAMPLE_FMT_DBL  SAMPLE_FMT_DBL
342 -#endif
343 -
344 -#ifndef AV_CH_FRONT_LEFT
345 -// API added on: 2010-11-21
346 -#define AV_CH_FRONT_LEFT            CH_FRONT_LEFT
347 -#define AV_CH_FRONT_RIGHT           CH_FRONT_RIGHT
348 -#define AV_CH_FRONT_CENTER          CH_FRONT_CENTER
349 -#define AV_CH_LOW_FREQUENCY         CH_LOW_FREQUENCY
350 -#define AV_CH_BACK_LEFT             CH_BACK_LEFT
351 -#define AV_CH_BACK_RIGHT            CH_BACK_RIGHT
352 -#define AV_CH_FRONT_LEFT_OF_CENTER  CH_FRONT_LEFT_OF_CENTER
353 -#define AV_CH_FRONT_RIGHT_OF_CENTER CH_FRONT_RIGHT_OF_CENTER
354 -#define AV_CH_BACK_CENTER           CH_BACK_CENTER
355 -#define AV_CH_SIDE_LEFT             CH_SIDE_LEFT
356 -#define AV_CH_SIDE_RIGHT            CH_SIDE_RIGHT
357 -#define AV_CH_TOP_CENTER            CH_TOP_CENTER
358 -#define AV_CH_TOP_FRONT_LEFT        CH_TOP_FRONT_LEFT
359 -#define AV_CH_TOP_FRONT_CENTER      CH_TOP_FRONT_CENTER
360 -#define AV_CH_TOP_FRONT_RIGHT       CH_TOP_FRONT_RIGHT
361 -#define AV_CH_TOP_BACK_LEFT         CH_TOP_BACK_LEFT
362 -#define AV_CH_TOP_BACK_CENTER       CH_TOP_BACK_CENTER
363 -#define AV_CH_TOP_BACK_RIGHT        CH_TOP_BACK_RIGHT
364 -#define AV_CH_STEREO_LEFT           CH_STEREO_LEFT
365 -#define AV_CH_STEREO_RIGHT          CH_STEREO_RIGHT
366 -
367 -#define AV_CH_LAYOUT_NATIVE         CH_LAYOUT_NATIVE
368 -
369 -#define AV_CH_LAYOUT_MONO           CH_LAYOUT_MONO
370 -#define AV_CH_LAYOUT_STEREO         CH_LAYOUT_STEREO
371 -#define AV_CH_LAYOUT_2_1            CH_LAYOUT_2_1
372 -#define AV_CH_LAYOUT_SURROUND       CH_LAYOUT_SURROUND
373 -#define AV_CH_LAYOUT_4POINT0        CH_LAYOUT_4POINT0
374 -#define AV_CH_LAYOUT_2_2            CH_LAYOUT_2_2
375 -#define AV_CH_LAYOUT_QUAD           CH_LAYOUT_QUAD
376 -#define AV_CH_LAYOUT_5POINT0        CH_LAYOUT_5POINT0
377 -#define AV_CH_LAYOUT_5POINT1        CH_LAYOUT_5POINT1
378 -#define AV_CH_LAYOUT_5POINT0_BACK   CH_LAYOUT_5POINT0_BACK
379 -#define AV_CH_LAYOUT_5POINT1_BACK   CH_LAYOUT_5POINT1_BACK
380 -#define AV_CH_LAYOUT_7POINT0        CH_LAYOUT_7POINT0
381 -#define AV_CH_LAYOUT_7POINT1        CH_LAYOUT_7POINT1
382 -#define AV_CH_LAYOUT_7POINT1_WIDE   CH_LAYOUT_7POINT1_WIDE
383 -#define AV_CH_LAYOUT_STEREO_DOWNMIX CH_LAYOUT_STEREO_DOWNMIX
384 -#endif
385 -
386 -#endif // USE_EXTERNAL_FFMPEG
387 -
388 -class DllAvCoreInterface
389 -{
390 -public:
391 -  virtual ~DllAvCoreInterface() {}
392 -  virtual int av_get_bits_per_sample_fmt(enum AVSampleFormat sample_fmt) = 0;
393 -};
394 -
395 -#if (defined USE_EXTERNAL_FFMPEG)
396 -
397 -// Use direct layer
398 -class DllAvCore : public DllDynamic, DllAvCoreInterface
399 -{
400 -public:
401 -  virtual ~DllAvCore() {}
402 -#if LIBAVCORE_VERSION_INT >= AV_VERSION_INT(0,12,0) || LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(50,38,0)
403 -  // API added on: 2010-11-02, moved to libavutil on 2010-02-15
404 -  virtual int av_get_bits_per_sample_fmt(enum AVSampleFormat sample_fmt) { return ::av_get_bits_per_sample_fmt(sample_fmt); }
405 -#else
406 -  // from avcodec.h
407 -  virtual int av_get_bits_per_sample_fmt(enum AVSampleFormat sample_fmt) { return ::av_get_bits_per_sample_format(sample_fmt); }
408 -#endif
409 -
410 -  // DLL faking.
411 -  virtual bool ResolveExports() { return true; }
412 -  virtual bool Load() {
413 -#if LIBAVCORE_VERSION_INT > 0
414 -    CLog::Log(LOGDEBUG, "DllAvCore: Using libavcore system library");
415 -#endif
416 -    return true;
417 -  }
418 -  virtual void Unload() {}
419 -};
420 -
421 -#else
422 -
423 -class DllAvCore : public DllDynamic, DllAvCoreInterface
424 -{
425 -  DECLARE_DLL_WRAPPER(DllAvCore, DLL_PATH_LIBAVCORE)
426 -
427 -  LOAD_SYMBOLS()
428 -
429 -  DEFINE_METHOD1(int, av_get_bits_per_sample_fmt, (enum AVSampleFormat p1))
430 -
431 -  BEGIN_METHOD_RESOLVE()
432 -    RESOLVE_METHOD(av_get_bits_per_sample_fmt)
433 -  END_METHOD_RESOLVE()
434 -
435 -  /* dependency of libavcore */
436 -  DllAvUtil m_dllAvUtil;
437 -
438 -public:
439 -  virtual bool Load()
440 -  {
441 -    if (!m_dllAvUtil.Load())
442 -      return false;
443 -    return DllDynamic::Load();
444 -  }
445 -};
446 -
447 -#endif
448 -
449 diff -urN xbmc-11.0/lib/DllAvFilter.h xbmc-11.0-ffmpeg-1.0/lib/DllAvFilter.h
450 --- xbmc-11.0/lib/DllAvFilter.h 2012-03-21 23:07:50.000000000 +0100
451 +++ xbmc-11.0-ffmpeg-1.0/lib/DllAvFilter.h      2012-11-08 23:16:12.336405273 +0100
452 @@ -24,8 +24,8 @@
453    #include "config.h"
454  #endif
455  #include "DynamicDll.h"
456 -#include "DllAvCore.h"
457  #include "DllAvCodec.h"
458 +#include "DllSwResample.h"
459  #include "utils/log.h"
460  
461  extern "C" {
462 @@ -43,24 +43,17 @@
463  #if (defined USE_EXTERNAL_FFMPEG)
464    #if (defined HAVE_LIBAVFILTER_AVFILTER_H)
465      #include <libavfilter/avfiltergraph.h>
466 +    #include <libavfilter/buffersink.h>
467 +    #include <libavfilter/avcodec.h>
468    #elif (defined HAVE_FFMPEG_AVFILTER_H)
469      #include <ffmpeg/avfiltergraph.h>
470 -  #endif
471 -  /* for av_vsrc_buffer_add_frame */
472 -  #if LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,8,0)
473 -    #include <libavfilter/avcodec.h>
474 -  #elif LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,7,0)
475 -    int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter,
476 -                                 AVFrame *frame);
477 -  #elif LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(53,3,0)
478 -    int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter,
479 -                                 AVFrame *frame, int64_t pts);
480 -  #else
481 -    int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter,
482 -          AVFrame *frame, int64_t pts, AVRational pixel_aspect);
483 +    #include <ffmpeg/buffersink.h>
484 +    #include <ffmpeg/avcodec.h>
485    #endif
486  #else
487    #include "libavfilter/avfiltergraph.h"
488 +  #include "libavfilter/buffersink.h"
489 +  #include "libavfilter/avcodec.h"
490  #endif
491  }
492  
493 @@ -80,20 +73,16 @@
494    virtual void avfilter_inout_free(AVFilterInOut **inout)=0;
495    virtual int avfilter_graph_parse(AVFilterGraph *graph, const char *filters, AVFilterInOut **inputs, AVFilterInOut **outputs, void *log_ctx)=0;
496    virtual int avfilter_graph_config(AVFilterGraph *graphctx, void *log_ctx)=0;
497 -  virtual int avfilter_poll_frame(AVFilterLink *link)=0;
498 -  virtual int avfilter_request_frame(AVFilterLink *link)=0;
499 -#if LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,13,0)
500 +#if LIBAVFILTER_VERSION_INT < AV_VERSION_INT(3,0,0)
501    virtual int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame, int flags)=0;
502 -#elif LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,7,0)
503 -  virtual int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame)=0;
504 -#elif LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(53,3,0)
505 -  virtual int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame, int64_t pts)=0;
506  #else
507 -  virtual int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame, int64_t pts, AVRational pixel_aspect)=0;
508 +  virtual int av_buffersrc_add_frame(AVFilterContext *buffer_filter, AVFrame *frame, int flags)=0;
509  #endif
510 -  virtual AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, int w, int h)=0;
511    virtual void avfilter_unref_buffer(AVFilterBufferRef *ref)=0;
512    virtual int avfilter_link(AVFilterContext *src, unsigned srcpad, AVFilterContext *dst, unsigned dstpad)=0;
513 +  virtual int av_buffersink_get_buffer_ref(AVFilterContext *buffer_sink, AVFilterBufferRef **bufref, int flags)=0;
514 +  virtual AVBufferSinkParams *av_buffersink_params_alloc()=0;
515 +  virtual int av_buffersink_poll_frame(AVFilterContext *ctx)=0;
516  };
517  
518  #if (defined USE_EXTERNAL_FFMPEG)
519 @@ -115,12 +104,7 @@
520    virtual void avfilter_graph_free(AVFilterGraph **graph)
521    {
522      CSingleLock lock(DllAvCodec::m_critSection);
523 -#if LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(1,76,0)
524      ::avfilter_graph_free(graph);
525 -#else
526 -    ::avfilter_graph_free(*graph);
527 -    *graph = NULL;
528 -#endif
529    }
530    void avfilter_register_all()
531    {
532 @@ -133,56 +117,32 @@
533    virtual AVFilterInOut *avfilter_inout_alloc()
534    {
535      CSingleLock lock(DllAvCodec::m_critSection);
536 -#if LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,17,0)
537      return ::avfilter_inout_alloc();
538 -#else
539 -    return (AVFilterInOut*)::av_mallocz(sizeof(AVFilterInOut));
540 -#endif
541    }
542    virtual void avfilter_inout_free(AVFilterInOut **inout)
543    {
544      CSingleLock lock(DllAvCodec::m_critSection);
545 -#if LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,17,0)
546      ::avfilter_inout_free(inout);
547 -#else
548 -    *inout = NULL;
549 -#endif
550    }
551    virtual int avfilter_graph_parse(AVFilterGraph *graph, const char *filters, AVFilterInOut **inputs, AVFilterInOut **outputs, void *log_ctx)
552    {
553      CSingleLock lock(DllAvCodec::m_critSection);
554 -#if   (   LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(1,79,0) \
555 -       && LIBAVFILTER_VERSION_INT <  AV_VERSION_INT(2,0,0) ) \
556 -    ||(   LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,16,0))
557      return ::avfilter_graph_parse(graph, filters, inputs, outputs, log_ctx);
558 -#elif LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,15,1)
559 -    return ::avfilter_graph_parse(graph, filters, *inputs, *outputs, log_ctx);
560 -#else
561 -    return ::avfilter_graph_parse(graph, filters, *inputs, *outputs, (AVClass*)log_ctx);
562 -#endif
563    }
564    virtual int avfilter_graph_config(AVFilterGraph *graphctx, void *log_ctx)
565    {
566 -#if LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,15,1)
567      return ::avfilter_graph_config(graphctx, log_ctx);
568 -#else
569 -    return ::avfilter_graph_config(graphctx, (AVClass*)log_ctx);
570 -#endif
571    }
572 -  virtual int avfilter_poll_frame(AVFilterLink *link) { return ::avfilter_poll_frame(link); }
573 -  virtual int avfilter_request_frame(AVFilterLink *link) { return ::avfilter_request_frame(link); }
574 -#if LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,13,0)
575 +#if LIBAVFILTER_VERSION_INT < AV_VERSION_INT(3,0,0)
576    virtual int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame, int flags) { return ::av_vsrc_buffer_add_frame(buffer_filter, frame, flags); }
577 -#elif LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,7,0)
578 -  virtual int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame) { return ::av_vsrc_buffer_add_frame(buffer_filter, frame); }
579 -#elif LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(53,3,0)
580 -  virtual int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame, int64_t pts) { return ::av_vsrc_buffer_add_frame(buffer_filter, frame, pts); }
581  #else
582 -  virtual int av_vsrc_buffer_add_frame(AVFilterContext *buffer_filter, AVFrame *frame, int64_t pts, AVRational pixel_aspect) { return ::av_vsrc_buffer_add_frame(buffer_filter, frame, pts, pixel_aspect); }
583 +  virtual int av_buffersrc_add_frame(AVFilterContext *buffer_filter, AVFrame* frame, int flags) { return ::av_buffersrc_add_frame(buffer_filter, frame, flags); }
584  #endif
585 -  virtual AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, int w, int h) { return ::avfilter_get_video_buffer(link, perms, w, h); }
586    virtual void avfilter_unref_buffer(AVFilterBufferRef *ref) { ::avfilter_unref_buffer(ref); }
587    virtual int avfilter_link(AVFilterContext *src, unsigned srcpad, AVFilterContext *dst, unsigned dstpad) { return ::avfilter_link(src, srcpad, dst, dstpad); }
588 +  virtual int av_buffersink_get_buffer_ref(AVFilterContext *buffer_sink, AVFilterBufferRef **bufref, int flags) { return ::av_buffersink_get_buffer_ref(buffer_sink, bufref, flags); }
589 +  virtual AVBufferSinkParams *av_buffersink_params_alloc() { return ::av_buffersink_params_alloc(); }
590 +  virtual int av_buffersink_poll_frame(AVFilterContext *ctx) { return av_buffersink_poll_frame(ctx); }
591    // DLL faking.
592    virtual bool ResolveExports() { return true; }
593    virtual bool Load() {
594 @@ -200,45 +160,25 @@
595  
596    DEFINE_METHOD3(int, avfilter_open_dont_call, (AVFilterContext **p1, AVFilter *p2, const char *p3))
597    DEFINE_METHOD1(void, avfilter_free_dont_call, (AVFilterContext *p1))
598 -#if LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(1,76,0)
599    DEFINE_METHOD1(void, avfilter_graph_free_dont_call, (AVFilterGraph **p1))
600 -#else
601 -  DEFINE_METHOD1(void, avfilter_graph_free_dont_call, (AVFilterGraph *p1))
602 -#endif
603    DEFINE_METHOD0(void, avfilter_register_all_dont_call)
604    DEFINE_METHOD6(int, avfilter_graph_create_filter, (AVFilterContext **p1, AVFilter *p2, const char *p3, const char *p4, void *p5, AVFilterGraph *p6))
605    DEFINE_METHOD1(AVFilter*, avfilter_get_by_name, (const char *p1))
606    DEFINE_METHOD0(AVFilterGraph*, avfilter_graph_alloc)
607 -#if LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,17,0)
608    DEFINE_METHOD0(AVFilterInOut*, avfilter_inout_alloc_dont_call)
609    DEFINE_METHOD1(void, avfilter_inout_free_dont_call, (AVFilterInOut **p1))
610 -#endif
611 -#if LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,16,0)
612 -  DEFINE_METHOD5(int, avfilter_graph_parse_dont_call, (AVFilterGraph *p1, const char *p2, AVFilterInOut **p3, AVFilterInOut **p4, void *p5))
613 -#elif LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,15,1)
614 -  DEFINE_METHOD5(int, avfilter_graph_parse_dont_call, (AVFilterGraph *p1, const char *p2, AVFilterInOut *p3, AVFilterInOut *p4, void *p5))
615 -#else
616 -  DEFINE_METHOD5(int, avfilter_graph_parse_dont_call, (AVFilterGraph *p1, const char *p2, AVFilterInOut *p3, AVFilterInOut *p4, AVClass *p5))
617 -#endif
618 -#if LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,15,1)
619 -  DEFINE_METHOD2(int, avfilter_graph_config_dont_call, (AVFilterGraph *p1, void *p2))
620 -#else
621 -  DEFINE_METHOD2(int, avfilter_graph_config_dont_call, (AVFilterGraph *p1, AVClass *p2))
622 -#endif
623 -  DEFINE_FUNC_ALIGNED1(int, __cdecl, avfilter_poll_frame, AVFilterLink *)
624 -  DEFINE_FUNC_ALIGNED1(int, __cdecl, avfilter_request_frame, AVFilterLink*)
625 -#if LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,13,0)
626 +  DEFINE_FUNC_ALIGNED5(int, __cdecl, avfilter_graph_parse_dont_call, AVFilterGraph *, const char *, AVFilterInOut **, AVFilterInOut **, void *)
627 +  DEFINE_FUNC_ALIGNED2(int, __cdecl, avfilter_graph_config_dont_call, AVFilterGraph *, void *)
628 +#if LIBAVFILTER_VERSION_INT < AV_VERSION_INT(3,0,0)
629    DEFINE_METHOD3(int, av_vsrc_buffer_add_frame, (AVFilterContext *p1, AVFrame *p2, int p3))
630 -#elif LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,7,0)
631 -  DEFINE_METHOD2(int, av_vsrc_buffer_add_frame, (AVFilterContext *p1, AVFrame *p2))
632 -#elif LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(53,3,0)
633 -  DEFINE_METHOD3(int, av_vsrc_buffer_add_frame, (AVFilterContext *p1, AVFrame *p2, int64_t p3))
634  #else
635 -  DEFINE_METHOD4(int, av_vsrc_buffer_add_frame, (AVFilterContext *p1, AVFrame *p2, int64_t p3, AVRational p4))
636 +  DEFINE_METHOD3(int, av_buffersrc_add_frame, (AVFilterContext *p1, AVFrame *p2, int p3))
637  #endif
638 -  DEFINE_METHOD4(AVFilterBufferRef*, avfilter_get_video_buffer, (AVFilterLink *p1, int p2, int p3, int p4))
639    DEFINE_METHOD1(void, avfilter_unref_buffer, (AVFilterBufferRef *p1))
640    DEFINE_METHOD4(int, avfilter_link, (AVFilterContext *p1, unsigned p2, AVFilterContext *p3, unsigned p4))
641 +  DEFINE_FUNC_ALIGNED3(int                , __cdecl, av_buffersink_get_buffer_ref, AVFilterContext *, AVFilterBufferRef **, int);
642 +  DEFINE_FUNC_ALIGNED0(AVBufferSinkParams*, __cdecl, av_buffersink_params_alloc);
643 +  DEFINE_FUNC_ALIGNED1(int                , __cdecl, av_buffersink_poll_frame, AVFilterContext *);
644  
645    BEGIN_METHOD_RESOLVE()
646      RESOLVE_METHOD_RENAME(avfilter_open, avfilter_open_dont_call)
647 @@ -248,22 +188,25 @@
648      RESOLVE_METHOD(avfilter_graph_create_filter)
649      RESOLVE_METHOD(avfilter_get_by_name)
650      RESOLVE_METHOD(avfilter_graph_alloc)
651 -#if LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,17,0)
652      RESOLVE_METHOD_RENAME(avfilter_inout_alloc, avfilter_inout_alloc_dont_call)
653      RESOLVE_METHOD_RENAME(avfilter_inout_free, avfilter_inout_free_dont_call)
654 -#endif
655      RESOLVE_METHOD_RENAME(avfilter_graph_parse, avfilter_graph_parse_dont_call)
656      RESOLVE_METHOD_RENAME(avfilter_graph_config, avfilter_graph_config_dont_call)
657 -    RESOLVE_METHOD(avfilter_poll_frame)
658 -    RESOLVE_METHOD(avfilter_request_frame)
659 +#if LIBAVFILTER_VERSION_INT < AV_VERSION_INT(3,0,0)
660      RESOLVE_METHOD(av_vsrc_buffer_add_frame)
661 -    RESOLVE_METHOD(avfilter_get_video_buffer)
662 +#else
663 +    RESOLVE_METHOD(av_buffersrc_add_frame)
664 +#endif
665      RESOLVE_METHOD(avfilter_unref_buffer)
666      RESOLVE_METHOD(avfilter_link)
667 +    RESOLVE_METHOD(av_buffersink_get_buffer_ref)
668 +    RESOLVE_METHOD(av_buffersink_params_alloc)
669 +    RESOLVE_METHOD(av_buffersink_poll_frame)
670    END_METHOD_RESOLVE()
671  
672    /* dependencies of libavfilter */
673    DllAvUtil m_dllAvUtil;
674 +  DllSwResample m_dllSwResample;
675  
676  public:
677    int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *inst_name)
678 @@ -279,12 +222,7 @@
679    void avfilter_graph_free(AVFilterGraph **graph)
680    {
681      CSingleLock lock(DllAvCodec::m_critSection);
682 -#if LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(1,76,0)
683      avfilter_graph_free_dont_call(graph);
684 -#else
685 -    avfilter_graph_free_dont_call(*graph);
686 -    m_dllAvUtil.av_freep(graph);
687 -#endif
688    }
689    void avfilter_register_all()
690    {
691 @@ -294,45 +232,29 @@
692    AVFilterInOut* avfilter_inout_alloc()
693    {
694      CSingleLock lock(DllAvCodec::m_critSection);
695 -#if LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,17,0)
696      return avfilter_inout_alloc_dont_call();
697 -#else
698 -    return (AVFilterInOut*)m_dllAvUtil.av_mallocz(sizeof(AVFilterInOut));
699 -#endif
700    }
701    int avfilter_graph_parse(AVFilterGraph *graph, const char *filters, AVFilterInOut **inputs, AVFilterInOut **outputs, void *log_ctx)
702    {
703      CSingleLock lock(DllAvCodec::m_critSection);
704 -#if LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,16,0)
705      return avfilter_graph_parse_dont_call(graph, filters, inputs, outputs, log_ctx);
706 -#elif LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,15,1)
707 -    return avfilter_graph_parse_dont_call(graph, filters, *inputs, *outputs, log_ctx);
708 -#else
709 -    return avfilter_graph_parse_dont_call(graph, filters, *inputs, *outputs, (AVClass*)log_ctx);
710 -#endif
711    }
712    void avfilter_inout_free(AVFilterInOut **inout)
713    {
714      CSingleLock lock(DllAvCodec::m_critSection);
715 -#if LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,17,0)
716      avfilter_inout_free_dont_call(inout);
717 -#else
718 -    *inout = NULL;
719 -#endif
720    }
721    int avfilter_graph_config(AVFilterGraph *graphctx, void *log_ctx)
722    {
723      CSingleLock lock(DllAvCodec::m_critSection);
724 -#if LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,15,1)
725      return avfilter_graph_config_dont_call(graphctx, log_ctx);
726 -#else
727 -    return avfilter_graph_config_dont_call(graphctx, (AVClass*)log_ctx);
728 -#endif
729    }
730    virtual bool Load()
731    {
732      if (!m_dllAvUtil.Load())
733        return false;
734 +    if (!m_dllSwResample.Load())
735 +      return false;
736      return DllDynamic::Load();
737    }
738  };
739 diff -urN xbmc-11.0/lib/DllAvFormat.h xbmc-11.0-ffmpeg-1.0/lib/DllAvFormat.h
740 --- xbmc-11.0/lib/DllAvFormat.h 2012-03-21 23:07:50.000000000 +0100
741 +++ xbmc-11.0-ffmpeg-1.0/lib/DllAvFormat.h      2012-11-08 23:16:03.529738917 +0100
742 @@ -62,54 +62,42 @@
743    virtual ~DllAvFormatInterface() {}
744    virtual void av_register_all_dont_call(void)=0;
745    virtual AVInputFormat *av_find_input_format(const char *short_name)=0;
746 -  virtual int url_feof(ByteIOContext *s)=0;
747 -  virtual AVMetadataTag *av_metadata_get(AVMetadata *m, const char *key, const AVMetadataTag *prev, int flags)=0;
748 -  virtual void av_close_input_file(AVFormatContext *s)=0;
749 -  virtual void av_close_input_stream(AVFormatContext *s)=0;
750 +  virtual int url_feof(AVIOContext *s)=0;
751 +  virtual void avformat_close_input(AVFormatContext **s)=0;
752    virtual int av_read_frame(AVFormatContext *s, AVPacket *pkt)=0;
753    virtual void av_read_frame_flush(AVFormatContext *s)=0;
754    virtual int av_read_play(AVFormatContext *s)=0;
755    virtual int av_read_pause(AVFormatContext *s)=0;
756    virtual int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)=0;
757  #if (!defined USE_EXTERNAL_FFMPEG)
758 -  virtual int av_find_stream_info_dont_call(AVFormatContext *ic)=0;
759 +  virtual int avformat_find_stream_info_dont_call(AVFormatContext *ic, AVDictionary **options)=0;
760  #endif
761 -  virtual int av_open_input_file(AVFormatContext **ic_ptr, const char *filename, AVInputFormat *fmt, int buf_size, AVFormatParameters *ap)=0;
762 -  virtual void url_set_interrupt_cb(URLInterruptCB *interrupt_cb)=0;
763 -  virtual int av_open_input_stream(AVFormatContext **ic_ptr, ByteIOContext *pb, const char *filename, AVInputFormat *fmt, AVFormatParameters *ap)=0;
764 -  virtual int init_put_byte(ByteIOContext *s, unsigned char *buffer, int buffer_size, int write_flag, void *opaque, 
765 +  virtual int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputFormat *fmt, AVDictionary **options)=0;
766 +  virtual AVIOContext *avio_alloc_context(unsigned char *buffer, int buffer_size, int write_flag, void *opaque,
767                              int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
768                              int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
769                              offset_t (*seek)(void *opaque, offset_t offset, int whence))=0;
770    virtual AVInputFormat *av_probe_input_format(AVProbeData *pd, int is_opened)=0;
771    virtual AVInputFormat *av_probe_input_format2(AVProbeData *pd, int is_opened, int *score_max)=0;
772 -  virtual int av_probe_input_buffer(ByteIOContext *pb, AVInputFormat **fmt, const char *filename, void *logctx, unsigned int offset, unsigned int max_probe_size)=0;
773 -  virtual void dump_format(AVFormatContext *ic, int index, const char *url, int is_output)=0;
774 -  virtual int url_fdopen(ByteIOContext **s, URLContext *h)=0;
775 -  virtual int url_fopen(ByteIOContext **s, const char *filename, int flags)=0;
776 -  virtual int url_fclose(ByteIOContext *s)=0;
777 -  virtual int url_open_dyn_buf(ByteIOContext **s)=0;
778 -  virtual int url_close_dyn_buf(ByteIOContext *s, uint8_t **pbuffer)=0;
779 -  virtual offset_t url_fseek(ByteIOContext *s, offset_t offset, int whence)=0;
780 -  virtual int get_buffer(ByteIOContext *s, unsigned char *buf, int size)=0;
781 -  virtual int get_partial_buffer(ByteIOContext *s, unsigned char *buf, int size)=0;
782 -  virtual void put_byte(ByteIOContext *s, int b)=0;
783 -  virtual void put_buffer(ByteIOContext *s, const unsigned char *buf, int size)=0;
784 -  virtual void put_be24(ByteIOContext *s, unsigned int val)=0;
785 -  virtual void put_be32(ByteIOContext *s, unsigned int val)=0;
786 -  virtual void put_be16(ByteIOContext *s, unsigned int val)=0;
787 +  virtual int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt, const char *filename, void *logctx, unsigned int offset, unsigned int max_probe_size)=0;
788 +  virtual void av_dump_format(AVFormatContext *ic, int index, const char *url, int is_output)=0;
789 +  virtual int avio_open(AVIOContext **s, const char *filename, int flags)=0;
790 +  virtual int avio_close(AVIOContext *s)=0;
791 +  virtual int avio_open_dyn_buf(AVIOContext **s)=0;
792 +  virtual int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer)=0;
793 +  virtual offset_t avio_seek(AVIOContext *s, offset_t offset, int whence)=0;
794 +  virtual int avio_read(AVIOContext *s, unsigned char *buf, int size)=0;
795 +  virtual void avio_w8(AVIOContext *s, int b)=0;
796 +  virtual void avio_write(AVIOContext *s, const unsigned char *buf, int size)=0;
797 +  virtual void avio_wb24(AVIOContext *s, unsigned int val)=0;
798 +  virtual void avio_wb32(AVIOContext *s, unsigned int val)=0;
799 +  virtual void avio_wb16(AVIOContext *s, unsigned int val)=0;
800    virtual AVFormatContext *avformat_alloc_context(void)=0;
801 -  virtual AVStream *av_new_stream(AVFormatContext *s, int id)=0;
802 +  virtual AVStream *avformat_new_stream(AVFormatContext *s, AVCodec *c)=0;
803    virtual AVOutputFormat *av_guess_format(const char *short_name, const char *filename, const char *mime_type)=0;
804 -  virtual int av_set_parameters(AVFormatContext *s, AVFormatParameters *ap)=0;
805 -  virtual ByteIOContext *av_alloc_put_byte(unsigned char *buffer, int buffer_size, int write_flag, void *opaque,
806 -                                           int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
807 -                                           int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
808 -                                           offset_t (*seek)(void *opaque, offset_t offset, int whence))=0;
809 -  virtual int av_write_header (AVFormatContext *s)=0;
810 +  virtual int avformat_write_header (AVFormatContext *s, AVDictionary **options)=0;
811    virtual int av_write_trailer(AVFormatContext *s)=0;
812    virtual int av_write_frame  (AVFormatContext *s, AVPacket *pkt)=0;
813 -  virtual int av_metadata_set2(AVMetadata **pm, const char *key, const char *value, int flags)=0;
814  };
815  
816  #if (defined USE_EXTERNAL_FFMPEG)
817 @@ -126,78 +114,45 @@
818    } 
819    virtual void av_register_all_dont_call() { *(int* )0x0 = 0; } 
820    virtual AVInputFormat *av_find_input_format(const char *short_name) { return ::av_find_input_format(short_name); }
821 -  virtual int url_feof(ByteIOContext *s) { return ::url_feof(s); }
822 -#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(52,31,0)
823 -  // API added on: 2009-03-01
824 -  virtual AVMetadataTag *av_metadata_get(AVMetadata *m, const char *key, const AVMetadataTag *prev, int flags){ return ::av_metadata_get(m, key, prev, flags); }
825 -#else
826 -  virtual AVMetadataTag *av_metadata_get(AVMetadata *m, const char *key, const AVMetadataTag *prev, int flags){ return NULL; }
827 -#endif
828 -  virtual void av_close_input_file(AVFormatContext *s) { ::av_close_input_file(s); }
829 -  virtual void av_close_input_stream(AVFormatContext *s) { ::av_close_input_stream(s); }
830 +  virtual int url_feof(AVIOContext *s) { return ::url_feof(s); }
831 +  virtual void avformat_close_input(AVFormatContext **s) { ::avformat_close_input(s); }
832    virtual int av_read_frame(AVFormatContext *s, AVPacket *pkt) { return ::av_read_frame(s, pkt); }
833    virtual void av_read_frame_flush(AVFormatContext *s) { ::av_read_frame_flush(s); }
834    virtual int av_read_play(AVFormatContext *s) { return ::av_read_play(s); }
835    virtual int av_read_pause(AVFormatContext *s) { return ::av_read_pause(s); }
836    virtual int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, int flags) { return ::av_seek_frame(s, stream_index, timestamp, flags); }
837 -  virtual int av_find_stream_info(AVFormatContext *ic)
838 +  virtual int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
839    {
840      CSingleLock lock(DllAvCodec::m_critSection);
841 -    return ::av_find_stream_info(ic);
842 +    return ::avformat_find_stream_info(ic, options);
843    }
844 -  virtual int av_open_input_file(AVFormatContext **ic_ptr, const char *filename, AVInputFormat *fmt, int buf_size, AVFormatParameters *ap) { return ::av_open_input_file(ic_ptr, filename, fmt, buf_size, ap); }
845 -  virtual void url_set_interrupt_cb(URLInterruptCB *interrupt_cb) { ::url_set_interrupt_cb(interrupt_cb); }
846 -  virtual int av_open_input_stream(AVFormatContext **ic_ptr, ByteIOContext *pb, const char *filename, AVInputFormat *fmt, AVFormatParameters *ap) { return ::av_open_input_stream(ic_ptr, pb, filename, fmt, ap); }
847 -  virtual int init_put_byte(ByteIOContext *s, unsigned char *buffer, int buffer_size, int write_flag, void *opaque, 
848 +  virtual int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputFormat *fmt, AVDictionary **options)
849 +  { return ::avformat_open_input(ps, filename, fmt, options); }
850 +  virtual AVIOContext *avio_alloc_context(unsigned char *buffer, int buffer_size, int write_flag, void *opaque,
851                              int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
852                              int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
853 -                            offset_t (*seek)(void *opaque, offset_t offset, int whence)) { return ::init_put_byte(s, buffer, buffer_size, write_flag, opaque, read_packet, write_packet, seek); }
854 +                            offset_t (*seek)(void *opaque, offset_t offset, int whence)) { return ::avio_alloc_context(buffer, buffer_size, write_flag, opaque, read_packet, write_packet, seek); }
855    virtual AVInputFormat *av_probe_input_format(AVProbeData *pd, int is_opened) {return ::av_probe_input_format(pd, is_opened); }
856    virtual AVInputFormat *av_probe_input_format2(AVProbeData *pd, int is_opened, int *score_max) {*score_max = 100; return ::av_probe_input_format(pd, is_opened); } // Use av_probe_input_format, this is not exported by ffmpeg's headers
857 -#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(52,98,0)
858 -  // API added on: 2010-02-08
859 -  virtual int av_probe_input_buffer(ByteIOContext *pb, AVInputFormat **fmt, const char *filename, void *logctx, unsigned int offset, unsigned int max_probe_size) { return ::av_probe_input_buffer(pb, fmt, filename, logctx, offset, max_probe_size); }
860 -#else
861 -  virtual int av_probe_input_buffer(ByteIOContext *pb, AVInputFormat **fmt, const char *filename, void *logctx, unsigned int offset, unsigned int max_probe_size) { return -1; }
862 -#endif
863 -  virtual void dump_format(AVFormatContext *ic, int index, const char *url, int is_output) { ::dump_format(ic, index, url, is_output); }
864 -  virtual int url_fdopen(ByteIOContext **s, URLContext *h) { return ::url_fdopen(s, h); }
865 -  virtual int url_fopen(ByteIOContext **s, const char *filename, int flags) { return ::url_fopen(s, filename, flags); }
866 -  virtual int url_fclose(ByteIOContext *s) { return ::url_fclose(s); }
867 -  virtual int url_open_dyn_buf(ByteIOContext **s) { return ::url_open_dyn_buf(s); }
868 -  virtual int url_close_dyn_buf(ByteIOContext *s, uint8_t **pbuffer) { return ::url_close_dyn_buf(s, pbuffer); }
869 -  virtual offset_t url_fseek(ByteIOContext *s, offset_t offset, int whence) { return ::url_fseek(s, offset, whence); }
870 -  virtual int get_buffer(ByteIOContext *s, unsigned char *buf, int size) { return ::get_buffer(s, buf, size); }
871 -  virtual int get_partial_buffer(ByteIOContext *s, unsigned char *buf, int size) { return ::get_partial_buffer(s, buf, size); }
872 -  virtual void put_byte(ByteIOContext *s, int b) { ::put_byte(s, b); }
873 -  virtual void put_buffer(ByteIOContext *s, const unsigned char *buf, int size) { ::put_buffer(s, buf, size); }
874 -  virtual void put_be24(ByteIOContext *s, unsigned int val) { ::put_be24(s, val); }
875 -  virtual void put_be32(ByteIOContext *s, unsigned int val) { ::put_be32(s, val); }
876 -  virtual void put_be16(ByteIOContext *s, unsigned int val) { ::put_be16(s, val); }
877 +  virtual int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt, const char *filename, void *logctx, unsigned int offset, unsigned int max_probe_size) { return ::av_probe_input_buffer(pb, fmt, filename, logctx, offset, max_probe_size); }
878 +  virtual void av_dump_format(AVFormatContext *ic, int index, const char *url, int is_output) { ::av_dump_format(ic, index, url, is_output); }
879 +  virtual int avio_open(AVIOContext **s, const char *filename, int flags) { return ::avio_open(s, filename, flags); }
880 +  virtual int avio_close(AVIOContext *s) { return ::avio_close(s); }
881 +  virtual int avio_open_dyn_buf(AVIOContext **s) { return ::avio_open_dyn_buf(s); }
882 +  virtual int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer) { return ::avio_close_dyn_buf(s, pbuffer); }
883 +  virtual offset_t avio_seek(AVIOContext *s, offset_t offset, int whence) { return ::avio_seek(s, offset, whence); }
884 +  virtual int avio_read(AVIOContext *s, unsigned char *buf, int size) { return ::avio_read(s, buf, size); }
885 +  virtual void avio_w8(AVIOContext *s, int b) { ::avio_w8(s, b); }
886 +  virtual void avio_write(AVIOContext *s, const unsigned char *buf, int size) { ::avio_write(s, buf, size); }
887 +  virtual void avio_wb24(AVIOContext *s, unsigned int val) { ::avio_wb24(s, val); }
888 +  virtual void avio_wb32(AVIOContext *s, unsigned int val) { ::avio_wb32(s, val); }
889 +  virtual void avio_wb16(AVIOContext *s, unsigned int val) { ::avio_wb16(s, val); }
890    virtual AVFormatContext *avformat_alloc_context() { return ::avformat_alloc_context(); }
891 -  virtual AVStream *av_new_stream(AVFormatContext *s, int id) { return ::av_new_stream(s, id); }
892 -#if LIBAVFORMAT_VERSION_INT < (52<<16 | 45<<8)
893 -  virtual AVOutputFormat *av_guess_format(const char *short_name, const char *filename, const char *mime_type) { return ::guess_format(short_name, filename, mime_type); }
894 -#else
895 +  virtual AVStream *avformat_new_stream(AVFormatContext *s, AVCodec *c) { return ::avformat_new_stream(s, c); }
896    virtual AVOutputFormat *av_guess_format(const char *short_name, const char *filename, const char *mime_type) { return ::av_guess_format(short_name, filename, mime_type); }
897 -#endif
898 -  virtual int av_set_parameters(AVFormatContext *s, AVFormatParameters *ap) { return ::av_set_parameters(s, ap); }
899 -  virtual ByteIOContext *av_alloc_put_byte(unsigned char *buffer, int buffer_size, int write_flag, void *opaque,
900 -                                           int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
901 -                                           int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
902 -                                           offset_t (*seek)(void *opaque, offset_t offset, int whence)) { return ::av_alloc_put_byte(buffer, buffer_size, write_flag, opaque, read_packet, write_packet, seek); }
903 -  virtual int av_write_header (AVFormatContext *s) { return ::av_write_header (s); }
904 +  virtual int avformat_write_header (AVFormatContext *s, AVDictionary **options) { return ::avformat_write_header (s, options); }
905    virtual int av_write_trailer(AVFormatContext *s) { return ::av_write_trailer(s); }
906    virtual int av_write_frame  (AVFormatContext *s, AVPacket *pkt) { return ::av_write_frame(s, pkt); }
907 -#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(52,43,0)
908 -  // API added on: 2009-12-13
909 -  virtual int av_metadata_set2(AVMetadata **pm, const char *key, const char *value, int flags) { return ::av_metadata_set2(pm, key, value, flags); }
910 -#elif LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(52,31,0)
911 -  // API added on: 2009-03-01
912 -  virtual int av_metadata_set2(AVMetadata **pm, const char *key, const char *value, int flags) { return ::av_metadata_set(pm, key, value); }
913 -#else
914 -  virtual int av_metadata_set2(AVMetadata **pm, const char *key, const char *value, int flags) { return -1; }
915 -#endif
916  
917    // DLL faking.
918    virtual bool ResolveExports() { return true; }
919 @@ -218,108 +173,78 @@
920  
921    DEFINE_METHOD0(void, av_register_all_dont_call)
922    DEFINE_METHOD1(AVInputFormat*, av_find_input_format, (const char *p1))
923 -  DEFINE_METHOD1(int, url_feof, (ByteIOContext *p1))
924 -  DEFINE_METHOD4(AVMetadataTag*, av_metadata_get, (AVMetadata *p1, const char *p2, const AVMetadataTag *p3, int p4))
925 -  DEFINE_METHOD1(void, av_close_input_file, (AVFormatContext *p1))
926 -  DEFINE_METHOD1(void, av_close_input_stream, (AVFormatContext *p1))
927 +  DEFINE_METHOD1(int, url_feof, (AVIOContext *p1))
928 +  DEFINE_METHOD1(void, avformat_close_input, (AVFormatContext **p1))
929    DEFINE_METHOD1(int, av_read_play, (AVFormatContext *p1))
930    DEFINE_METHOD1(int, av_read_pause, (AVFormatContext *p1))
931    DEFINE_METHOD1(void, av_read_frame_flush, (AVFormatContext *p1))
932    DEFINE_FUNC_ALIGNED2(int, __cdecl, av_read_frame, AVFormatContext *, AVPacket *)
933    DEFINE_FUNC_ALIGNED4(int, __cdecl, av_seek_frame, AVFormatContext*, int, int64_t, int)
934 -  DEFINE_FUNC_ALIGNED1(int, __cdecl, av_find_stream_info_dont_call, AVFormatContext*)
935 -  DEFINE_FUNC_ALIGNED5(int, __cdecl, av_open_input_file, AVFormatContext**, const char *, AVInputFormat *, int, AVFormatParameters *)
936 -  DEFINE_FUNC_ALIGNED5(int,__cdecl, av_open_input_stream, AVFormatContext **, ByteIOContext *, const char *, AVInputFormat *, AVFormatParameters *)
937 +  DEFINE_FUNC_ALIGNED2(int, __cdecl, avformat_find_stream_info_dont_call, AVFormatContext*, AVDictionary **)
938 +  DEFINE_FUNC_ALIGNED4(int, __cdecl, avformat_open_input, AVFormatContext **, const char *, AVInputFormat *, AVDictionary **)
939    DEFINE_FUNC_ALIGNED2(AVInputFormat*, __cdecl, av_probe_input_format, AVProbeData*, int)
940    DEFINE_FUNC_ALIGNED3(AVInputFormat*, __cdecl, av_probe_input_format2, AVProbeData*, int, int*)
941 -  DEFINE_FUNC_ALIGNED6(int, __cdecl, av_probe_input_buffer, ByteIOContext *, AVInputFormat **, const char *, void *, unsigned int, unsigned int)
942 -  DEFINE_FUNC_ALIGNED3(int, __cdecl, get_buffer, ByteIOContext*, unsigned char *, int)
943 -  DEFINE_FUNC_ALIGNED3(int, __cdecl, get_partial_buffer, ByteIOContext*, unsigned char *, int)
944 -  DEFINE_FUNC_ALIGNED2(void, __cdecl, put_byte, ByteIOContext*, int)
945 -  DEFINE_FUNC_ALIGNED3(void, __cdecl, put_buffer, ByteIOContext*, const unsigned char *, int)
946 -  DEFINE_FUNC_ALIGNED2(void, __cdecl, put_be24, ByteIOContext*, unsigned int)
947 -  DEFINE_FUNC_ALIGNED2(void, __cdecl, put_be32, ByteIOContext*, unsigned int)
948 -  DEFINE_FUNC_ALIGNED2(void, __cdecl, put_be16, ByteIOContext*, unsigned int)
949 -  DEFINE_METHOD1(void, url_set_interrupt_cb, (URLInterruptCB *p1))
950 -  DEFINE_METHOD8(int, init_put_byte, (ByteIOContext *p1, unsigned char *p2, int p3, int p4, void *p5, 
951 +  DEFINE_FUNC_ALIGNED6(int, __cdecl, av_probe_input_buffer, AVIOContext *, AVInputFormat **, const char *, void *, unsigned int, unsigned int)
952 +  DEFINE_FUNC_ALIGNED3(int, __cdecl, avio_read, AVIOContext*, unsigned char *, int)
953 +  DEFINE_FUNC_ALIGNED2(void, __cdecl, avio_w8, AVIOContext*, int)
954 +  DEFINE_FUNC_ALIGNED3(void, __cdecl, avio_write, AVIOContext*, const unsigned char *, int)
955 +  DEFINE_FUNC_ALIGNED2(void, __cdecl, avio_wb24, AVIOContext*, unsigned int)
956 +  DEFINE_FUNC_ALIGNED2(void, __cdecl, avio_wb32, AVIOContext*, unsigned int)
957 +  DEFINE_FUNC_ALIGNED2(void, __cdecl, avio_wb16, AVIOContext*, unsigned int)
958 +  DEFINE_METHOD7(AVIOContext *, avio_alloc_context, (unsigned char *p1, int p2, int p3, void *p4,
959 +                  int (*p5)(void *opaque, uint8_t *buf, int buf_size),
960                    int (*p6)(void *opaque, uint8_t *buf, int buf_size),
961 -                  int (*p7)(void *opaque, uint8_t *buf, int buf_size),
962 -                  offset_t (*p8)(void *opaque, offset_t offset, int whence)))
963 -  DEFINE_METHOD4(void, dump_format, (AVFormatContext *p1, int p2, const char *p3, int p4))
964 -  DEFINE_METHOD2(int, url_fdopen, (ByteIOContext **p1, URLContext *p2))
965 -  DEFINE_METHOD3(int, url_fopen, (ByteIOContext **p1, const char *p2, int p3))
966 -  DEFINE_METHOD1(int, url_fclose, (ByteIOContext *p1))
967 -  DEFINE_METHOD1(int, url_open_dyn_buf, (ByteIOContext **p1))
968 -  DEFINE_METHOD2(int, url_close_dyn_buf, (ByteIOContext *p1, uint8_t **p2))
969 -  DEFINE_METHOD3(offset_t, url_fseek, (ByteIOContext *p1, offset_t p2, int p3))
970 +                  offset_t (*p7)(void *opaque, offset_t offset, int whence)))
971 +  DEFINE_METHOD4(void, av_dump_format, (AVFormatContext *p1, int p2, const char *p3, int p4))
972 +  DEFINE_METHOD3(int, avio_open, (AVIOContext **p1, const char *p2, int p3))
973 +  DEFINE_METHOD1(int, avio_close, (AVIOContext *p1))
974 +  DEFINE_METHOD1(int, avio_open_dyn_buf, (AVIOContext **p1))
975 +  DEFINE_METHOD2(int, avio_close_dyn_buf, (AVIOContext *p1, uint8_t **p2))
976 +  DEFINE_METHOD3(offset_t, avio_seek, (AVIOContext *p1, offset_t p2, int p3))
977    DEFINE_METHOD0(AVFormatContext *, avformat_alloc_context)
978 -  DEFINE_METHOD2(AVStream *, av_new_stream, (AVFormatContext *p1, int p2))
979 -#if LIBAVFORMAT_VERSION_INT < (52<<16 | 45<<8)
980 -  DEFINE_METHOD3(AVOutputFormat *, guess_format, (const char *p1, const char *p2, const char *p3))
981 -#else
982 +  DEFINE_METHOD2(AVStream *, avformat_new_stream, (AVFormatContext *p1, AVCodec *p2))
983    DEFINE_METHOD3(AVOutputFormat *, av_guess_format, (const char *p1, const char *p2, const char *p3))
984 -#endif
985 -  DEFINE_METHOD2(int, av_set_parameters, (AVFormatContext *p1, AVFormatParameters *p2));
986 -  DEFINE_METHOD7(ByteIOContext *, av_alloc_put_byte, (unsigned char *p1, int p2, int p3, void *p4,
987 -                  int(*p5)(void *opaque, uint8_t *buf, int buf_size),
988 -                  int(*p6)(void *opaque, uint8_t *buf, int buf_size),
989 -                  offset_t(*p7)(void *opaque, offset_t offset, int whence)))
990 -  DEFINE_METHOD1(int, av_write_header , (AVFormatContext *p1))
991 +  DEFINE_METHOD2(int, avformat_write_header , (AVFormatContext *p1, AVDictionary **p2))
992    DEFINE_METHOD1(int, av_write_trailer, (AVFormatContext *p1))
993    DEFINE_METHOD2(int, av_write_frame  , (AVFormatContext *p1, AVPacket *p2))
994 -  DEFINE_METHOD4(int, av_metadata_set2, (AVMetadata **p1, const char *p2, const char *p3, int p4));
995    BEGIN_METHOD_RESOLVE()
996      RESOLVE_METHOD_RENAME(av_register_all, av_register_all_dont_call)
997      RESOLVE_METHOD(av_find_input_format)
998      RESOLVE_METHOD(url_feof)
999 -    RESOLVE_METHOD(av_metadata_get)
1000 -    RESOLVE_METHOD(av_close_input_file)
1001 -    RESOLVE_METHOD(av_close_input_stream)
1002 +    RESOLVE_METHOD(avformat_close_input)
1003      RESOLVE_METHOD(av_read_frame)
1004      RESOLVE_METHOD(av_read_play)
1005      RESOLVE_METHOD(av_read_pause)
1006 -    RESOLVE_METHOD_RENAME(ff_read_frame_flush, av_read_frame_flush)
1007 +    RESOLVE_METHOD(av_read_frame_flush)
1008      RESOLVE_METHOD(av_seek_frame)
1009 -    RESOLVE_METHOD_RENAME(av_find_stream_info, av_find_stream_info_dont_call)
1010 -    RESOLVE_METHOD(av_open_input_file)
1011 -    RESOLVE_METHOD(url_set_interrupt_cb)
1012 -    RESOLVE_METHOD(av_open_input_stream)
1013 -    RESOLVE_METHOD(init_put_byte)
1014 +    RESOLVE_METHOD_RENAME(avformat_find_stream_info, avformat_find_stream_info_dont_call)
1015 +    RESOLVE_METHOD(avformat_open_input)
1016 +    RESOLVE_METHOD(avio_alloc_context)
1017      RESOLVE_METHOD(av_probe_input_format)
1018      RESOLVE_METHOD(av_probe_input_format2)
1019      RESOLVE_METHOD(av_probe_input_buffer)
1020 -    RESOLVE_METHOD(dump_format)
1021 -    RESOLVE_METHOD(url_fdopen)
1022 -    RESOLVE_METHOD(url_fopen)
1023 -    RESOLVE_METHOD(url_fclose)
1024 -    RESOLVE_METHOD(url_open_dyn_buf)
1025 -    RESOLVE_METHOD(url_close_dyn_buf)
1026 -    RESOLVE_METHOD(url_fseek)
1027 -    RESOLVE_METHOD(get_buffer)
1028 -    RESOLVE_METHOD(get_partial_buffer)
1029 -    RESOLVE_METHOD(put_byte)
1030 -    RESOLVE_METHOD(put_buffer)
1031 -    RESOLVE_METHOD(put_be24)
1032 -    RESOLVE_METHOD(put_be32)
1033 -    RESOLVE_METHOD(put_be16)
1034 +    RESOLVE_METHOD(av_dump_format)
1035 +    RESOLVE_METHOD(avio_open)
1036 +    RESOLVE_METHOD(avio_close)
1037 +    RESOLVE_METHOD(avio_open_dyn_buf)
1038 +    RESOLVE_METHOD(avio_close_dyn_buf)
1039 +    RESOLVE_METHOD(avio_seek)
1040 +    RESOLVE_METHOD(avio_read)
1041 +    RESOLVE_METHOD(avio_w8)
1042 +    RESOLVE_METHOD(avio_write)
1043 +    RESOLVE_METHOD(avio_wb24)
1044 +    RESOLVE_METHOD(avio_wb32)
1045 +    RESOLVE_METHOD(avio_wb16)
1046      RESOLVE_METHOD(avformat_alloc_context)
1047 -    RESOLVE_METHOD(av_new_stream)
1048 -#if LIBAVFORMAT_VERSION_INT < (52<<16 | 45<<8)
1049 -    RESOLVE_METHOD(guess_format)
1050 -#else
1051 +    RESOLVE_METHOD(avformat_new_stream)
1052      RESOLVE_METHOD(av_guess_format)
1053 -#endif
1054 -    RESOLVE_METHOD(av_set_parameters)
1055 -    RESOLVE_METHOD(av_alloc_put_byte)
1056 -    RESOLVE_METHOD(av_write_header)
1057 +    RESOLVE_METHOD(avformat_write_header)
1058      RESOLVE_METHOD(av_write_trailer)
1059      RESOLVE_METHOD(av_write_frame)
1060 -    RESOLVE_METHOD(av_metadata_set2)
1061    END_METHOD_RESOLVE()
1062  
1063    /* dependencies of libavformat */
1064    DllAvCodec m_dllAvCodec;
1065 -  // DllAvCore loaded implicitely by m_dllAvCodec
1066    // DllAvUtil loaded implicitely by m_dllAvCodec
1067  
1068  public:
1069 @@ -328,10 +253,10 @@
1070      CSingleLock lock(DllAvCodec::m_critSection);
1071      av_register_all_dont_call();
1072    }
1073 -  int av_find_stream_info(AVFormatContext *ic)
1074 +  int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
1075    {
1076      CSingleLock lock(DllAvCodec::m_critSection);
1077 -    return(av_find_stream_info_dont_call(ic));
1078 +    return avformat_find_stream_info_dont_call(ic, options);
1079    }
1080  
1081    virtual bool Load()
1082 diff -urN xbmc-11.0/lib/DllAvUtil.h xbmc-11.0-ffmpeg-1.0/lib/DllAvUtil.h
1083 --- xbmc-11.0/lib/DllAvUtil.h   2012-03-21 23:07:50.000000000 +0100
1084 +++ xbmc-11.0-ffmpeg-1.0/lib/DllAvUtil.h        2012-11-08 23:16:18.536405054 +0100
1085 @@ -65,6 +65,7 @@
1086    #include "libavutil/opt.h"
1087    #include "libavutil/mem.h"
1088    #include "libavutil/fifo.h"
1089 +  #include "libavutil/samplefmt.h"
1090  #endif
1091  }
1092  
1093 @@ -89,7 +90,7 @@
1094    virtual int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)=0;
1095    virtual const AVCRC* av_crc_get_table(AVCRCId crc_id)=0;
1096    virtual uint32_t av_crc(const AVCRC *ctx, uint32_t crc, const uint8_t *buffer, size_t length)=0;
1097 -  virtual int av_set_string3(void *obj, const char *name, const char *val, int alloc, const AVOption **o_out)=0;
1098 +  virtual int av_opt_set(void *obj, const char *name, const char *val, int search_flags)=0;
1099    virtual AVFifoBuffer *av_fifo_alloc(unsigned int size) = 0;
1100    virtual void av_fifo_free(AVFifoBuffer *f) = 0;
1101    virtual void av_fifo_reset(AVFifoBuffer *f) = 0;
1102 @@ -97,6 +98,11 @@
1103    virtual int av_fifo_generic_read(AVFifoBuffer *f, void *dest, int buf_size, void (*func)(void*, void*, int)) = 0;
1104    virtual int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int (*func)(void*, void*, int)) = 0;
1105    virtual char *av_strdup(const char *s)=0;
1106 +  virtual int av_get_bytes_per_sample(enum AVSampleFormat p1) = 0;
1107 +  virtual AVDictionaryEntry *av_dict_get(AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags) = 0;
1108 +  virtual int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)=0;
1109 +  virtual int av_samples_get_buffer_size (int *linesize, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align) = 0;
1110 +  virtual int64_t av_get_default_channel_layout(int nb_channels)=0;
1111  };
1112  
1113  #if (defined USE_EXTERNAL_FFMPEG)
1114 @@ -117,12 +123,7 @@
1115     virtual int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) { return ::av_rescale_q(a, bq, cq); }
1116     virtual const AVCRC* av_crc_get_table(AVCRCId crc_id) { return ::av_crc_get_table(crc_id); }
1117     virtual uint32_t av_crc(const AVCRC *ctx, uint32_t crc, const uint8_t *buffer, size_t length) { return ::av_crc(ctx, crc, buffer, length); }
1118 -#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(52,7,0)
1119 -   // API added on: 2008-12-16
1120 -   virtual int av_set_string3(void *obj, const char *name, const char *val, int alloc, const AVOption **o_out) { return ::av_set_string3(obj, name, val, alloc, o_out); }
1121 -#else
1122 -   virtual int av_set_string3(void *obj, const char *name, const char *val, int alloc, const AVOption **o_out) { return AVERROR(ENOENT); }
1123 -#endif
1124 +   virtual int av_opt_set(void *obj, const char *name, const char *val, int search_flags) { return ::av_opt_set(obj, name, val, search_flags); }
1125    virtual AVFifoBuffer *av_fifo_alloc(unsigned int size) {return ::av_fifo_alloc(size); }
1126    virtual void av_fifo_free(AVFifoBuffer *f) { ::av_fifo_free(f); }
1127    virtual void av_fifo_reset(AVFifoBuffer *f) { ::av_fifo_reset(f); }
1128 @@ -132,6 +133,13 @@
1129    virtual int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int (*func)(void*, void*, int))
1130      { return ::av_fifo_generic_write(f, src, size, func); }
1131    virtual char *av_strdup(const char *s) { return ::av_strdup(s); }
1132 +  virtual int av_get_bytes_per_sample(enum AVSampleFormat p1)
1133 +    { return ::av_get_bytes_per_sample(p1); }
1134 +  virtual AVDictionaryEntry *av_dict_get(AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags){ return ::av_dict_get(m, key, prev, flags); }
1135 +  virtual int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags) { return ::av_dict_set(pm, key, value, flags); }
1136 +  virtual int av_samples_get_buffer_size (int *linesize, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align)
1137 +    { return ::av_samples_get_buffer_size(linesize, nb_channels, nb_samples, sample_fmt, align); }
1138 +  virtual int64_t av_get_default_channel_layout(int nb_channels) { return ::av_get_default_channel_layout(nb_channels); }
1139  
1140     // DLL faking.
1141     virtual bool ResolveExports() { return true; }
1142 @@ -160,7 +168,7 @@
1143    DEFINE_METHOD3(int64_t, av_rescale_q, (int64_t p1, AVRational p2, AVRational p3));
1144    DEFINE_METHOD1(const AVCRC*, av_crc_get_table, (AVCRCId p1))
1145    DEFINE_METHOD4(uint32_t, av_crc, (const AVCRC *p1, uint32_t p2, const uint8_t *p3, size_t p4));
1146 -  DEFINE_METHOD5(int, av_set_string3, (void *p1, const char *p2, const char *p3, int p4, const AVOption **p5));
1147 +  DEFINE_METHOD4(int, av_opt_set, (void *p1, const char *p2, const char *p3, int p4));
1148    DEFINE_METHOD1(AVFifoBuffer*, av_fifo_alloc, (unsigned int p1))
1149    DEFINE_METHOD1(void, av_fifo_free, (AVFifoBuffer *p1))
1150    DEFINE_METHOD1(void, av_fifo_reset, (AVFifoBuffer *p1))
1151 @@ -168,6 +176,11 @@
1152    DEFINE_METHOD4(int, av_fifo_generic_read, (AVFifoBuffer *p1, void *p2, int p3, void (*p4)(void*, void*, int)))
1153    DEFINE_METHOD4(int, av_fifo_generic_write, (AVFifoBuffer *p1, void *p2, int p3, int (*p4)(void*, void*, int)))
1154    DEFINE_METHOD1(char*, av_strdup, (const char *p1))
1155 +  DEFINE_METHOD1(int, av_get_bytes_per_sample, (enum AVSampleFormat p1))
1156 +  DEFINE_METHOD4(AVDictionaryEntry *, av_dict_get, (AVDictionary *p1, const char *p2, const AVDictionaryEntry *p3, int p4))
1157 +  DEFINE_METHOD4(int, av_dict_set, (AVDictionary **p1, const char *p2, const char *p3, int p4));
1158 +  DEFINE_METHOD5(int, av_samples_get_buffer_size, (int *p1, int p2, int p3, enum AVSampleFormat p4, int p5))
1159 +  DEFINE_METHOD1(int64_t, av_get_default_channel_layout, (int p1))
1160  
1161    public:
1162    BEGIN_METHOD_RESOLVE()
1163 @@ -181,7 +194,7 @@
1164      RESOLVE_METHOD(av_rescale_q)
1165      RESOLVE_METHOD(av_crc_get_table)
1166      RESOLVE_METHOD(av_crc)
1167 -    RESOLVE_METHOD(av_set_string3)
1168 +    RESOLVE_METHOD(av_opt_set)
1169      RESOLVE_METHOD(av_fifo_alloc)
1170      RESOLVE_METHOD(av_fifo_free)
1171      RESOLVE_METHOD(av_fifo_reset)
1172 @@ -189,6 +202,11 @@
1173      RESOLVE_METHOD(av_fifo_generic_read)
1174      RESOLVE_METHOD(av_fifo_generic_write)
1175      RESOLVE_METHOD(av_strdup)
1176 +    RESOLVE_METHOD(av_get_bytes_per_sample)
1177 +    RESOLVE_METHOD(av_dict_get)
1178 +    RESOLVE_METHOD(av_dict_set)
1179 +    RESOLVE_METHOD(av_samples_get_buffer_size)
1180 +    RESOLVE_METHOD(av_get_default_channel_layout)
1181    END_METHOD_RESOLVE()
1182  };
1183  
1184 diff -urN xbmc-11.0/lib/DllSwResample.h xbmc-11.0-ffmpeg-1.0/lib/DllSwResample.h
1185 --- xbmc-11.0/lib/DllSwResample.h       1970-01-01 01:00:00.000000000 +0100
1186 +++ xbmc-11.0-ffmpeg-1.0/lib/DllSwResample.h    2012-11-08 23:15:55.399739205 +0100
1187 @@ -0,0 +1,87 @@
1188 +#pragma once
1189 +/*
1190 + *      Copyright (C) 2005-2010 Team XBMC
1191 + *      http://www.xbmc.org
1192 + *
1193 + *  This Program is free software; you can redistribute it and/or modify
1194 + *  it under the terms of the GNU General Public License as published by
1195 + *  the Free Software Foundation; either version 2, or (at your option)
1196 + *  any later version.
1197 + *
1198 + *  This Program is distributed in the hope that it will be useful,
1199 + *  but WITHOUT ANY WARRANTY; without even the implied warranty of
1200 + *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1201 + *  GNU General Public License for more details.
1202 + *
1203 + *  You should have received a copy of the GNU General Public License
1204 + *  along with XBMC; see the file COPYING.  If not, write to
1205 + *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
1206 + *  http://www.gnu.org/copyleft/gpl.html
1207 + *
1208 + */
1209 +
1210 +#if (defined HAVE_CONFIG_H) && (!defined WIN32)
1211 +  #include "config.h"
1212 +#endif
1213 +#include "DynamicDll.h"
1214 +
1215 +extern "C" {
1216 +#ifndef HAVE_MMX
1217 +#define HAVE_MMX
1218 +#endif
1219 +#ifndef __STDC_CONSTANT_MACROS
1220 +#define __STDC_CONSTANT_MACROS
1221 +#endif
1222 +#ifndef __GNUC__
1223 +#pragma warning(disable:4244)
1224 +#endif
1225 +#if (defined USE_EXTERNAL_FFMPEG)
1226 +  #include <libswresample/swresample.h>
1227 +#else
1228 +  #include "libswresample/swresample.h"
1229 +#endif
1230 +}
1231 +
1232 +
1233 +#if (defined USE_EXTERNAL_FFMPEG)
1234 +
1235 +// Use direct mapping
1236 +class DllSwResample : public DllDynamic
1237 +{
1238 +public:
1239 +  virtual ~DllSwResample() {}
1240 +
1241 +  // DLL faking.
1242 +  virtual bool ResolveExports() { return true; }
1243 +  virtual bool Load() {
1244 +    CLog::Log(LOGDEBUG, "DllAvFormat: Using libswresample system library");
1245 +    return true;
1246 +  }
1247 +  virtual void Unload() {}
1248 +};
1249 +
1250 +#else
1251 +
1252 +class DllSwResample : public DllDynamic
1253 +{
1254 +  DECLARE_DLL_WRAPPER(DllSwResample, DLL_PATH_LIBSWRESAMPLE)
1255 +
1256 +  LOAD_SYMBOLS()
1257 +
1258 +  BEGIN_METHOD_RESOLVE()
1259 +  END_METHOD_RESOLVE()
1260 +
1261 +  /* dependencies of libavformat */
1262 +  DllAvUtil m_dllAvUtil;
1263 +
1264 +public:
1265 +
1266 +  virtual bool Load()
1267 +  {
1268 +    if (!m_dllAvUtil.Load())
1269 +      return false;
1270 +    return DllDynamic::Load();
1271 +  }
1272 +};
1273 +
1274 +#endif
1275 diff -urN xbmc-11.0/lib/Makefile.in xbmc-11.0-ffmpeg-1.0/lib/Makefile.in
1276 --- xbmc-11.0/lib/Makefile.in   2012-03-21 23:07:50.000000000 +0100
1277 +++ xbmc-11.0-ffmpeg-1.0/lib/Makefile.in        2012-11-08 23:15:55.399739205 +0100
1278 @@ -17,6 +17,14 @@
1279  WRAPPER=@abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.o
1280  WRAPPER_MACH_ALIAS=@abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper_mach_alias
1281  
1282 +AVFORMAT_SO=avformat-53-$(ARCH).so
1283 +AVCODEC_SO=avcodec-53-$(ARCH).so
1284 +AVUTIL_SO=avutil-51-$(ARCH).so
1285 +AVFILTER_SO=avfilter-2-$(ARCH).so
1286 +SWSCALE_SO=swscale-2-$(ARCH).so
1287 +POSTPROC_SO=postproc-52-$(ARCH).so
1288 +SWRESAMPLE_SO=swresample-0-$(ARCH).so
1289 +
1290  DIRS=
1291  ifneq (@USE_EXTERNAL_FFMPEG@,1)
1292    DIRS+=ffmpeg
1293 @@ -24,13 +32,13 @@
1294  
1295  LIBS=
1296  ifneq (@USE_EXTERNAL_FFMPEG@,1)
1297 -  LIBS+=avutil-50-$(ARCH).so \
1298 -       avcodec-52-$(ARCH).so \
1299 -       avcore-0-$(ARCH).so \
1300 -       avformat-52-$(ARCH).so \
1301 -       postproc-51-$(ARCH).so \
1302 -       avfilter-1-$(ARCH).so \
1303 -       swscale-0-$(ARCH).so
1304 +  LIBS+=$(AVUTIL_SO) \
1305 +       $(AVCODEC_SO) \
1306 +       $(AVFORMAT_SO) \
1307 +       $(POSTPROC_SO) \
1308 +       $(AVFILTER_SO) \
1309 +       $(SWSCALE_SO) \
1310 +       $(SWRESAMPLE_SO)
1311  endif
1312  
1313  ifneq (,$(findstring powerpc,$(ARCH)))
1314 @@ -54,90 +62,90 @@
1315  BUNDLE1_O = -lbundle1.o
1316  endif
1317  
1318 -$(SYSDIR)/avutil-50-$(ARCH).so: $(WRAPPER) ffmpeg/libavutil/libavutil.dylib
1319 +$(SYSDIR)/$(AVUTIL_SO): $(WRAPPER) ffmpeg/libavutil/libavutil.dylib
1320         $(LD) $(LDFLAGS) -alias_list $(WRAPPER_MACH_ALIAS) -o $@ \
1321                 $(WRAPPER) ffmpeg/libavutil/*.o \
1322                 ffmpeg/libavutil/$(ARCH_DIR)/*.o $(BUNDLE1_O)
1323  
1324 -$(SYSDIR)/avcodec-52-$(ARCH).so: $(WRAPPER) ffmpeg/libavcodec/libavcodec.dylib
1325 +$(SYSDIR)/$(AVCODEC_SO): $(WRAPPER) ffmpeg/libavcodec/libavcodec.dylib
1326         $(LD) $(LDFLAGS) -alias_list $(WRAPPER_MACH_ALIAS) -o $@ \
1327                 $(WRAPPER) ffmpeg/libavcodec/*.o \
1328                 ffmpeg/libavcodec/$(ARCH_DIR)/*.o $(BUNDLE1_O)
1329  
1330 -$(SYSDIR)/avcore-0-$(ARCH).so: $(WRAPPER) ffmpeg/libavcore/libavcore.dylib
1331 -       $(LD) $(LDFLAGS) -alias_list $(WRAPPER_MACH_ALIAS)  -o $@ \
1332 -               $(WRAPPER) ffmpeg/libavcore/*.o $(BUNDLE1_O)
1333 -
1334 -$(SYSDIR)/avformat-52-$(ARCH).so: $(WRAPPER) ffmpeg/libavformat/libavformat.dylib
1335 +$(SYSDIR)/$(AVFORMAT_SO): $(WRAPPER) ffmpeg/libavformat/libavformat.dylib
1336         $(LD) $(LDFLAGS) -alias_list $(WRAPPER_MACH_ALIAS)  -o $@ \
1337                 $(WRAPPER) ffmpeg/libavformat/*.o $(BUNDLE1_O)
1338  
1339  ifeq ($(findstring x86,$(ARCH_DIR)), x86)
1340 -$(SYSDIR)/avfilter-1-$(ARCH).so: $(WRAPPER) ffmpeg/libavfilter/libavfilter.dylib
1341 +$(SYSDIR)/$(AVFILTER_SO): $(WRAPPER) ffmpeg/libavfilter/libavfilter.dylib
1342         $(LD) $(LDFLAGS) -alias_list $(WRAPPER_MACH_ALIAS)  -o $@ \
1343                 $(WRAPPER) ffmpeg/libavfilter/$(ARCH_DIR)/*.o \
1344                 ffmpeg/libavfilter/*.o $(BUNDLE1_O)
1345  else # No libavfilter/ppc or libavfilter/arm
1346 -$(SYSDIR)/avfilter-1-$(ARCH).so: $(WRAPPER) ffmpeg/libavfilter/libavfilter.dylib
1347 +$(SYSDIR)/$(AVFILTER_SO): $(WRAPPER) ffmpeg/libavfilter/libavfilter.dylib
1348         $(LD) $(LDFLAGS) -alias_list $(WRAPPER_MACH_ALIAS)  -o $@ \
1349                 $(WRAPPER) ffmpeg/libavfilter/*.o $(BUNDLE1_O)
1350  endif
1351  
1352  ifneq ($(findstring arm,$(ARCH)), arm)
1353 -$(SYSDIR)/swscale-0-$(ARCH).so: $(WRAPPER) ffmpeg/libswscale/libswscale.dylib
1354 +$(SYSDIR)/$(SWSCALE_SO): $(WRAPPER) ffmpeg/libswscale/libswscale.dylib
1355         $(LD) $(LDFLAGS) -alias_list $(WRAPPER_MACH_ALIAS)  -o $@ \
1356                 $(WRAPPER) ffmpeg/libswscale/*.o \
1357                 ffmpeg/libswscale/$(ARCH_DIR)/*.o $(BUNDLE1_O)
1358  else # No ARM version of swscale available yet.
1359 -$(SYSDIR)/swscale-0-$(ARCH).so: $(WRAPPER) ffmpeg/libswscale/libswscale.dylib
1360 +$(SYSDIR)/$(SWSCALE_SO): $(WRAPPER) ffmpeg/libswscale/libswscale.dylib
1361         $(LD) $(LDFLAGS) -alias_list $(WRAPPER_MACH_ALIAS)  -o $@ \
1362                 $(WRAPPER) ffmpeg/libswscale/*.o
1363  endif
1364  
1365 -$(SYSDIR)/postproc-51-$(ARCH).so: $(WRAPPER) ffmpeg/libpostproc/libpostproc.dylib
1366 +$(SYSDIR)/$(POSTPROC_SO): $(WRAPPER) ffmpeg/libpostproc/libpostproc.dylib
1367         $(LD) $(LDFLAGS) -alias_list $(WRAPPER_MACH_ALIAS)  -o $@ \
1368                 $(WRAPPER) ffmpeg/libpostproc/*.o $(BUNDLE1_O)
1369  
1370 +$(SYSDIR)/$(SWRESAMPLE_SO): $(WRAPPER) ffmpeg/libswresample/libswresample.dylib
1371 +       $(LD) $(LDFLAGS) -alias_list $(WRAPPER_MACH_ALIAS)  -o $@ \
1372 +               $(WRAPPER) ffmpeg/libswresample/*.o $(BUNDLE1_O)
1373 +
1374  ffmpeg/libavutil/libavutil.dylib     : ffmpeg;
1375  ffmpeg/libavcodec/libavcodec.dylib   : ffmpeg;
1376 -ffmpeg/libavcore/libavcore.dylib     : ffmpeg;
1377  ffmpeg/libavformat/libavformat.dylib : ffmpeg;
1378  ffmpeg/libavformat/libavfilter.dylib : ffmpeg;
1379  ffmpeg/libswscale/libswscale.dylib   : ffmpeg;
1380  ffmpeg/libpostproc/libpostproc.dylib : ffmpeg;
1381 +ffmpeg/libswresample/libswresample.dylib : ffmpeg;
1382  ffmpeg:
1383         $(MAKE) -C $@
1384  
1385  else
1386  
1387 -$(SYSDIR)/avutil-50-$(ARCH).so: ffmpeg/libavutil/libavutil.so
1388 +$(SYSDIR)/$(AVUTIL_SO): ffmpeg/libavutil/libavutil.so
1389         cp ffmpeg/libavutil/libavutil.so $@
1390  
1391 -$(SYSDIR)/avcodec-52-$(ARCH).so: $(WRAPPER) ffmpeg/libavcodec/libavcodec.so
1392 +$(SYSDIR)/$(AVCODEC_SO): $(WRAPPER) ffmpeg/libavcodec/libavcodec.so
1393         cp ffmpeg/libavcodec/libavcodec.so $@
1394  
1395 -$(SYSDIR)/avcore-0-$(ARCH).so: $(WRAPPER) ffmpeg/libavcore/libavcore.so
1396 -       cp ffmpeg/libavcore/libavcore.so $@
1397 -
1398 -$(SYSDIR)/avformat-52-$(ARCH).so: $(WRAPPER) ffmpeg/libavformat/libavformat.so
1399 +$(SYSDIR)/$(AVFORMAT_SO): $(WRAPPER) ffmpeg/libavformat/libavformat.so
1400         cp ffmpeg/libavformat/libavformat.so $@
1401  
1402 -$(SYSDIR)/avfilter-1-$(ARCH).so: $(WRAPPER) ffmpeg/libavfilter/libavfilter.so
1403 +$(SYSDIR)/$(AVFILTER_SO): $(WRAPPER) ffmpeg/libavfilter/libavfilter.so
1404         cp ffmpeg/libavfilter/libavfilter.so $@
1405  
1406 -$(SYSDIR)/swscale-0-$(ARCH).so: $(WRAPPER) ffmpeg/libswscale/libswscale.so
1407 +$(SYSDIR)/$(SWSCALE_SO): $(WRAPPER) ffmpeg/libswscale/libswscale.so
1408         cp ffmpeg/libswscale/libswscale.so $@
1409  
1410 -$(SYSDIR)/postproc-51-$(ARCH).so: $(WRAPPER) ffmpeg/libpostproc/libpostproc.so
1411 +$(SYSDIR)/$(POSTPROC_SO): $(WRAPPER) ffmpeg/libpostproc/libpostproc.so
1412         cp ffmpeg/libpostproc/libpostproc.so $@
1413  
1414 +$(SYSDIR)/$(SWRESAMPLE_SO): $(WRAPPER) ffmpeg/libswresample/libswresample.so
1415 +       cp ffmpeg/libswresample/libswresample.so $@
1416 +
1417  ffmpeg/libavutil/libavutil.so     : ffmpeg;
1418  ffmpeg/libavcodec/libavcodec.so   : ffmpeg;
1419 -ffmpeg/libavcore/libavcore.so     : ffmpeg;
1420  ffmpeg/libavformat/libavformat.so : ffmpeg;
1421  ffmpeg/libavfilter/libavfilter.so : ffmpeg;
1422  ffmpeg/libswscale/libswscale.so   : ffmpeg;
1423  ffmpeg/libpostproc/libpostproc.so : ffmpeg;
1424 +ffmpeg/libswresample/libswresample.so : ffmpeg;
1425  ffmpeg:
1426         $(MAKE) -C $@
1427  
1428 diff -urN xbmc-11.0/lib/xbmc-dll-symbols/DllAvFormat.c xbmc-11.0-ffmpeg-1.0/lib/xbmc-dll-symbols/DllAvFormat.c
1429 --- xbmc-11.0/lib/xbmc-dll-symbols/DllAvFormat.c        2012-03-21 23:07:50.000000000 +0100
1430 +++ xbmc-11.0-ffmpeg-1.0/lib/xbmc-dll-symbols/DllAvFormat.c     2012-11-08 23:15:47.383072821 +0100
1431 @@ -28,6 +28,7 @@
1432  #include <libavformat/avformat.h>
1433  
1434  /* Taken from libavformat/utils.c */
1435 +#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(54,0,0)
1436  static void flush_packet_queue(AVFormatContext *s)
1437  {
1438      AVPacketList *pktl;
1439 @@ -53,6 +54,27 @@
1440      s->raw_packet_buffer_remaining_size = RAW_PACKET_BUFFER_SIZE;
1441  #endif
1442  }
1443 +#else
1444 +static void free_packet_buffer(AVPacketList **pkt_buf, AVPacketList **pkt_buf_end)
1445 +{
1446 +    while (*pkt_buf) {
1447 +        AVPacketList *pktl = *pkt_buf;
1448 +        *pkt_buf = pktl->next;
1449 +        av_free_packet(&pktl->pkt);
1450 +        av_freep(&pktl);
1451 +    }
1452 +    *pkt_buf_end = NULL;
1453 +}
1454 +/* XXX: suppress the packet queue */
1455 +static void flush_packet_queue(AVFormatContext *s)
1456 +{
1457 +    free_packet_buffer(&s->parse_queue,       &s->parse_queue_end);
1458 +    free_packet_buffer(&s->packet_buffer,     &s->packet_buffer_end);
1459 +    free_packet_buffer(&s->raw_packet_buffer, &s->raw_packet_buffer_end);
1460 +
1461 +    s->raw_packet_buffer_remaining_size = RAW_PACKET_BUFFER_SIZE;
1462 +}
1463 +#endif
1464  
1465  /* Taken from libavformat/utils.c */
1466  void av_read_frame_flush(AVFormatContext *s)
1467 @@ -62,7 +84,9 @@
1468  
1469      flush_packet_queue(s);
1470  
1471 +#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(54,0,0)
1472      s->cur_st = NULL;
1473 +#endif
1474  
1475      /* for each stream, reset read state */
1476      for(i = 0; i < s->nb_streams; i++) {
1477 @@ -71,14 +95,25 @@
1478          if (st->parser) {
1479              av_parser_close(st->parser);
1480              st->parser = NULL;
1481 +#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(54,0,0)
1482              av_free_packet(&st->cur_pkt);
1483 +#endif
1484          }
1485          st->last_IP_pts = AV_NOPTS_VALUE;
1486 +#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(54,0,0)
1487          st->cur_dts = AV_NOPTS_VALUE; /* we set the current DTS to an unspecified origin */
1488          st->reference_dts = AV_NOPTS_VALUE;
1489          /* fail safe */
1490          st->cur_ptr = NULL;
1491          st->cur_len = 0;
1492 +#else
1493 +#define RELATIVE_TS_BASE (INT64_MAX - (1LL<<48))
1494 +        if(st->first_dts == AV_NOPTS_VALUE) st->cur_dts = RELATIVE_TS_BASE;
1495 +        else                                st->cur_dts = AV_NOPTS_VALUE; /* we set the current DTS to an unspecified origin */
1496 +        st->reference_dts = AV_NOPTS_VALUE;
1497 +
1498 +        st->probe_packets = MAX_PROBE_PACKETS;
1499 +#endif
1500  
1501          for(j=0; j<MAX_REORDER_DELAY+1; j++)
1502              st->pts_buffer[j]= AV_NOPTS_VALUE;
1503 diff -urN xbmc-11.0/xbmc/cdrip/EncoderFFmpeg.cpp xbmc-11.0-ffmpeg-1.0/xbmc/cdrip/EncoderFFmpeg.cpp
1504 --- xbmc-11.0/xbmc/cdrip/EncoderFFmpeg.cpp      2012-03-21 23:07:50.000000000 +0100
1505 +++ xbmc-11.0-ffmpeg-1.0/xbmc/cdrip/EncoderFFmpeg.cpp   2012-11-08 23:16:18.536405054 +0100
1506 @@ -59,11 +59,7 @@
1507  
1508    CStdString filename = URIUtils::GetFileName(strFile);
1509    AVOutputFormat *fmt = NULL;
1510 -#if LIBAVFORMAT_VERSION_MAJOR < 52
1511 -  fmt = m_dllAvFormat.guess_format(NULL, filename.c_str(), NULL);
1512 -#else
1513    fmt = m_dllAvFormat.av_guess_format(NULL, filename.c_str(), NULL);
1514 -#endif
1515    if (!fmt)
1516    {
1517      CLog::Log(LOGERROR, "CEncoderFFmpeg::Init - Unable to guess the output format for the file %s", filename.c_str());
1518 @@ -82,7 +78,7 @@
1519    }
1520  
1521    m_Format     = m_dllAvFormat.avformat_alloc_context();
1522 -  m_Format->pb = m_dllAvFormat.av_alloc_put_byte(m_BCBuffer, sizeof(m_BCBuffer), URL_RDONLY, this,  NULL, MuxerReadPacket, NULL);
1523 +  m_Format->pb = m_dllAvFormat.avio_alloc_context(m_BCBuffer, sizeof(m_BCBuffer), AVIO_FLAG_READ, this,  NULL, MuxerReadPacket, NULL);
1524    if (!m_Format->pb)
1525    {
1526      m_dllAvUtil.av_freep(&m_Format);
1527 @@ -93,17 +89,8 @@
1528    m_Format->oformat  = fmt;
1529    m_Format->bit_rate = g_guiSettings.GetInt("audiocds.bitrate") * 1000;
1530  
1531 -  /* setup the muxer */
1532 -  if (m_dllAvFormat.av_set_parameters(m_Format, NULL) != 0)
1533 -  {
1534 -    m_dllAvUtil.av_freep(&m_Format->pb);
1535 -    m_dllAvUtil.av_freep(&m_Format);
1536 -    CLog::Log(LOGERROR, "CEncoderFFmpeg::Init - Failed to set the muxer parameters");
1537 -    return false;
1538 -  }
1539 -
1540    /* add a stream to it */
1541 -  m_Stream = m_dllAvFormat.av_new_stream(m_Format, 1);
1542 +  m_Stream = m_dllAvFormat.avformat_new_stream(m_Format, codec);
1543    if (!m_Stream)
1544    {
1545      m_dllAvUtil.av_freep(&m_Format->pb);
1546 @@ -119,7 +106,7 @@
1547    m_CodecCtx->bit_rate       = m_Format->bit_rate;
1548    m_CodecCtx->sample_rate    = iInRate;
1549    m_CodecCtx->channels       = iInChannels;
1550 -  m_CodecCtx->channel_layout = m_dllAvCodec.avcodec_guess_channel_layout(iInChannels, codec->id, NULL);
1551 +  m_CodecCtx->channel_layout = m_dllAvUtil.av_get_default_channel_layout(iInChannels);
1552    m_CodecCtx->time_base      = (AVRational){1, iInRate};
1553  
1554    if(fmt->flags & AVFMT_GLOBALHEADER)
1555 @@ -144,7 +131,7 @@
1556        return false;
1557    }
1558  
1559 -  if (m_dllAvCodec.avcodec_open(m_CodecCtx, codec))
1560 +  if (m_dllAvCodec.avcodec_open2(m_CodecCtx, codec, NULL))
1561    {
1562      CLog::Log(LOGERROR, "CEncoderFFmpeg::Init - Failed to open the codec");
1563      m_dllAvUtil.av_freep(&m_Stream);
1564 @@ -179,7 +166,7 @@
1565    SetTag("encoder"     , "XBMC FFmpeg Encoder");
1566  
1567    /* write the header */
1568 -  if (m_dllAvFormat.av_write_header(m_Format) != 0)
1569 +  if (m_dllAvFormat.avformat_write_header(m_Format, NULL) != 0)
1570    {
1571      CLog::Log(LOGERROR, "CEncoderFFmpeg::Init - Failed to write the header");
1572      delete[] m_Buffer;
1573 @@ -194,7 +181,7 @@
1574  
1575  void CEncoderFFmpeg::SetTag(const CStdString tag, const CStdString value)
1576  {
1577 -  m_dllAvFormat.av_metadata_set2(&m_Format->metadata, tag.c_str(), value.c_str(), 0);
1578 +  m_dllAvUtil.av_dict_set(&m_Format->metadata, tag.c_str(), value.c_str(), 0);
1579  }
1580  
1581  int CEncoderFFmpeg::MuxerReadPacket(void *opaque, uint8_t *buf, int buf_size)
1582 diff -urN xbmc-11.0/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp xbmc-11.0-ffmpeg-1.0/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp
1583 --- xbmc-11.0/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp      2012-03-21 23:07:50.000000000 +0100
1584 +++ xbmc-11.0-ffmpeg-1.0/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp   2012-11-08 23:16:18.536405054 +0100
1585 @@ -29,10 +29,6 @@
1586  
1587  CDVDAudioCodecFFmpeg::CDVDAudioCodecFFmpeg() : CDVDAudioCodec()
1588  {
1589 -  m_iBufferSize1 = 0;
1590 -  m_pBuffer1     = (BYTE*)_aligned_malloc(AVCODEC_MAX_AUDIO_FRAME_SIZE + FF_INPUT_BUFFER_PADDING_SIZE, 16);
1591 -  memset(m_pBuffer1, 0, AVCODEC_MAX_AUDIO_FRAME_SIZE + FF_INPUT_BUFFER_PADDING_SIZE);
1592 -
1593    m_iBufferSize2 = 0;
1594    m_pBuffer2     = (BYTE*)_aligned_malloc(AVCODEC_MAX_AUDIO_FRAME_SIZE + FF_INPUT_BUFFER_PADDING_SIZE, 16);
1595    memset(m_pBuffer2, 0, AVCODEC_MAX_AUDIO_FRAME_SIZE + FF_INPUT_BUFFER_PADDING_SIZE);
1596 @@ -45,11 +41,11 @@
1597    m_channelMap[0] = PCM_INVALID;
1598    m_channels = 0;
1599    m_layout = 0;
1600 +  m_pFrame1 = NULL;
1601  }
1602  
1603  CDVDAudioCodecFFmpeg::~CDVDAudioCodecFFmpeg()
1604  {
1605 -  _aligned_free(m_pBuffer1);
1606    _aligned_free(m_pBuffer2);
1607    Dispose();
1608  }
1609 @@ -59,12 +55,10 @@
1610    AVCodec* pCodec;
1611    m_bOpenedCodec = false;
1612  
1613 -  if (!m_dllAvCore.Load() || !m_dllAvUtil.Load() || !m_dllAvCodec.Load())
1614 +  if (!m_dllAvUtil.Load() || !m_dllAvCodec.Load())
1615      return false;
1616  
1617    m_dllAvCodec.avcodec_register_all();
1618 -  m_pCodecContext = m_dllAvCodec.avcodec_alloc_context();
1619 -  m_dllAvCodec.avcodec_get_context_defaults(m_pCodecContext);
1620  
1621    pCodec = m_dllAvCodec.avcodec_find_decoder(hints.codec);
1622    if (!pCodec)
1623 @@ -73,6 +67,7 @@
1624      return false;
1625    }
1626  
1627 +  m_pCodecContext = m_dllAvCodec.avcodec_alloc_context3(pCodec);
1628    m_pCodecContext->debug_mv = 0;
1629    m_pCodecContext->debug = 0;
1630    m_pCodecContext->workaround_bugs = 1;
1631 @@ -97,13 +92,14 @@
1632      memcpy(m_pCodecContext->extradata, hints.extradata, hints.extrasize);
1633    }
1634  
1635 -  if (m_dllAvCodec.avcodec_open(m_pCodecContext, pCodec) < 0)
1636 +  if (m_dllAvCodec.avcodec_open2(m_pCodecContext, pCodec, NULL) < 0)
1637    {
1638      CLog::Log(LOGDEBUG,"CDVDAudioCodecFFmpeg::Open() Unable to open codec");
1639      Dispose();
1640      return false;
1641    }
1642  
1643 +  m_pFrame1 = m_dllAvCodec.avcodec_alloc_frame();
1644    m_bOpenedCodec = true;
1645    m_iSampleFormat = AV_SAMPLE_FMT_NONE;
1646    return true;
1647 @@ -111,6 +107,9 @@
1648  
1649  void CDVDAudioCodecFFmpeg::Dispose()
1650  {
1651 +  if (m_pFrame1) m_dllAvUtil.av_free(m_pFrame1);
1652 +  m_pFrame1 = NULL;
1653 +
1654    if (m_pConvert)
1655    {
1656      m_dllAvCodec.av_audio_convert_free(m_pConvert);
1657 @@ -135,7 +134,7 @@
1658  
1659  int CDVDAudioCodecFFmpeg::Decode(BYTE* pData, int iSize)
1660  {
1661 -  int iBytesUsed;
1662 +  int iBytesUsed, got_frame;
1663    if (!m_pCodecContext) return -1;
1664  
1665    m_iBufferSize1 = AVCODEC_MAX_AUDIO_FRAME_SIZE ;
1666 @@ -145,10 +144,13 @@
1667    m_dllAvCodec.av_init_packet(&avpkt);
1668    avpkt.data = pData;
1669    avpkt.size = iSize;
1670 -  iBytesUsed = m_dllAvCodec.avcodec_decode_audio3( m_pCodecContext
1671 -                                                 , (int16_t*)m_pBuffer1
1672 -                                                 , &m_iBufferSize1
1673 +  iBytesUsed = m_dllAvCodec.avcodec_decode_audio4( m_pCodecContext
1674 +                                                 , m_pFrame1
1675 +                                                 , &got_frame
1676                                                   , &avpkt);
1677 +  if (iBytesUsed < 0 || !got_frame)
1678 +    return iBytesUsed;
1679 +  m_iBufferSize1 = m_dllAvUtil.av_samples_get_buffer_size(NULL, m_pCodecContext->channels, m_pFrame1->nb_samples, m_pCodecContext->sample_fmt, 1);
1680  
1681    /* some codecs will attempt to consume more data than what we gave */
1682    if (iBytesUsed > iSize)
1683 @@ -184,9 +186,9 @@
1684        return iBytesUsed;
1685      }
1686  
1687 -    const void *ibuf[6] = { m_pBuffer1 };
1688 +    const void *ibuf[6] = { m_pFrame1->data[0] };
1689      void       *obuf[6] = { m_pBuffer2 };
1690 -    int         istr[6] = { m_dllAvCore.av_get_bits_per_sample_fmt(m_pCodecContext->sample_fmt)/8 };
1691 +    int         istr[6] = { m_dllAvUtil.av_get_bytes_per_sample(m_pCodecContext->sample_fmt) };
1692      int         ostr[6] = { 2 };
1693      int         len     = m_iBufferSize1 / istr[0];
1694      if(m_dllAvCodec.av_audio_convert(m_pConvert, obuf, ostr, ibuf, istr, len) < 0)
1695 @@ -208,7 +210,7 @@
1696  {
1697    if(m_iBufferSize1)
1698    {
1699 -    *dst = m_pBuffer1;
1700 +    *dst = m_pFrame1->data[0];
1701      return m_iBufferSize1;
1702    }
1703    if(m_iBufferSize2)
1704 @@ -273,7 +275,7 @@
1705    else
1706    {
1707      CLog::Log(LOGINFO, "CDVDAudioCodecFFmpeg::GetChannelMap - FFmpeg reported %d channels, but the layout contains %d ignoring", m_pCodecContext->channels, bits);
1708 -    layout = m_dllAvCodec.avcodec_guess_channel_layout(m_pCodecContext->channels, m_pCodecContext->codec_id, NULL);
1709 +    layout = m_dllAvUtil.av_get_default_channel_layout(m_pCodecContext->channels);
1710    }
1711  
1712    int index = 0;
1713 diff -urN xbmc-11.0/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.h xbmc-11.0-ffmpeg-1.0/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.h
1714 --- xbmc-11.0/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.h        2012-03-21 23:07:50.000000000 +0100
1715 +++ xbmc-11.0-ffmpeg-1.0/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.h     2012-11-08 23:16:03.529738917 +0100
1716 @@ -23,7 +23,6 @@
1717  
1718  #include "DVDAudioCodec.h"
1719  #include "DllAvCodec.h"
1720 -#include "DllAvCore.h"
1721  #include "DllAvFormat.h"
1722  #include "DllAvUtil.h"
1723  
1724 @@ -51,7 +50,7 @@
1725    enum AVSampleFormat m_iSampleFormat;
1726    enum PCMChannels m_channelMap[PCM_MAX_CH + 1];
1727  
1728 -  BYTE *m_pBuffer1;
1729 +  AVFrame* m_pFrame1;
1730    int   m_iBufferSize1;
1731  
1732    BYTE *m_pBuffer2;
1733 @@ -64,7 +63,6 @@
1734    int64_t m_layout;
1735  
1736    DllAvCodec m_dllAvCodec;
1737 -  DllAvCore m_dllAvCore;
1738    DllAvUtil m_dllAvUtil;
1739  
1740    void BuildChannelMap();
1741 diff -urN xbmc-11.0/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecPassthroughFFmpeg.cpp xbmc-11.0-ffmpeg-1.0/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecPassthroughFFmpeg.cpp
1742 --- xbmc-11.0/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecPassthroughFFmpeg.cpp   2012-03-21 23:07:50.000000000 +0100
1743 +++ xbmc-11.0-ffmpeg-1.0/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecPassthroughFFmpeg.cpp        2012-11-08 23:16:03.529738917 +0100
1744 @@ -79,11 +79,7 @@
1745    /* get the muxer */
1746    AVOutputFormat *fOut = NULL;
1747  
1748 -#if LIBAVFORMAT_VERSION_MAJOR < 52
1749 -  fOut = m_dllAvFormat.guess_format(muxerName.c_str(), NULL, NULL);
1750 -#else
1751    fOut = m_dllAvFormat.av_guess_format(muxerName.c_str(), NULL, NULL);
1752 -#endif
1753    if (!fOut)
1754    {
1755      CLog::Log(LOGERROR, "CDVDAudioCodecPassthroughFFmpeg::SetupMuxer - Failed to get the FFmpeg %s muxer", muxerName.c_str());
1756 @@ -103,7 +99,7 @@
1757    muxer.m_pFormat->oformat = fOut;
1758  
1759    /* allocate a put_byte struct so we can grab the output */
1760 -  muxer.m_pFormat->pb = m_dllAvFormat.av_alloc_put_byte(muxer.m_BCBuffer, sizeof(muxer.m_BCBuffer), URL_RDONLY, &muxer,  NULL, MuxerReadPacket, NULL);
1761 +  muxer.m_pFormat->pb = m_dllAvFormat.avio_alloc_context(muxer.m_BCBuffer, sizeof(muxer.m_BCBuffer), AVIO_FLAG_READ, &muxer,  NULL, MuxerReadPacket, NULL);
1762    if (!muxer.m_pFormat->pb)
1763    {
1764      CLog::Log(LOGERROR, "CDVDAudioCodecPassthroughFFmpeg::SetupMuxer - Failed to allocate ByteIOContext");
1765 @@ -112,21 +108,10 @@
1766    }
1767  
1768    /* this is streamed, no file, and ignore the index */
1769 -  muxer.m_pFormat->pb->is_streamed   = 1;
1770 +  muxer.m_pFormat->pb->seekable      = 0;
1771    muxer.m_pFormat->flags            |= AVFMT_NOFILE | AVFMT_FLAG_IGNIDX;
1772    muxer.m_pFormat->bit_rate          = hints.bitrate;
1773  
1774 -  /* setup the muxer */
1775 -  if (m_dllAvFormat.av_set_parameters(muxer.m_pFormat, NULL) != 0)
1776 -  {
1777 -    CLog::Log(LOGERROR, "CDVDAudioCodecPassthroughFFmpeg::SetupMuxer - Failed to set the %s muxer parameters", muxerName.c_str());
1778 -    Dispose();
1779 -    return false;
1780 -  }
1781 -
1782 -#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(52,92,0)
1783 -  // API added on: 2011-01-02
1784 -
1785    /* While this is strictly only needed on big-endian systems, we do it on
1786     * both to avoid as much dead code as possible.
1787     * CoreAudio (at least on the cases we've seen) wants IEC 61937 in
1788 @@ -138,8 +123,7 @@
1789  #endif
1790  
1791    /* request output of wanted endianness */
1792 -  if (!fOut->priv_class || m_dllAvUtil.av_set_string3(muxer.m_pFormat->priv_data, "spdif_flags", spdifFlags, 0, NULL) != 0)
1793 -#endif
1794 +  if (!fOut->priv_class || m_dllAvUtil.av_opt_set(muxer.m_pFormat->priv_data, "spdif_flags", spdifFlags, 0) != 0)
1795    {
1796  #if defined(WORDS_BIGENDIAN) && !defined(__APPLE__)
1797      CLog::Log(LOGERROR, "CDVDAudioCodecPassthroughFFmpeg::SetupMuxer - Unable to set big-endian stream mode (FFmpeg too old?), disabling passthrough");
1798 @@ -149,7 +133,7 @@
1799    }
1800  
1801    /* add a stream to it */
1802 -  muxer.m_pStream = m_dllAvFormat.av_new_stream(muxer.m_pFormat, 1);
1803 +  muxer.m_pStream = m_dllAvFormat.avformat_new_stream(muxer.m_pFormat, NULL);
1804    if (!muxer.m_pStream)
1805    {
1806      CLog::Log(LOGERROR, "CDVDAudioCodecPassthroughFFmpeg::SetupMuxer - Failed to allocate AVStream context");
1807 @@ -159,8 +143,6 @@
1808  
1809  
1810    /* set the stream's parameters */
1811 -  muxer.m_pStream->stream_copy           = 1;
1812 -
1813    m_SampleRate = hints.samplerate;
1814    if(!m_SampleRate && hints.codec == CODEC_ID_AC3)
1815      m_SampleRate = 48000;
1816 @@ -176,7 +158,7 @@
1817    codec->extradata_size = hints.extrasize;
1818    memcpy(codec->extradata, hints.extradata, hints.extrasize);
1819  
1820 -  muxer.m_WroteHeader = m_dllAvFormat.av_write_header(muxer.m_pFormat) == 0;
1821 +  muxer.m_WroteHeader = m_dllAvFormat.avformat_write_header(muxer.m_pFormat, NULL) == 0;
1822    if (!muxer.m_WroteHeader)
1823    {
1824      CLog::Log(LOGERROR, "CDVDAudioCodecPassthrough::SetupMuxer - Failed to write the frame header");
1825 diff -urN xbmc-11.0/xbmc/cores/dvdplayer/DVDCodecs/Audio/Encoders/DVDAudioEncoderFFmpeg.cpp xbmc-11.0-ffmpeg-1.0/xbmc/cores/dvdplayer/DVDCodecs/Audio/Encoders/DVDAudioEncoderFFmpeg.cpp
1826 --- xbmc-11.0/xbmc/cores/dvdplayer/DVDCodecs/Audio/Encoders/DVDAudioEncoderFFmpeg.cpp   2012-03-21 23:07:50.000000000 +0100
1827 +++ xbmc-11.0-ffmpeg-1.0/xbmc/cores/dvdplayer/DVDCodecs/Audio/Encoders/DVDAudioEncoderFFmpeg.cpp        2012-11-08 23:16:03.533072250 +0100
1828 @@ -55,7 +55,7 @@
1829  bool CDVDAudioEncoderFFmpeg::Initialize(unsigned int channels, enum PCMChannels *channelMap, unsigned int bitsPerSample, unsigned int sampleRate)
1830  {
1831    Reset();
1832 -  if (!channelMap || !m_dllAvUtil.Load() || !m_dllAvCore.Load() || !m_dllAvCodec.Load())
1833 +  if (!channelMap || !m_dllAvUtil.Load() || !m_dllAvCodec.Load())
1834      return false;
1835  
1836    m_dllAvCodec.avcodec_register_all();
1837 @@ -65,7 +65,7 @@
1838      return false;
1839  
1840    /* always assume 6 channels, 5.1... m_remap will give us what we want */
1841 -  m_CodecCtx = m_dllAvCodec.avcodec_alloc_context();
1842 +  m_CodecCtx = m_dllAvCodec.avcodec_alloc_context3(codec);
1843    m_CodecCtx->bit_rate       = AC3_ENCODE_BITRATE;
1844    m_CodecCtx->sample_rate    = sampleRate;
1845    m_CodecCtx->channels       = 6;
1846 @@ -104,7 +104,7 @@
1847      }
1848    }
1849  
1850 -  if (m_dllAvCodec.avcodec_open(m_CodecCtx, codec))
1851 +  if (m_dllAvCodec.avcodec_open2(m_CodecCtx, codec, NULL))
1852    {
1853      m_dllAvUtil.av_freep(&m_CodecCtx);
1854      return false;
1855 @@ -149,7 +149,7 @@
1856  
1857    if (m_AudioConvert)
1858        m_TmpBuffer2   = new uint8_t[m_NeededFrames * m_CodecCtx->channels *
1859 -                                   m_dllAvCore.av_get_bits_per_sample_fmt(m_CodecCtx->sample_fmt) / 8];
1860 +                                   m_dllAvUtil.av_get_bytes_per_sample(m_CodecCtx->sample_fmt)];
1861  
1862    return true;
1863  }
1864 @@ -186,7 +186,7 @@
1865      void *convInBuf[] = { m_TmpBuffer };
1866      int convInStr[] = { m_BitsPerSample / 8 };
1867      void *convOutBuf[] = { m_TmpBuffer2 };
1868 -    int convOutStr[] = { m_dllAvCore.av_get_bits_per_sample_fmt(m_CodecCtx->sample_fmt) / 8 };
1869 +    int convOutStr[] = { m_dllAvUtil.av_get_bytes_per_sample(m_CodecCtx->sample_fmt) };
1870      if (m_dllAvCodec.av_audio_convert(m_AudioConvert, convOutBuf, convOutStr,
1871                                        convInBuf, convInStr, m_NeededFrames * m_CodecCtx->channels) < 0) {
1872        CLog::Log(LOGERROR, "CDVDAudioEncoderFFmpeg: Audio conversion failed");
1873 diff -urN xbmc-11.0/xbmc/cores/dvdplayer/DVDCodecs/Audio/Encoders/DVDAudioEncoderFFmpeg.h xbmc-11.0-ffmpeg-1.0/xbmc/cores/dvdplayer/DVDCodecs/Audio/Encoders/DVDAudioEncoderFFmpeg.h
1874 --- xbmc-11.0/xbmc/cores/dvdplayer/DVDCodecs/Audio/Encoders/DVDAudioEncoderFFmpeg.h     2012-03-21 23:07:50.000000000 +0100
1875 +++ xbmc-11.0-ffmpeg-1.0/xbmc/cores/dvdplayer/DVDCodecs/Audio/Encoders/DVDAudioEncoderFFmpeg.h  2012-11-08 23:15:55.399739205 +0100
1876 @@ -43,7 +43,6 @@
1877    virtual int GetData(uint8_t **data);
1878  private:
1879    DllAvCodec m_dllAvCodec;
1880 -  DllAvCore  m_dllAvCore;
1881    DllAvUtil  m_dllAvUtil;
1882  
1883    AVCodecContext   *m_CodecCtx;
1884 diff -urN xbmc-11.0/xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp xbmc-11.0-ffmpeg-1.0/xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp
1885 --- xbmc-11.0/xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp  2012-03-21 23:07:50.000000000 +0100
1886 +++ xbmc-11.0-ffmpeg-1.0/xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp       2012-11-08 23:16:03.533072250 +0100
1887 @@ -49,7 +49,14 @@
1888  
1889    m_dllAvCodec.avcodec_register_all();
1890  
1891 -  m_pCodecContext = m_dllAvCodec.avcodec_alloc_context();
1892 +  AVCodec* pCodec = m_dllAvCodec.avcodec_find_decoder(hints.codec);
1893 +  if (!pCodec)
1894 +  {
1895 +    CLog::Log(LOGDEBUG,"%s - Unable to find codec %d", __FUNCTION__, hints.codec);
1896 +    return false;
1897 +  }
1898 +
1899 +  m_pCodecContext = m_dllAvCodec.avcodec_alloc_context3(pCodec);
1900    m_pCodecContext->debug_mv = 0;
1901    m_pCodecContext->debug = 0;
1902    m_pCodecContext->workaround_bugs = FF_BUG_AUTODETECT;
1903 @@ -100,14 +107,7 @@
1904      delete[] parse_extra;
1905    }
1906  
1907 -  AVCodec* pCodec = m_dllAvCodec.avcodec_find_decoder(hints.codec);
1908 -  if (!pCodec)
1909 -  {
1910 -    CLog::Log(LOGDEBUG,"%s - Unable to find codec %d", __FUNCTION__, hints.codec);
1911 -    return false;
1912 -  }
1913 -
1914 -  if (m_dllAvCodec.avcodec_open(m_pCodecContext, pCodec) < 0)
1915 +  if (m_dllAvCodec.avcodec_open2(m_pCodecContext, pCodec, NULL) < 0)
1916    {
1917      CLog::Log(LOGDEBUG,"CDVDVideoCodecFFmpeg::Open() Unable to open codec");
1918      return false;
1919 @@ -134,19 +134,12 @@
1920  {
1921    for(unsigned i=0;i<sub.num_rects;i++)
1922    {
1923 -#if LIBAVCODEC_VERSION_INT >= (52<<10)
1924      if(sub.rects[i])
1925      {
1926        m_dllAvUtil.av_free(sub.rects[i]->pict.data[0]);
1927        m_dllAvUtil.av_free(sub.rects[i]->pict.data[1]);
1928        m_dllAvUtil.av_freep(&sub.rects[i]);
1929      }
1930 -#else
1931 -    if(sub.rects[i].bitmap)
1932 -      m_dllAvUtil.av_freep(&sub.rects[i].bitmap);
1933 -    if(m_Subtitle.rects[i].rgba_palette)
1934 -      m_dllAvUtil.av_freep(&sub.rects[i].rgba_palette);
1935 -#endif
1936    }
1937    if(sub.rects)
1938      m_dllAvUtil.av_freep(&sub.rects);
1939 @@ -294,7 +287,6 @@
1940      overlay->source_width  = m_width;
1941      overlay->source_height = m_height;
1942  
1943 -#if LIBAVCODEC_VERSION_INT >= (52<<10)
1944      BYTE* s = rect.pict.data[0];
1945      BYTE* t = overlay->data;
1946      for(int i=0;i<rect.h;i++)
1947 @@ -310,21 +302,6 @@
1948      m_dllAvUtil.av_free(rect.pict.data[0]);
1949      m_dllAvUtil.av_free(rect.pict.data[1]);
1950      m_dllAvUtil.av_freep(&m_Subtitle.rects[m_SubtitleIndex]);
1951 -#else
1952 -    BYTE* s = rect.bitmap;
1953 -    BYTE* t = overlay->data;
1954 -    for(int i=0;i<rect.h;i++)
1955 -    {
1956 -      memcpy(t, s, rect.w);
1957 -      s += rect.linesize;
1958 -      t += overlay->linesize;
1959 -    }
1960 -
1961 -    memcpy(overlay->palette, rect.rgba_palette, rect.nb_colors*4);
1962 -
1963 -    m_dllAvUtil.av_freep(&rect.bitmap);
1964 -    m_dllAvUtil.av_freep(&rect.rgba_palette);
1965 -#endif
1966      m_SubtitleIndex++;
1967  
1968      return overlay;
1969 diff -urN xbmc-11.0/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp xbmc-11.0-ffmpeg-1.0/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp
1970 --- xbmc-11.0/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp      2012-03-21 23:07:50.000000000 +0100
1971 +++ xbmc-11.0-ffmpeg-1.0/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp   2012-11-08 23:16:12.336405273 +0100
1972 @@ -123,12 +123,11 @@
1973  CDVDVideoCodecFFmpeg::CDVDVideoCodecFFmpeg() : CDVDVideoCodec()
1974  {
1975    m_pCodecContext = NULL;
1976 -  m_pConvertFrame = NULL;
1977    m_pFrame = NULL;
1978    m_pFilterGraph  = NULL;
1979    m_pFilterIn     = NULL;
1980    m_pFilterOut    = NULL;
1981 -  m_pFilterLink   = NULL;
1982 +  m_pBufferRef    = NULL;
1983  
1984    m_iPictureWidth = 0;
1985    m_iPictureHeight = 0;
1986 @@ -163,9 +162,13 @@
1987    m_dllAvFilter.avfilter_register_all();
1988  
1989    m_bSoftware     = hints.software;
1990 -  m_pCodecContext = m_dllAvCodec.avcodec_alloc_context();
1991 +
1992 +  m_formats.push_back(PIX_FMT_YUV420P);
1993 +  m_formats.push_back(PIX_FMT_YUVJ420P);
1994 +  m_formats.push_back(PIX_FMT_NONE); /* always add none to get a terminated list in ffmpeg world */
1995  
1996    pCodec = NULL;
1997 +  m_pCodecContext = NULL;
1998  
1999    if (hints.codec == CODEC_ID_H264)
2000    {
2001 @@ -196,6 +199,7 @@
2002  
2003          CLog::Log(LOGNOTICE,"CDVDVideoCodecFFmpeg::Open() Creating VDPAU(%ix%i, %d)",hints.width, hints.height, hints.codec);
2004          CVDPAU* vdp = new CVDPAU();
2005 +        m_pCodecContext = m_dllAvCodec.avcodec_alloc_context3(pCodec);
2006          m_pCodecContext->codec_id = hints.codec;
2007          m_pCodecContext->width    = hints.width;
2008          m_pCodecContext->height   = hints.height;
2009 @@ -207,7 +211,7 @@
2010            m_pCodecContext->codec_id = CODEC_ID_NONE; // ffmpeg will complain if this has been set
2011            break;
2012          }
2013 -        m_pCodecContext->codec_id = CODEC_ID_NONE; // ffmpeg will complain if this has been set
2014 +        m_dllAvUtil.av_freep(&m_pCodecContext);
2015          CLog::Log(LOGNOTICE,"CDVDVideoCodecFFmpeg::Open() Failed to get VDPAU device");
2016          vdp->Release();
2017        }
2018 @@ -226,6 +230,9 @@
2019  
2020    CLog::Log(LOGNOTICE,"CDVDVideoCodecFFmpeg::Open() Using codec: %s",pCodec->long_name ? pCodec->long_name : pCodec->name);
2021  
2022 +  if(m_pCodecContext == NULL)
2023 +    m_pCodecContext = m_dllAvCodec.avcodec_alloc_context3(pCodec);
2024 +
2025    m_pCodecContext->opaque = (void*)this;
2026    m_pCodecContext->debug_mv = 0;
2027    m_pCodecContext->debug = 0;
2028 @@ -238,9 +245,7 @@
2029    m_pCodecContext->flags &= CODEC_FLAG_EMU_EDGE;
2030  #else
2031    if (pCodec->id != CODEC_ID_H264 && pCodec->capabilities & CODEC_CAP_DR1
2032 -#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(52,69,0)
2033        && pCodec->id != CODEC_ID_VP8
2034 -#endif
2035       )
2036      m_pCodecContext->flags |= CODEC_FLAG_EMU_EDGE;
2037  #endif
2038 @@ -272,16 +277,16 @@
2039      if (it->m_name == "surfaces")
2040        m_uSurfacesCount = std::atoi(it->m_value.c_str());
2041      else
2042 -      m_dllAvUtil.av_set_string3(m_pCodecContext, it->m_name.c_str(), it->m_value.c_str(), 0, NULL);
2043 +      m_dllAvUtil.av_opt_set(m_pCodecContext, it->m_name.c_str(), it->m_value.c_str(), 0);
2044    }
2045  
2046    int num_threads = std::min(8 /*MAX_THREADS*/, g_cpuInfo.getCPUCount());
2047    if( num_threads > 1 && !hints.software && m_pHardware == NULL // thumbnail extraction fails when run threaded
2048    && ( pCodec->id == CODEC_ID_H264
2049      || pCodec->id == CODEC_ID_MPEG4 ))
2050 -    m_dllAvCodec.avcodec_thread_init(m_pCodecContext, num_threads);
2051 +    m_pCodecContext->thread_count = num_threads;
2052  
2053 -  if (m_dllAvCodec.avcodec_open(m_pCodecContext, pCodec) < 0)
2054 +  if (m_dllAvCodec.avcodec_open2(m_pCodecContext, pCodec, NULL) < 0)
2055    {
2056      CLog::Log(LOGDEBUG,"CDVDVideoCodecFFmpeg::Open() Unable to open codec");
2057      return false;
2058 @@ -306,13 +311,6 @@
2059    if (m_pFrame) m_dllAvUtil.av_free(m_pFrame);
2060    m_pFrame = NULL;
2061  
2062 -  if (m_pConvertFrame)
2063 -  {
2064 -    m_dllAvCodec.avpicture_free(m_pConvertFrame);
2065 -    m_dllAvUtil.av_free(m_pConvertFrame);
2066 -  }
2067 -  m_pConvertFrame = NULL;
2068 -
2069    if (m_pCodecContext)
2070    {
2071      if (m_pCodecContext->codec) m_dllAvCodec.avcodec_close(m_pCodecContext);
2072 @@ -458,9 +456,6 @@
2073      return VC_ERROR;
2074    }
2075  
2076 -  if (len != iSize && m_pCodecContext->skip_frame != AVDISCARD_NONREF)
2077 -    CLog::Log(LOGWARNING, "%s - avcodec_decode_video didn't consume the full packet. size: %d, consumed: %d", __FUNCTION__, iSize, len);
2078 -
2079    if (!iGotPicture)
2080      return VC_BUFFER;
2081  
2082 @@ -478,67 +473,32 @@
2083    if(m_pCodecContext->codec_id == CODEC_ID_H264)
2084      m_started = true;
2085  
2086 -  if(m_pCodecContext->pix_fmt != PIX_FMT_YUV420P
2087 -  && m_pCodecContext->pix_fmt != PIX_FMT_YUVJ420P
2088 -  && m_pHardware == NULL)
2089 -  {
2090 -    if (!m_dllSwScale.IsLoaded() && !m_dllSwScale.Load())
2091 -        return VC_ERROR;
2092 -
2093 -    if (!m_pConvertFrame)
2094 -    {
2095 -      // Allocate an AVFrame structure
2096 -      m_pConvertFrame = (AVPicture*)m_dllAvUtil.av_mallocz(sizeof(AVPicture));
2097 -      // Due to a bug in swsscale we need to allocate one extra line of data
2098 -      if(m_dllAvCodec.avpicture_alloc( m_pConvertFrame
2099 -                                     , PIX_FMT_YUV420P
2100 -                                     , m_pCodecContext->width
2101 -                                     , m_pCodecContext->height+1) < 0)
2102 -      {
2103 -        m_dllAvUtil.av_free(m_pConvertFrame);
2104 -        m_pConvertFrame = NULL;
2105 -        return VC_ERROR;
2106 -      }
2107 -    }
2108 +  if(m_pHardware == NULL)
2109 +  {
2110 +    bool need_scale = std::find( m_formats.begin()
2111 +                               , m_formats.end()
2112 +                               , m_pCodecContext->pix_fmt) == m_formats.end();
2113  
2114 -    // convert the picture
2115 -    struct SwsContext *context = m_dllSwScale.sws_getContext(m_pCodecContext->width, m_pCodecContext->height,
2116 -                                         m_pCodecContext->pix_fmt, m_pCodecContext->width, m_pCodecContext->height,
2117 -                                         PIX_FMT_YUV420P, SWS_FAST_BILINEAR | SwScaleCPUFlags(), NULL, NULL, NULL);
2118 +    bool need_reopen  = false;
2119 +    if(!m_filters.Equals(m_filters_next))
2120 +      need_reopen = true;
2121  
2122 -    if(context == NULL)
2123 +    if(m_pFilterIn)
2124      {
2125 -      CLog::Log(LOGERROR, "CDVDVideoCodecFFmpeg::Decode - unable to obtain sws context for w:%i, h:%i, pixfmt: %i", m_pCodecContext->width, m_pCodecContext->height, m_pCodecContext->pix_fmt);
2126 -      return VC_ERROR;
2127 +      if(m_pFilterIn->outputs[0]->format != m_pCodecContext->pix_fmt
2128 +      || m_pFilterIn->outputs[0]->w      != m_pCodecContext->width
2129 +      || m_pFilterIn->outputs[0]->h      != m_pCodecContext->height)
2130 +        need_reopen = true;
2131      }
2132  
2133 -    m_dllSwScale.sws_scale(context
2134 -                          , m_pFrame->data
2135 -                          , m_pFrame->linesize
2136 -                          , 0
2137 -                          , m_pCodecContext->height
2138 -                          , m_pConvertFrame->data
2139 -                          , m_pConvertFrame->linesize);
2140 -
2141 -    m_dllSwScale.sws_freeContext(context);
2142 -  }
2143 -  else
2144 -  {
2145 -    // no need to convert, just free any existing convert buffers
2146 -    if (m_pConvertFrame)
2147 +    // try to setup new filters
2148 +    if (need_reopen || (need_scale && m_pFilterGraph == NULL))
2149      {
2150 -      m_dllAvCodec.avpicture_free(m_pConvertFrame);
2151 -      m_dllAvUtil.av_free(m_pConvertFrame);
2152 -      m_pConvertFrame = NULL;
2153 -    }
2154 -  }
2155 +      m_filters = m_filters_next;
2156  
2157 -  // try to setup new filters
2158 -  if (!m_filters.Equals(m_filters_next))
2159 -  {
2160 -    m_filters = m_filters_next;
2161 -    if(FilterOpen(m_filters) < 0)
2162 -      FilterClose();
2163 +      if(FilterOpen(m_filters, need_scale) < 0)
2164 +        FilterClose();
2165 +    }
2166    }
2167  
2168    int result;
2169 @@ -564,12 +524,6 @@
2170    if (m_pHardware)
2171      m_pHardware->Reset();
2172  
2173 -  if (m_pConvertFrame)
2174 -  {
2175 -    m_dllAvCodec.avpicture_free(m_pConvertFrame);
2176 -    m_dllAvUtil.av_free(m_pConvertFrame);
2177 -    m_pConvertFrame = NULL;
2178 -  }
2179    m_filters = "";
2180    FilterClose();
2181  }
2182 @@ -579,10 +533,10 @@
2183    pDvdVideoPicture->iWidth = m_pCodecContext->width;
2184    pDvdVideoPicture->iHeight = m_pCodecContext->height;
2185  
2186 -  if(m_pFilterLink)
2187 +  if(m_pBufferRef)
2188    {
2189 -    pDvdVideoPicture->iWidth  = m_pFilterLink->cur_buf->video->w;
2190 -    pDvdVideoPicture->iHeight = m_pFilterLink->cur_buf->video->h;
2191 +    pDvdVideoPicture->iWidth  = m_pBufferRef->video->w;
2192 +    pDvdVideoPicture->iHeight = m_pBufferRef->video->h;
2193    }
2194  
2195    /* crop of 10 pixels if demuxer asked it */
2196 @@ -598,12 +552,8 @@
2197  
2198    /* use variable in the frame */
2199    AVRational pixel_aspect = m_pCodecContext->sample_aspect_ratio;
2200 -  if (m_pFilterLink)
2201 -#ifdef HAVE_AVFILTERBUFFERREFVIDEOPROPS_SAMPLE_ASPECT_RATIO
2202 -    pixel_aspect = m_pFilterLink->cur_buf->video->sample_aspect_ratio;
2203 -#else
2204 -    pixel_aspect = m_pFilterLink->cur_buf->video->pixel_aspect;
2205 -#endif
2206 +  if (m_pBufferRef)
2207 +    pixel_aspect = m_pBufferRef->video->sample_aspect_ratio;
2208  
2209    if (pixel_aspect.num == 0)
2210      aspect_ratio = 0;
2211 @@ -632,8 +582,6 @@
2212    pDvdVideoPicture->iFlags = DVP_FLAG_ALLOCATED;
2213    pDvdVideoPicture->iFlags |= m_pFrame->interlaced_frame ? DVP_FLAG_INTERLACED : 0;
2214    pDvdVideoPicture->iFlags |= m_pFrame->top_field_first ? DVP_FLAG_TOP_FIELD_FIRST: 0;
2215 -  if(m_pCodecContext->pix_fmt == PIX_FMT_YUVJ420P)
2216 -    pDvdVideoPicture->color_range = 1;
2217  
2218    pDvdVideoPicture->chroma_position = m_pCodecContext->chroma_sample_location;
2219    pDvdVideoPicture->color_primaries = m_pCodecContext->color_primaries;
2220 @@ -677,14 +625,6 @@
2221    if(!GetPictureCommon(pDvdVideoPicture))
2222      return false;
2223  
2224 -  if(m_pConvertFrame)
2225 -  {
2226 -    for (int i = 0; i < 4; i++)
2227 -      pDvdVideoPicture->data[i]      = m_pConvertFrame->data[i];
2228 -    for (int i = 0; i < 4; i++)
2229 -      pDvdVideoPicture->iLineSize[i] = m_pConvertFrame->linesize[i];
2230 -  }
2231 -  else
2232    {
2233      for (int i = 0; i < 4; i++)
2234        pDvdVideoPicture->data[i]      = m_pFrame->data[i];
2235 @@ -693,20 +633,38 @@
2236    }
2237  
2238    pDvdVideoPicture->iFlags |= pDvdVideoPicture->data[0] ? 0 : DVP_FLAG_DROPPED;
2239 -  pDvdVideoPicture->format = DVDVideoPicture::FMT_YUV420P;
2240    pDvdVideoPicture->extended_format = 0;
2241 +  pDvdVideoPicture->color_range = 0;
2242 +
2243 +  PixelFormat pix_fmt;
2244 +  if(m_pBufferRef)
2245 +    pix_fmt = (PixelFormat)m_pBufferRef->format;
2246 +  else
2247 +    pix_fmt = m_pCodecContext->pix_fmt;
2248 +
2249 +  switch(pix_fmt)
2250 +  {
2251 +    case PIX_FMT_YUVJ420P:
2252 +      pDvdVideoPicture->format = DVDVideoPicture::FMT_YUV420P;
2253 +      pDvdVideoPicture->color_range = 1;
2254 +      break;
2255 +    default:
2256 +      pDvdVideoPicture->format = DVDVideoPicture::FMT_YUV420P;
2257 +      break;
2258 +  }
2259  
2260    return true;
2261  }
2262  
2263 -int CDVDVideoCodecFFmpeg::FilterOpen(const CStdString& filters)
2264 +int CDVDVideoCodecFFmpeg::FilterOpen(const CStdString& filters, bool scale)
2265  {
2266    int result;
2267 +  AVBufferSinkParams *buffersink_params;
2268  
2269    if (m_pFilterGraph)
2270      FilterClose();
2271  
2272 -  if (filters.IsEmpty())
2273 +  if (filters.IsEmpty() && !scale)
2274      return 0;
2275  
2276    if (!(m_pFilterGraph = m_dllAvFilter.avfilter_graph_alloc()))
2277 @@ -715,17 +673,8 @@
2278      return -1;
2279    }
2280  
2281 -  // CrHasher HACK (if an alternative becomes available use it!): In order to display the output
2282 -  // produced by a combination of filters we insert "nullsink" as the last filter and we use
2283 -  // its input pin as our output pin.
2284 -  //
2285 -  // input --> .. --> last_filter --> [in] nullsink [null]     [in] --> output
2286 -  //                                   |                        |
2287 -  //                                   |                        |
2288 -  //                                   +------------------------+
2289 -  //
2290    AVFilter* srcFilter = m_dllAvFilter.avfilter_get_by_name("buffer");
2291 -  AVFilter* outFilter = m_dllAvFilter.avfilter_get_by_name("nullsink"); // should be last filter in the graph for now
2292 +  AVFilter* outFilter = m_dllAvFilter.avfilter_get_by_name("buffersink"); // should be last filter in the graph for now
2293  
2294    CStdString args;
2295  
2296 @@ -744,11 +693,19 @@
2297      return result;
2298    }
2299  
2300 -  if ((result = m_dllAvFilter.avfilter_graph_create_filter(&m_pFilterOut, outFilter, "out", NULL, NULL/*nullsink=>NULL*/, m_pFilterGraph)) < 0)
2301 +  buffersink_params = m_dllAvFilter.av_buffersink_params_alloc();
2302 +  buffersink_params->pixel_fmts = &m_formats[0];
2303 +#ifdef FF_API_OLD_VSINK_API
2304 +  if ((result = m_dllAvFilter.avfilter_graph_create_filter(&m_pFilterOut, outFilter, "out", NULL, (void*)buffersink_params->pixel_fmts, m_pFilterGraph)) < 0)
2305 +#else
2306 +  if ((result = m_dllAvFilter.avfilter_graph_create_filter(&m_pFilterOut, outFilter, "out", NULL, buffersink_params, m_pFilterGraph)) < 0)
2307 +#endif
2308    {
2309 +    m_dllAvUtil.av_freep(&buffersink_params);
2310      CLog::Log(LOGERROR, "CDVDVideoCodecFFmpeg::FilterOpen - avfilter_graph_create_filter: out");
2311      return result;
2312    }
2313 +  m_dllAvUtil.av_freep(&buffersink_params);
2314  
2315    if (!filters.empty())
2316    {
2317 @@ -794,6 +751,12 @@
2318  
2319  void CDVDVideoCodecFFmpeg::FilterClose()
2320  {
2321 +  if(m_pBufferRef)
2322 +  {
2323 +    m_dllAvFilter.avfilter_unref_buffer(m_pBufferRef);
2324 +    m_pBufferRef = NULL;
2325 +  }
2326 +
2327    if (m_pFilterGraph)
2328    {
2329      m_dllAvFilter.avfilter_graph_free(&m_pFilterGraph);
2330 @@ -801,7 +764,6 @@
2331      // Disposed by above code
2332      m_pFilterIn   = NULL;
2333      m_pFilterOut  = NULL;
2334 -    m_pFilterLink = NULL;
2335    }
2336  }
2337  
2338 @@ -809,48 +771,41 @@
2339  {
2340    int result, frames;
2341  
2342 -  m_pFilterLink = m_pFilterOut->inputs[0];
2343 -
2344    if (frame)
2345    {
2346 -#if LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,13,0)
2347 +#if LIBAVFILTER_VERSION_INT < AV_VERSION_INT(3,0,0)
2348      result = m_dllAvFilter.av_vsrc_buffer_add_frame(m_pFilterIn, frame, 0);
2349 -#elif LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(2,7,0)
2350 -    result = m_dllAvFilter.av_vsrc_buffer_add_frame(m_pFilterIn, frame);
2351 -#elif LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(53,3,0)
2352 -    result = m_dllAvFilter.av_vsrc_buffer_add_frame(m_pFilterIn, frame, frame->pts);
2353  #else
2354 -    result = m_dllAvFilter.av_vsrc_buffer_add_frame(m_pFilterIn, frame, frame->pts, m_pCodecContext->sample_aspect_ratio);
2355 +    result = m_dllAvFilter.av_buffersrc_add_frame(m_pFilterIn, frame, 0);
2356  #endif
2357 -
2358      if (result < 0)
2359      {
2360 +#if LIBAVFILTER_VERSION_INT < AV_VERSION_INT(3,0,0)
2361        CLog::Log(LOGERROR, "CDVDVideoCodecFFmpeg::FilterProcess - av_vsrc_buffer_add_frame");
2362 +#else
2363 +      CLog::Log(LOGERROR, "CDVDVideoCodecFFmpeg::FilterProcess - av_buffersrc_add_frame");
2364 +#endif
2365        return VC_ERROR;
2366      }
2367    }
2368  
2369 -  if ((frames = m_dllAvFilter.avfilter_poll_frame(m_pFilterLink)) < 0)
2370 +  if(m_pBufferRef)
2371 +  {
2372 +    m_dllAvFilter.avfilter_unref_buffer(m_pBufferRef);
2373 +    m_pBufferRef = NULL;
2374 +  }
2375 +
2376 +  if ((frames = m_dllAvFilter.av_buffersink_poll_frame(m_pFilterOut)) < 0)
2377    {
2378 -    CLog::Log(LOGERROR, "CDVDVideoCodecFFmpeg::FilterProcess - avfilter_poll_frame");
2379 +    CLog::Log(LOGERROR, "CDVDVideoCodecFFmpeg::FilterProcess - av_buffersink_poll_frame");
2380      return VC_ERROR;
2381    }
2382  
2383    if (frames > 0)
2384    {
2385 -    if (m_pFilterLink->cur_buf)
2386 -    {
2387 -      m_dllAvFilter.avfilter_unref_buffer(m_pFilterLink->cur_buf);
2388 -      m_pFilterLink->cur_buf = NULL;
2389 -    }
2390 -
2391 -    if ((result = m_dllAvFilter.avfilter_request_frame(m_pFilterLink)) < 0)
2392 -    {
2393 -      CLog::Log(LOGERROR, "CDVDVideoCodecFFmpeg::FilterProcess - avfilter_request_frame");
2394 -      return VC_ERROR;
2395 -    }
2396  
2397 -    if (!m_pFilterLink->cur_buf)
2398 +    result = m_dllAvFilter.av_buffersink_get_buffer_ref(m_pFilterOut, &m_pBufferRef, 0);
2399 +    if(!m_pBufferRef)
2400      {
2401        CLog::Log(LOGERROR, "CDVDVideoCodecFFmpeg::FilterProcess - cur_buf");
2402        return VC_ERROR;
2403 @@ -861,11 +816,11 @@
2404      else
2405        m_pFrame->repeat_pict      = -(frames - 1);
2406  
2407 -    m_pFrame->interlaced_frame = m_pFilterLink->cur_buf->video->interlaced;
2408 -    m_pFrame->top_field_first  = m_pFilterLink->cur_buf->video->top_field_first;
2409 +    m_pFrame->interlaced_frame = m_pBufferRef->video->interlaced;
2410 +    m_pFrame->top_field_first  = m_pBufferRef->video->top_field_first;
2411  
2412 -    memcpy(m_pFrame->linesize, m_pFilterLink->cur_buf->linesize, 4*sizeof(int));
2413 -    memcpy(m_pFrame->data    , m_pFilterLink->cur_buf->data    , 4*sizeof(uint8_t*));
2414 +    memcpy(m_pFrame->linesize, m_pBufferRef->linesize, 4*sizeof(int));
2415 +    memcpy(m_pFrame->data    , m_pBufferRef->data    , 4*sizeof(uint8_t*));
2416  
2417      if(frames > 1)
2418        return VC_PICTURE;
2419 diff -urN xbmc-11.0/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.h xbmc-11.0-ffmpeg-1.0/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.h
2420 --- xbmc-11.0/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.h        2012-03-21 23:07:50.000000000 +0100
2421 +++ xbmc-11.0-ffmpeg-1.0/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.h     2012-11-08 23:16:03.533072250 +0100
2422 @@ -75,20 +75,19 @@
2423  protected:
2424    static enum PixelFormat GetFormat(struct AVCodecContext * avctx, const PixelFormat * fmt);
2425  
2426 -  int  FilterOpen(const CStdString& filters);
2427 +  int  FilterOpen(const CStdString& filters, bool scale);
2428    void FilterClose();
2429    int  FilterProcess(AVFrame* frame);
2430  
2431    AVFrame* m_pFrame;
2432    AVCodecContext* m_pCodecContext;
2433  
2434 -  AVPicture* m_pConvertFrame;
2435    CStdString       m_filters;
2436    CStdString       m_filters_next;
2437    AVFilterGraph*   m_pFilterGraph;
2438    AVFilterContext* m_pFilterIn;
2439    AVFilterContext* m_pFilterOut;
2440 -  AVFilterLink*    m_pFilterLink;
2441 +  AVFilterBufferRef* m_pBufferRef;
2442  
2443    int m_iPictureWidth;
2444    int m_iPictureHeight;
2445 @@ -109,4 +108,5 @@
2446    int m_iLastKeyframe;
2447    double m_dts;
2448    bool   m_started;
2449 +  std::vector<PixelFormat> m_formats;
2450  };
2451 diff -urN xbmc-11.0/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecVDA.cpp xbmc-11.0-ffmpeg-1.0/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecVDA.cpp
2452 --- xbmc-11.0/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecVDA.cpp 2012-03-21 23:07:50.000000000 +0100
2453 +++ xbmc-11.0-ffmpeg-1.0/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecVDA.cpp      2012-11-08 23:16:03.533072250 +0100
2454 @@ -525,8 +525,8 @@
2455    {
2456      while (!*(nal_start++));
2457      nal_end = avc_find_startcode(nal_start, end);
2458 -    av_format_ctx->put_be32(pb, nal_end - nal_start);
2459 -    av_format_ctx->put_buffer(pb, nal_start, nal_end - nal_start);
2460 +    av_format_ctx->avio_wb32(pb, nal_end - nal_start);
2461 +    av_format_ctx->avio_write(pb, nal_start, nal_end - nal_start);
2462      size += 4 + nal_end - nal_start;
2463      nal_start = nal_end;
2464    }
2465 @@ -537,14 +537,14 @@
2466    const uint8_t *buf_in, uint8_t **buf, int *size)
2467  {
2468    ByteIOContext *pb;
2469 -  int ret = av_format_ctx->url_open_dyn_buf(&pb);
2470 +  int ret = av_format_ctx->avio_open_dyn_buf(&pb);
2471    if (ret < 0)
2472      return ret;
2473  
2474    avc_parse_nal_units(av_format_ctx, pb, buf_in, *size);
2475  
2476    av_util_ctx->av_freep(buf);
2477 -  *size = av_format_ctx->url_close_dyn_buf(pb, buf);
2478 +  *size = av_format_ctx->avio_close_dyn_buf(pb, buf);
2479    return 0;
2480  }
2481  
2482 @@ -590,26 +590,26 @@
2483        }
2484        assert(sps);
2485  
2486 -      av_format_ctx->put_byte(pb, 1); /* version */
2487 -      av_format_ctx->put_byte(pb, sps[1]); /* profile */
2488 -      av_format_ctx->put_byte(pb, sps[2]); /* profile compat */
2489 -      av_format_ctx->put_byte(pb, sps[3]); /* level */
2490 -      av_format_ctx->put_byte(pb, 0xff); /* 6 bits reserved (111111) + 2 bits nal size length - 1 (11) */
2491 -      av_format_ctx->put_byte(pb, 0xe1); /* 3 bits reserved (111) + 5 bits number of sps (00001) */
2492 +      av_format_ctx->avio_w8(pb, 1); /* version */
2493 +      av_format_ctx->avio_w8(pb, sps[1]); /* profile */
2494 +      av_format_ctx->avio_w8(pb, sps[2]); /* profile compat */
2495 +      av_format_ctx->avio_w8(pb, sps[3]); /* level */
2496 +      av_format_ctx->avio_w8(pb, 0xff); /* 6 bits reserved (111111) + 2 bits nal size length - 1 (11) */
2497 +      av_format_ctx->avio_w8(pb, 0xe1); /* 3 bits reserved (111) + 5 bits number of sps (00001) */
2498  
2499 -      av_format_ctx->put_be16(pb, sps_size);
2500 -      av_format_ctx->put_buffer(pb, sps, sps_size);
2501 +      av_format_ctx->avio_wb16(pb, sps_size);
2502 +      av_format_ctx->avio_write(pb, sps, sps_size);
2503        if (pps)
2504        {
2505 -        av_format_ctx->put_byte(pb, 1); /* number of pps */
2506 -        av_format_ctx->put_be16(pb, pps_size);
2507 -        av_format_ctx->put_buffer(pb, pps, pps_size);
2508 +        av_format_ctx->avio_w8(pb, 1); /* number of pps */
2509 +        av_format_ctx->avio_wb16(pb, pps_size);
2510 +        av_format_ctx->avio_write(pb, pps, pps_size);
2511        }
2512        av_util_ctx->av_free(start);
2513      }
2514      else
2515      {
2516 -      av_format_ctx->put_buffer(pb, data, len);
2517 +      av_format_ctx->avio_write(pb, data, len);
2518      }
2519    }
2520    return 0;
2521 @@ -706,7 +706,7 @@
2522              }
2523  
2524              ByteIOContext *pb;
2525 -            if (m_dllAvFormat->url_open_dyn_buf(&pb) < 0)
2526 +            if (m_dllAvFormat->avio_open_dyn_buf(&pb) < 0)
2527              {
2528                return false;
2529              }
2530 @@ -717,7 +717,7 @@
2531              // unhook from ffmpeg's extradata
2532              extradata = NULL;
2533              // extract the avcC atom data into extradata then write it into avcCData for VDADecoder
2534 -            extrasize = m_dllAvFormat->url_close_dyn_buf(pb, &extradata);
2535 +            extrasize = m_dllAvFormat->avio_close_dyn_buf(pb, &extradata);
2536              // CFDataCreate makes a copy of extradata contents
2537              avcCData = CFDataCreate(kCFAllocatorDefault, (const uint8_t*)extradata, extrasize);
2538              // done with the converted extradata, we MUST free using av_free
2539 @@ -948,12 +948,12 @@
2540        int demuxer_bytes;
2541        uint8_t *demuxer_content;
2542  
2543 -      if(m_dllAvFormat->url_open_dyn_buf(&pb) < 0)
2544 +      if(m_dllAvFormat->avio_open_dyn_buf(&pb) < 0)
2545        {
2546          return VC_ERROR;
2547        }
2548        demuxer_bytes = avc_parse_nal_units(m_dllAvFormat, pb, pData, iSize);
2549 -      demuxer_bytes = m_dllAvFormat->url_close_dyn_buf(pb, &demuxer_content);
2550 +      demuxer_bytes = m_dllAvFormat->avio_close_dyn_buf(pb, &demuxer_content);
2551        avc_demux = CFDataCreate(kCFAllocatorDefault, demuxer_content, demuxer_bytes);
2552        m_dllAvUtil->av_free(demuxer_content);
2553      }
2554 @@ -961,7 +961,7 @@
2555      {
2556        // convert demuxer packet from 3 byte NAL sizes to 4 byte
2557        ByteIOContext *pb;
2558 -      if (m_dllAvFormat->url_open_dyn_buf(&pb) < 0)
2559 +      if (m_dllAvFormat->avio_open_dyn_buf(&pb) < 0)
2560          return VC_ERROR;
2561  
2562        uint32_t nal_size;
2563 @@ -970,14 +970,14 @@
2564        while (nal_start < end)
2565        {
2566          nal_size = VDA_RB24(nal_start);
2567 -        m_dllAvFormat->put_be32(pb, nal_size);
2568 +        m_dllAvFormat->avio_wb32(pb, nal_size);
2569          nal_start += 3;
2570 -        m_dllAvFormat->put_buffer(pb, nal_start, nal_size);
2571 +        m_dllAvFormat->avio_write(pb, nal_start, nal_size);
2572          nal_start += nal_size;
2573        }
2574  
2575        uint8_t *demuxer_content;
2576 -      int demuxer_bytes = m_dllAvFormat->url_close_dyn_buf(pb, &demuxer_content);
2577 +      int demuxer_bytes = m_dllAvFormat->avio_close_dyn_buf(pb, &demuxer_content);
2578        avc_demux = CFDataCreate(kCFAllocatorDefault, demuxer_content, demuxer_bytes);
2579        m_dllAvUtil->av_free(demuxer_content);
2580      }
2581 diff -urN xbmc-11.0/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecVideoToolBox.cpp xbmc-11.0-ffmpeg-1.0/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecVideoToolBox.cpp
2582 --- xbmc-11.0/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecVideoToolBox.cpp        2012-03-21 23:07:50.000000000 +0100
2583 +++ xbmc-11.0-ffmpeg-1.0/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecVideoToolBox.cpp     2012-11-08 23:16:03.533072250 +0100
2584 @@ -474,7 +474,7 @@
2585      {
2586        b |= 0x80;
2587      }
2588 -    av_format_ctx->put_byte(pb, b);
2589 +    av_format_ctx->avio_w8(pb, b);
2590    }
2591  
2592    return numBytes; 
2593 @@ -482,37 +482,37 @@
2594  
2595  void quicktime_write_esds(DllAvFormat *av_format_ctx, ByteIOContext *pb, quicktime_esds_t *esds)
2596  {
2597 -  av_format_ctx->put_byte(pb, 0);     // Version
2598 -  av_format_ctx->put_be24(pb, 0);     // Flags
2599 +  av_format_ctx->avio_w8(pb, 0);     // Version
2600 +  av_format_ctx->avio_wb24(pb, 0);     // Flags
2601  
2602    // elementary stream descriptor tag
2603 -  av_format_ctx->put_byte(pb, 0x03);
2604 +  av_format_ctx->avio_w8(pb, 0x03);
2605    quicktime_write_mp4_descr_length(av_format_ctx, pb,
2606      3 + 5 + (13 + 5 + esds->decoderConfigLen) + 3, false);
2607    // 3 bytes + 5 bytes for tag
2608 -  av_format_ctx->put_be16(pb, esds->esid);
2609 -  av_format_ctx->put_byte(pb, esds->stream_priority);
2610 +  av_format_ctx->avio_wb16(pb, esds->esid);
2611 +  av_format_ctx->avio_w8(pb, esds->stream_priority);
2612  
2613    // decoder configuration description tag
2614 -  av_format_ctx->put_byte(pb, 0x04);
2615 +  av_format_ctx->avio_w8(pb, 0x04);
2616    quicktime_write_mp4_descr_length(av_format_ctx, pb,
2617      13 + 5 + esds->decoderConfigLen, false);
2618    // 13 bytes + 5 bytes for tag
2619 -  av_format_ctx->put_byte(pb, esds->objectTypeId); // objectTypeIndication
2620 -  av_format_ctx->put_byte(pb, esds->streamType);   // streamType
2621 -  av_format_ctx->put_be24(pb, esds->bufferSizeDB); // buffer size
2622 -  av_format_ctx->put_be32(pb, esds->maxBitrate);   // max bitrate
2623 -  av_format_ctx->put_be32(pb, esds->avgBitrate);   // average bitrate
2624 +  av_format_ctx->avio_w8(pb, esds->objectTypeId); // objectTypeIndication
2625 +  av_format_ctx->avio_w8(pb, esds->streamType);   // streamType
2626 +  av_format_ctx->avio_wb24(pb, esds->bufferSizeDB); // buffer size
2627 +  av_format_ctx->avio_wb32(pb, esds->maxBitrate);   // max bitrate
2628 +  av_format_ctx->avio_wb32(pb, esds->avgBitrate);   // average bitrate
2629  
2630    // decoder specific description tag
2631 -  av_format_ctx->put_byte(pb, 0x05);
2632 +  av_format_ctx->avio_w8(pb, 0x05);
2633    quicktime_write_mp4_descr_length(av_format_ctx, pb, esds->decoderConfigLen, false);
2634 -  av_format_ctx->put_buffer(pb, esds->decoderConfig, esds->decoderConfigLen);
2635 +  av_format_ctx->avio_write(pb, esds->decoderConfig, esds->decoderConfigLen);
2636  
2637    // sync layer configuration descriptor tag
2638 -  av_format_ctx->put_byte(pb, 0x06);  // tag
2639 -  av_format_ctx->put_byte(pb, 0x01);  // length
2640 -  av_format_ctx->put_byte(pb, 0x7F);  // no SL
2641 +  av_format_ctx->avio_w8(pb, 0x06);  // tag
2642 +  av_format_ctx->avio_w8(pb, 0x01);  // length
2643 +  av_format_ctx->avio_w8(pb, 0x7F);  // no SL
2644  
2645    /* no IPI_DescrPointer */
2646         /* no IP_IdentificationDataSet */
2647 @@ -666,8 +666,8 @@
2648    {
2649      while (!*(nal_start++));
2650      nal_end = avc_find_startcode(nal_start, end);
2651 -    av_format_ctx->put_be32(pb, nal_end - nal_start);
2652 -    av_format_ctx->put_buffer(pb, nal_start, nal_end - nal_start);
2653 +    av_format_ctx->avio_wb32(pb, nal_end - nal_start);
2654 +    av_format_ctx->avio_write(pb, nal_start, nal_end - nal_start);
2655      size += 4 + nal_end - nal_start;
2656      nal_start = nal_end;
2657    }
2658 @@ -678,14 +678,14 @@
2659    const uint8_t *buf_in, uint8_t **buf, int *size)
2660  {
2661    ByteIOContext *pb;
2662 -  int ret = av_format_ctx->url_open_dyn_buf(&pb);
2663 +  int ret = av_format_ctx->avio_open_dyn_buf(&pb);
2664    if (ret < 0)
2665      return ret;
2666  
2667    avc_parse_nal_units(av_format_ctx, pb, buf_in, *size);
2668  
2669    av_util_ctx->av_freep(buf);
2670 -  *size = av_format_ctx->url_close_dyn_buf(pb, buf);
2671 +  *size = av_format_ctx->avio_close_dyn_buf(pb, buf);
2672    return 0;
2673  }
2674  
2675 @@ -770,26 +770,26 @@
2676        }
2677        assert(sps);
2678  
2679 -      av_format_ctx->put_byte(pb, 1); /* version */
2680 -      av_format_ctx->put_byte(pb, sps[1]); /* profile */
2681 -      av_format_ctx->put_byte(pb, sps[2]); /* profile compat */
2682 -      av_format_ctx->put_byte(pb, sps[3]); /* level */
2683 -      av_format_ctx->put_byte(pb, 0xff); /* 6 bits reserved (111111) + 2 bits nal size length - 1 (11) */
2684 -      av_format_ctx->put_byte(pb, 0xe1); /* 3 bits reserved (111) + 5 bits number of sps (00001) */
2685 +      av_format_ctx->avio_w8(pb, 1); /* version */
2686 +      av_format_ctx->avio_w8(pb, sps[1]); /* profile */
2687 +      av_format_ctx->avio_w8(pb, sps[2]); /* profile compat */
2688 +      av_format_ctx->avio_w8(pb, sps[3]); /* level */
2689 +      av_format_ctx->avio_w8(pb, 0xff); /* 6 bits reserved (111111) + 2 bits nal size length - 1 (11) */
2690 +      av_format_ctx->avio_w8(pb, 0xe1); /* 3 bits reserved (111) + 5 bits number of sps (00001) */
2691  
2692 -      av_format_ctx->put_be16(pb, sps_size);
2693 -      av_format_ctx->put_buffer(pb, sps, sps_size);
2694 +      av_format_ctx->avio_wb16(pb, sps_size);
2695 +      av_format_ctx->avio_write(pb, sps, sps_size);
2696        if (pps)
2697        {
2698 -        av_format_ctx->put_byte(pb, 1); /* number of pps */
2699 -        av_format_ctx->put_be16(pb, pps_size);
2700 -        av_format_ctx->put_buffer(pb, pps, pps_size);
2701 +        av_format_ctx->avio_w8(pb, 1); /* number of pps */
2702 +        av_format_ctx->avio_wb16(pb, pps_size);
2703 +        av_format_ctx->avio_write(pb, pps, pps_size);
2704        }
2705        av_util_ctx->av_free(start);
2706      }
2707      else
2708      {
2709 -      av_format_ctx->put_buffer(pb, data, len);
2710 +      av_format_ctx->avio_write(pb, data, len);
2711      }
2712    }
2713    return 0;
2714 @@ -1086,7 +1086,7 @@
2715            ByteIOContext *pb;
2716            quicktime_esds_t *esds;
2717  
2718 -          if (m_dllAvFormat->url_open_dyn_buf(&pb) < 0)
2719 +          if (m_dllAvFormat->avio_open_dyn_buf(&pb) < 0)
2720              return false;
2721  
2722            esds = quicktime_set_esds(m_dllAvFormat, extradata, extrasize);
2723 @@ -1095,7 +1095,7 @@
2724            // unhook from ffmpeg's extradata
2725            extradata = NULL;
2726            // extract the esds atom decoderConfig from extradata
2727 -          extrasize = m_dllAvFormat->url_close_dyn_buf(pb, &extradata);
2728 +          extrasize = m_dllAvFormat->avio_close_dyn_buf(pb, &extradata);
2729            free(esds->decoderConfig);
2730            free(esds);
2731  
2732 @@ -1152,7 +1152,7 @@
2733              // NAL reformating to bitstream format required
2734  
2735              ByteIOContext *pb;
2736 -            if (m_dllAvFormat->url_open_dyn_buf(&pb) < 0)
2737 +            if (m_dllAvFormat->avio_open_dyn_buf(&pb) < 0)
2738                return false;
2739  
2740              m_convert_bytestream = true;
2741 @@ -1161,7 +1161,7 @@
2742              // unhook from ffmpeg's extradata
2743              extradata = NULL;
2744              // extract the avcC atom data into extradata getting size into extrasize
2745 -            extrasize = m_dllAvFormat->url_close_dyn_buf(pb, &extradata);
2746 +            extrasize = m_dllAvFormat->avio_close_dyn_buf(pb, &extradata);
2747  
2748              // check for interlaced and get number of ref frames
2749              if (!validate_avcC_spc(extradata, extrasize, &m_max_ref_frames))
2750 @@ -1301,17 +1301,17 @@
2751      if (m_convert_bytestream)
2752      {
2753        // convert demuxer packet from bytestream (AnnexB) to bitstream
2754 -      if(m_dllAvFormat->url_open_dyn_buf(&pb) < 0)
2755 +      if(m_dllAvFormat->avio_open_dyn_buf(&pb) < 0)
2756          return VC_ERROR;
2757  
2758        demux_size = avc_parse_nal_units(m_dllAvFormat, pb, pData, iSize);
2759 -      demux_size = m_dllAvFormat->url_close_dyn_buf(pb, &demux_buff);
2760 +      demux_size = m_dllAvFormat->avio_close_dyn_buf(pb, &demux_buff);
2761        sampleBuff = CreateSampleBufferFrom(m_fmt_desc, demux_buff, demux_size);
2762      }
2763      else if (m_convert_3byteTo4byteNALSize)
2764      {
2765        // convert demuxer packet from 3 byte NAL sizes to 4 byte
2766 -      if (m_dllAvFormat->url_open_dyn_buf(&pb) < 0)
2767 +      if (m_dllAvFormat->avio_open_dyn_buf(&pb) < 0)
2768          return VC_ERROR;
2769  
2770        uint32_t nal_size;
2771 @@ -1320,13 +1320,13 @@
2772        while (nal_start < end)
2773        {
2774          nal_size = VDA_RB24(nal_start);
2775 -        m_dllAvFormat->put_be32(pb, nal_size);
2776 +        m_dllAvFormat->avio_wb32(pb, nal_size);
2777          nal_start += 3;
2778 -        m_dllAvFormat->put_buffer(pb, nal_start, nal_size);
2779 +        m_dllAvFormat->avio_write(pb, nal_start, nal_size);
2780          nal_start += nal_size;
2781        }
2782  
2783 -      demux_size = m_dllAvFormat->url_close_dyn_buf(pb, &demux_buff);
2784 +      demux_size = m_dllAvFormat->avio_close_dyn_buf(pb, &demux_buff);
2785        sampleBuff = CreateSampleBufferFrom(m_fmt_desc, demux_buff, demux_size);
2786      }
2787      else
2788 diff -urN xbmc-11.0/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp xbmc-11.0-ffmpeg-1.0/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp
2789 --- xbmc-11.0/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp    2012-03-21 23:07:50.000000000 +0100
2790 +++ xbmc-11.0-ffmpeg-1.0/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp 2012-11-08 23:16:03.533072250 +0100
2791 @@ -223,7 +223,6 @@
2792    }
2793  
2794    pic->type           = FF_BUFFER_TYPE_USER;
2795 -  pic->age            = 1;
2796    pic->data[0]        = (uint8_t*)wrapper;
2797    pic->data[1]        = NULL;
2798    pic->data[2]        = NULL;
2799 diff -urN xbmc-11.0/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp xbmc-11.0-ffmpeg-1.0/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp
2800 --- xbmc-11.0/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp    2012-03-21 23:07:50.000000000 +0100
2801 +++ xbmc-11.0-ffmpeg-1.0/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp 2012-11-08 23:16:03.533072250 +0100
2802 @@ -1197,14 +1197,12 @@
2803  
2804    if(pic->reference)
2805    {
2806 -    pic->age = pA->ip_age[0];
2807      pA->ip_age[0]= pA->ip_age[1]+1;
2808      pA->ip_age[1]= 1;
2809      pA->b_age++;
2810    }
2811    else
2812    {
2813 -    pic->age = pA->b_age;
2814      pA->ip_age[0]++;
2815      pA->ip_age[1]++;
2816      pA->b_age = 1;
2817 diff -urN xbmc-11.0/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp xbmc-11.0-ffmpeg-1.0/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp
2818 --- xbmc-11.0/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp       2012-03-21 23:07:50.000000000 +0100
2819 +++ xbmc-11.0-ffmpeg-1.0/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.cpp    2012-11-08 23:16:03.533072250 +0100
2820 @@ -160,7 +160,7 @@
2821  #define g_demuxer (*((CDVDDemuxFFmpeg**)g_tls.Get()))
2822  #endif
2823  
2824 -static int interrupt_cb(void)
2825 +static int interrupt_cb(void* unused)
2826  {
2827    if(g_demuxer && g_demuxer->Aborted())
2828      return 1;
2829 @@ -178,7 +178,7 @@
2830  
2831  static int dvd_file_read(void *h, uint8_t* buf, int size)
2832  {
2833 -  if(interrupt_cb())
2834 +  if(interrupt_cb(NULL))
2835      return -1;
2836  
2837    CDVDInputStream* pInputStream = (CDVDInputStream*)h;
2838 @@ -192,7 +192,7 @@
2839  */
2840  static offset_t dvd_file_seek(void *h, offset_t pos, int whence)
2841  {
2842 -  if(interrupt_cb())
2843 +  if(interrupt_cb(NULL))
2844      return -1;
2845  
2846    CDVDInputStream* pInputStream = (CDVDInputStream*)h;
2847 @@ -236,6 +236,7 @@
2848    m_speed = DVD_PLAYSPEED_NORMAL;
2849    g_demuxer = this;
2850    m_program = UINT_MAX;
2851 +  const AVIOInterruptCB int_cb = { interrupt_cb, NULL };
2852  
2853    if (!pInput) return false;
2854  
2855 @@ -246,10 +247,6 @@
2856  
2857    // register codecs
2858    m_dllAvFormat.av_register_all();
2859 -  m_dllAvFormat.url_set_interrupt_cb(interrupt_cb);
2860 -
2861 -  // could be used for interupting ffmpeg while opening a file (eg internet streams)
2862 -  // url_set_interrupt_cb(NULL);
2863  
2864    m_pInput = pInput;
2865    strFile = m_pInput->GetFileName();
2866 @@ -284,14 +281,14 @@
2867        // try mmsh, then mmst
2868        CStdString strFile2;
2869        strFile2.Format("mmsh://%s",strFile.substr(6,strFile.size()-6).c_str());
2870 -      result = m_dllAvFormat.av_open_input_file(&m_pFormatContext, strFile2.c_str(), iformat, FFMPEG_FILE_BUFFER_SIZE, NULL);
2871 +      result = m_dllAvFormat.avformat_open_input(&m_pFormatContext, strFile2.c_str(), iformat, NULL);
2872        if (result < 0)
2873        {
2874          strFile = "mmst://";
2875          strFile += strFile2.Mid(7).c_str();
2876        } 
2877      }
2878 -    if (result < 0 && m_dllAvFormat.av_open_input_file(&m_pFormatContext, strFile.c_str(), iformat, FFMPEG_FILE_BUFFER_SIZE, NULL) < 0 )
2879 +    if (result < 0 && m_dllAvFormat.avformat_open_input(&m_pFormatContext, strFile.c_str(), iformat, NULL) < 0 )
2880      {
2881        CLog::Log(LOGDEBUG, "Error, could not open file %s", strFile.c_str());
2882        Dispose();
2883 @@ -301,24 +298,16 @@
2884    else
2885    {
2886      unsigned char* buffer = (unsigned char*)m_dllAvUtil.av_malloc(FFMPEG_FILE_BUFFER_SIZE);
2887 -    m_ioContext = m_dllAvFormat.av_alloc_put_byte(buffer, FFMPEG_FILE_BUFFER_SIZE, 0, m_pInput, dvd_file_read, NULL, dvd_file_seek);
2888 +    m_ioContext = m_dllAvFormat.avio_alloc_context(buffer, FFMPEG_FILE_BUFFER_SIZE, 0, m_pInput, dvd_file_read, NULL, dvd_file_seek);
2889      m_ioContext->max_packet_size = m_pInput->GetBlockSize();
2890      if(m_ioContext->max_packet_size)
2891        m_ioContext->max_packet_size *= FFMPEG_FILE_BUFFER_SIZE / m_ioContext->max_packet_size;
2892  
2893      if(m_pInput->Seek(0, SEEK_POSSIBLE) == 0)
2894 -      m_ioContext->is_streamed = 1;
2895 +      m_ioContext->seekable = 0;
2896  
2897      if( iformat == NULL )
2898      {
2899 -#if defined(USE_EXTERNAL_FFMPEG) && LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(52,98,0)
2900 -      // API added on: 2011-02-09
2901 -      // Old versions of ffmpeg do not have av_probe_input_format, so we need
2902 -      // to always probe using the lower-level functions as well.
2903 -      const bool legacyProbing = true;
2904 -#else
2905 -      const bool legacyProbing = false;
2906 -#endif
2907        // let ffmpeg decide which demuxer we have to open
2908  
2909        bool trySPDIFonly = (m_pInput->GetContent() == "audio/x-spdif-compressed");
2910 @@ -331,7 +320,7 @@
2911        // want to probe for spdif (DTS or IEC 61937) compressed audio
2912        // specifically, or in case the file is a wav which may contain DTS or
2913        // IEC 61937 (e.g. ac3-in-wav) and we want to check for those formats.
2914 -      if (legacyProbing || trySPDIFonly || (iformat && strcmp(iformat->name, "wav") == 0))
2915 +      if (trySPDIFonly || (iformat && strcmp(iformat->name, "wav") == 0))
2916        {
2917          AVProbeData pd;
2918          BYTE probe_buffer[FFMPEG_FILE_BUFFER_SIZE + AVPROBE_PADDING_SIZE];
2919 @@ -341,7 +330,7 @@
2920          pd.filename = strFile.c_str();
2921  
2922          // read data using avformat's buffers
2923 -        pd.buf_size = m_dllAvFormat.get_buffer(m_ioContext, pd.buf, m_ioContext->max_packet_size ? m_ioContext->max_packet_size : m_ioContext->buffer_size);
2924 +        pd.buf_size = m_dllAvFormat.avio_read(m_ioContext, pd.buf, m_ioContext->max_packet_size ? m_ioContext->max_packet_size : m_ioContext->buffer_size);
2925          if (pd.buf_size <= 0)
2926          {
2927            CLog::Log(LOGERROR, "%s - error reading from input stream, %s", __FUNCTION__, strFile.c_str());
2928 @@ -350,10 +339,7 @@
2929          memset(pd.buf+pd.buf_size, 0, AVPROBE_PADDING_SIZE);
2930  
2931          // restore position again
2932 -        m_dllAvFormat.url_fseek(m_ioContext , 0, SEEK_SET);
2933 -
2934 -        if (legacyProbing && !trySPDIFonly)
2935 -          iformat = m_dllAvFormat.av_probe_input_format(&pd, 1);
2936 +        m_dllAvFormat.avio_seek(m_ioContext , 0, SEEK_SET);
2937  
2938          // the advancedsetting is for allowing the user to force outputting the
2939          // 44.1 kHz DTS wav file as PCM, so that an A/V receiver can decode
2940 @@ -424,7 +410,10 @@
2941  
2942  
2943      // open the demuxer
2944 -    if (m_dllAvFormat.av_open_input_stream(&m_pFormatContext, m_ioContext, strFile.c_str(), iformat, NULL) < 0)
2945 +    m_pFormatContext     = m_dllAvFormat.avformat_alloc_context();
2946 +    m_pFormatContext->pb = m_ioContext;
2947 +
2948 +    if (m_dllAvFormat.avformat_open_input(&m_pFormatContext, strFile.c_str(), iformat, NULL) < 0)
2949      {
2950        CLog::Log(LOGERROR, "%s - Error, could not open file %s", __FUNCTION__, strFile.c_str());
2951        Dispose();
2952 @@ -432,8 +421,11 @@
2953      }
2954    }
2955  
2956 +  // set the interrupt callback, appeared in libavformat 53.15.0
2957 +  m_pFormatContext->interrupt_callback = int_cb;
2958 +
2959    // analyse very short to speed up mjpeg playback start
2960 -  if (iformat && (strcmp(iformat->name, "mjpeg") == 0) && m_ioContext->is_streamed)
2961 +  if (iformat && (strcmp(iformat->name, "mjpeg") == 0) && m_ioContext->seekable == 0)
2962      m_pFormatContext->max_analyze_duration = 500000;
2963  
2964    // we need to know if this is matroska or avi later
2965 @@ -447,8 +439,8 @@
2966        m_pFormatContext->max_analyze_duration = 500000;
2967  
2968  
2969 -    CLog::Log(LOGDEBUG, "%s - av_find_stream_info starting", __FUNCTION__);
2970 -    int iErr = m_dllAvFormat.av_find_stream_info(m_pFormatContext);
2971 +    CLog::Log(LOGDEBUG, "%s - avformat_find_stream_info starting", __FUNCTION__);
2972 +    int iErr = m_dllAvFormat.avformat_find_stream_info(m_pFormatContext, NULL);
2973      if (iErr < 0)
2974      {
2975        CLog::Log(LOGWARNING,"could not find codec parameters for %s", strFile.c_str());
2976 @@ -471,7 +463,7 @@
2977    m_pFormatContext->flags |= AVFMT_FLAG_NONBLOCK;
2978  
2979    // print some extra information
2980 -  m_dllAvFormat.dump_format(m_pFormatContext, 0, strFile.c_str(), 0);
2981 +  m_dllAvFormat.av_dump_format(m_pFormatContext, 0, strFile.c_str(), 0);
2982  
2983    UpdateCurrentPTS();
2984  
2985 @@ -510,20 +502,12 @@
2986  
2987    if (m_pFormatContext)
2988    {
2989 -    if (m_ioContext)
2990 +    if (m_ioContext && m_pFormatContext->pb && m_pFormatContext->pb != m_ioContext)
2991      {
2992 -      if(m_pFormatContext->pb && m_pFormatContext->pb != m_ioContext)
2993 -      {
2994 -        CLog::Log(LOGWARNING, "CDVDDemuxFFmpeg::Dispose - demuxer changed our byte context behind our back, possible memleak");
2995 -        m_ioContext = m_pFormatContext->pb;
2996 -      }
2997 -      m_dllAvFormat.av_close_input_stream(m_pFormatContext);
2998 -      if (m_ioContext->buffer)
2999 -        m_dllAvUtil.av_free(m_ioContext->buffer);
3000 -      m_dllAvUtil.av_free(m_ioContext);
3001 +      CLog::Log(LOGWARNING, "CDVDDemuxFFmpeg::Dispose - demuxer changed our byte context behind our back, possible memleak");
3002 +      m_ioContext = m_pFormatContext->pb;
3003      }
3004 -    else
3005 -      m_dllAvFormat.av_close_input_file(m_pFormatContext);
3006 +    m_dllAvFormat.avformat_close_input(&m_pFormatContext);
3007    }
3008    m_ioContext = NULL;
3009    m_pFormatContext = NULL;
3010 @@ -773,19 +757,12 @@
3011            {
3012              stream->duration = duration;
3013              duration = m_dllAvUtil.av_rescale_rnd(stream->duration, (int64_t)stream->time_base.num * AV_TIME_BASE, stream->time_base.den, AV_ROUND_NEAR_INF);
3014 -            if ((m_pFormatContext->duration == (int64_t)AV_NOPTS_VALUE && m_pFormatContext->file_size > 0)
3015 +            if ((m_pFormatContext->duration == (int64_t)AV_NOPTS_VALUE)
3016                  ||  (m_pFormatContext->duration != (int64_t)AV_NOPTS_VALUE && duration > m_pFormatContext->duration))
3017                m_pFormatContext->duration = duration;
3018            }
3019          }
3020  
3021 -        // check if stream seem to have grown since start
3022 -        if(m_pFormatContext->file_size > 0 && m_pFormatContext->pb)
3023 -        {
3024 -          if(m_pFormatContext->pb->pos > m_pFormatContext->file_size)
3025 -            m_pFormatContext->file_size = m_pFormatContext->pb->pos;
3026 -        }
3027 -
3028          pPacket->iStreamId = pkt.stream_index; // XXX just for now
3029        }
3030        m_dllAvCodec.av_free_packet(&pkt);
3031 @@ -923,19 +900,6 @@
3032    if (!m_pFormatContext)
3033      return 0;
3034  
3035 -  /* apperently ffmpeg messes up sometimes, so check for negative value too */
3036 -  if (m_pFormatContext->duration == (int64_t)AV_NOPTS_VALUE || m_pFormatContext->duration < 0LL)
3037 -  {
3038 -    // no duration is available for us
3039 -    // try to calculate it
3040 -    int iLength = 0;
3041 -    if (m_iCurrentPts != DVD_NOPTS_VALUE && m_pFormatContext->file_size > 0 && m_pFormatContext->pb && m_pFormatContext->pb->pos > 0)
3042 -    {
3043 -      iLength = (int)(((m_iCurrentPts * m_pFormatContext->file_size) / m_pFormatContext->pb->pos) / 1000) & 0xFFFFFFFF;
3044 -    }
3045 -    return iLength;
3046 -  }
3047 -
3048    return (int)(m_pFormatContext->duration / (AV_TIME_BASE / 1000));
3049  }
3050  
3051 @@ -987,8 +951,8 @@
3052          st->iBitRate = pStream->codec->bit_rate;
3053          st->iBitsPerSample = pStream->codec->bits_per_coded_sample;
3054         
3055 -        if(m_dllAvFormat.av_metadata_get(pStream->metadata, "title", NULL, 0))
3056 -          st->m_description = m_dllAvFormat.av_metadata_get(pStream->metadata, "title", NULL, 0)->value;
3057 +        if(m_dllAvUtil.av_dict_get(pStream->metadata, "title", NULL, 0))
3058 +          st->m_description = m_dllAvUtil.av_dict_get(pStream->metadata, "title", NULL, 0)->value;
3059  
3060          break;
3061        }
3062 @@ -1077,8 +1041,8 @@
3063            if(pStream->codec)
3064              st->identifier = pStream->codec->sub_id;
3065             
3066 -          if(m_dllAvFormat.av_metadata_get(pStream->metadata, "title", NULL, 0))
3067 -            st->m_description = m_dllAvFormat.av_metadata_get(pStream->metadata, "title", NULL, 0)->value;
3068 +          if(m_dllAvUtil.av_dict_get(pStream->metadata, "title", NULL, 0))
3069 +            st->m_description = m_dllAvUtil.av_dict_get(pStream->metadata, "title", NULL, 0)->value;
3070         
3071            break;
3072          }
3073 @@ -1089,7 +1053,7 @@
3074          {
3075            std::string fileName = "special://temp/fonts/";
3076            XFILE::CDirectory::Create(fileName);
3077 -          AVMetadataTag *nameTag = m_dllAvFormat.av_metadata_get(pStream->metadata, "filename", NULL, 0);
3078 +          AVDictionaryEntry *nameTag = m_dllAvUtil.av_dict_get(pStream->metadata, "filename", NULL, 0);
3079            if (!nameTag) {
3080              CLog::Log(LOGERROR, "%s: TTF attachment has no name", __FUNCTION__);
3081              break;
3082 @@ -1138,7 +1102,7 @@
3083      // API added on: 2010-10-15
3084      // (Note that while the function was available earlier, the generic
3085      // metadata tags were not populated by default)
3086 -    AVMetadataTag *langTag = m_dllAvFormat.av_metadata_get(pStream->metadata, "language", NULL, 0);
3087 +    AVDictionaryEntry *langTag = m_dllAvUtil.av_dict_get(pStream->metadata, "language", NULL, 0);
3088      if (langTag)
3089        strncpy(m_streams[iId]->language, langTag->value, 3);
3090  #else
3091 @@ -1248,7 +1212,7 @@
3092        // API added on: 2010-10-15
3093        // (Note that while the function was available earlier, the generic
3094        // metadata tags were not populated by default)
3095 -      AVMetadataTag *titleTag = m_dllAvFormat.av_metadata_get(m_pFormatContext->chapters[chapterIdx-1]->metadata,
3096 +      AVDictionaryEntry *titleTag = m_dllAvUtil.av_dict_get(m_pFormatContext->chapters[chapterIdx-1]->metadata,
3097                                                                "title", NULL, 0);
3098        if (titleTag)
3099          strChapterName = titleTag->value;
3100 diff -urN xbmc-11.0/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.h xbmc-11.0-ffmpeg-1.0/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.h
3101 --- xbmc-11.0/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.h 2012-03-21 23:07:50.000000000 +0100
3102 +++ xbmc-11.0-ffmpeg-1.0/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.h      2012-11-08 23:16:03.533072250 +0100
3103 @@ -128,7 +128,7 @@
3104    #define MAX_STREAMS 100
3105    CDemuxStream* m_streams[MAX_STREAMS]; // maximum number of streams that ffmpeg can handle
3106  
3107 -  ByteIOContext* m_ioContext;
3108 +  AVIOContext* m_ioContext;
3109  
3110    DllAvFormat m_dllAvFormat;
3111    DllAvCodec  m_dllAvCodec;
3112 diff -urN xbmc-11.0/xbmc/DllPaths_generated.h.in xbmc-11.0-ffmpeg-1.0/xbmc/DllPaths_generated.h.in
3113 --- xbmc-11.0/xbmc/DllPaths_generated.h.in      2012-03-21 23:07:50.000000000 +0100
3114 +++ xbmc-11.0-ffmpeg-1.0/xbmc/DllPaths_generated.h.in   2012-11-08 23:15:55.399739205 +0100
3115 @@ -74,13 +74,13 @@
3116  #define DLL_PATH_LIBMAD        "@MAD_SONAME@"
3117  
3118  /* ffmpeg */
3119 -#define DLL_PATH_LIBAVCODEC    "special://xbmcbin/system/players/dvdplayer/avcodec-52-@ARCH@.so"
3120 -#define DLL_PATH_LIBAVCORE     "special://xbmcbin/system/players/dvdplayer/avcore-0-@ARCH@.so"
3121 -#define DLL_PATH_LIBAVFORMAT   "special://xbmcbin/system/players/dvdplayer/avformat-52-@ARCH@.so"
3122 -#define DLL_PATH_LIBAVUTIL     "special://xbmcbin/system/players/dvdplayer/avutil-50-@ARCH@.so"
3123 -#define DLL_PATH_LIBPOSTPROC   "special://xbmcbin/system/players/dvdplayer/postproc-51-@ARCH@.so"
3124 -#define DLL_PATH_LIBSWSCALE    "special://xbmcbin/system/players/dvdplayer/swscale-0-@ARCH@.so"
3125 -#define DLL_PATH_LIBAVFILTER   "special://xbmcbin/system/players/dvdplayer/avfilter-1-@ARCH@.so"
3126 +#define DLL_PATH_LIBAVCODEC    "special://xbmcbin/system/players/dvdplayer/avcodec-53-@ARCH@.so"
3127 +#define DLL_PATH_LIBAVFORMAT   "special://xbmcbin/system/players/dvdplayer/avformat-53-@ARCH@.so"
3128 +#define DLL_PATH_LIBAVUTIL     "special://xbmcbin/system/players/dvdplayer/avutil-51-@ARCH@.so"
3129 +#define DLL_PATH_LIBPOSTPROC   "special://xbmcbin/system/players/dvdplayer/postproc-52-@ARCH@.so"
3130 +#define DLL_PATH_LIBSWSCALE    "special://xbmcbin/system/players/dvdplayer/swscale-2-@ARCH@.so"
3131 +#define DLL_PATH_LIBAVFILTER   "special://xbmcbin/system/players/dvdplayer/avfilter-2-@ARCH@.so"
3132 +#define DLL_PATH_LIBSWRESAMPLE "special://xbmcbin/system/players/dvdplayer/swresample-0-@ARCH@.so"
3133  
3134  /* cdrip */
3135  #if defined(_LINUX) && !defined(__APPLE__)
3136 diff -urN xbmc-11.0/xbmc/DllPaths_win32.h xbmc-11.0-ffmpeg-1.0/xbmc/DllPaths_win32.h
3137 --- xbmc-11.0/xbmc/DllPaths_win32.h     2012-03-21 23:07:50.000000000 +0100
3138 +++ xbmc-11.0-ffmpeg-1.0/xbmc/DllPaths_win32.h  2012-11-08 23:15:55.399739205 +0100
3139 @@ -58,13 +58,13 @@
3140  #define DLL_PATH_LIBRTMP       "special://xbmcbin/system/players/dvdplayer/librtmp.dll"
3141  
3142  /* ffmpeg */
3143 -#define DLL_PATH_LIBAVCODEC    "special://xbmcbin/system/players/dvdplayer/avcodec-52.dll"
3144 -#define DLL_PATH_LIBAVCORE     "special://xbmcbin/system/players/dvdplayer/avcore-0.dll"
3145 -#define DLL_PATH_LIBAVFORMAT   "special://xbmcbin/system/players/dvdplayer/avformat-52.dll"
3146 -#define DLL_PATH_LIBAVUTIL     "special://xbmcbin/system/players/dvdplayer/avutil-50.dll"
3147 -#define DLL_PATH_LIBAVFILTER   "special://xbmcbin/system/players/dvdplayer/avfilter-1.dll"
3148 -#define DLL_PATH_LIBPOSTPROC   "special://xbmcbin/system/players/dvdplayer/postproc-51.dll"
3149 -#define DLL_PATH_LIBSWSCALE    "special://xbmcbin/system/players/dvdplayer/swscale-0.dll"
3150 +#define DLL_PATH_LIBAVCODEC    "special://xbmcbin/system/players/dvdplayer/avcodec-53.dll"
3151 +#define DLL_PATH_LIBAVFORMAT   "special://xbmcbin/system/players/dvdplayer/avformat-53.dll"
3152 +#define DLL_PATH_LIBAVUTIL     "special://xbmcbin/system/players/dvdplayer/avutil-51.dll"
3153 +#define DLL_PATH_LIBAVFILTER   "special://xbmcbin/system/players/dvdplayer/avfilter-2.dll"
3154 +#define DLL_PATH_LIBPOSTPROC   "special://xbmcbin/system/players/dvdplayer/postproc-52.dll"
3155 +#define DLL_PATH_LIBSWSCALE    "special://xbmcbin/system/players/dvdplayer/swscale-2.dll"
3156 +#define DLL_PATH_LIBSWRESAMPLE "special://xbmcbin/system/players/dvdplayer/swresample-0.dll"
3157  
3158  /* cdrip */
3159  #define DLL_PATH_LAME_ENC      "special://xbmcbin/system/cdrip/lame_enc.dll"
This page took 0.274576 seconds and 3 git commands to generate.