1 |
diff --git a/xbmc/cores/dvdplayer/Codecs/DllAvCodec.h b/xbmc/cores/dvdplayer/Codecs/DllAvCodec.h |
2 |
index f286647..da28c05 100644 |
3 |
--- a/xbmc/cores/dvdplayer/Codecs/DllAvCodec.h |
4 |
+++ b/xbmc/cores/dvdplayer/Codecs/DllAvCodec.h |
5 |
@@ -96,9 +96,9 @@ public: |
6 |
virtual int avcodec_close_dont_call(AVCodecContext *avctx)=0; |
7 |
virtual AVFrame *avcodec_alloc_frame(void)=0; |
8 |
virtual int avpicture_fill(AVPicture *picture, uint8_t *ptr, PixelFormat pix_fmt, int width, int height)=0; |
9 |
- virtual int avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture, int *got_picture_ptr, uint8_t *buf, int buf_size)=0; |
10 |
- virtual int avcodec_decode_audio2(AVCodecContext *avctx, int16_t *samples, int *frame_size_ptr, uint8_t *buf, int buf_size)=0; |
11 |
- virtual int avcodec_decode_subtitle(AVCodecContext *avctx, AVSubtitle *sub, int *got_sub_ptr, const uint8_t *buf, int buf_size)=0; |
12 |
+ virtual int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture, int *got_picture_ptr, AVPacket *avpkt)=0; |
13 |
+ virtual int avcodec_decode_audio3(AVCodecContext *avctx, int16_t *samples, int *frame_size_ptr, AVPacket *avpkt)=0; |
14 |
+ virtual int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, int *got_sub_ptr, AVPacket *avpkt)=0; |
15 |
virtual int avcodec_encode_audio(AVCodecContext *avctx, uint8_t *buf, int buf_size, const short *samples)=0; |
16 |
virtual int avpicture_get_size(PixelFormat pix_fmt, int width, int height)=0; |
17 |
virtual AVCodecContext *avcodec_alloc_context(void)=0; |
18 |
@@ -164,9 +164,16 @@ public: |
19 |
} |
20 |
virtual AVFrame *avcodec_alloc_frame() { return ::avcodec_alloc_frame(); } |
21 |
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); } |
22 |
- virtual int avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture, int *got_picture_ptr, uint8_t *buf, int buf_size) { return ::avcodec_decode_video(avctx, picture, got_picture_ptr, buf, buf_size); } |
23 |
- virtual int avcodec_decode_audio2(AVCodecContext *avctx, int16_t *samples, int *frame_size_ptr, uint8_t *buf, int buf_size) { return ::avcodec_decode_audio2(avctx, samples, frame_size_ptr, buf, buf_size); } |
24 |
- virtual int avcodec_decode_subtitle(AVCodecContext *avctx, AVSubtitle *sub, int *got_sub_ptr, const uint8_t *buf, int buf_size) { return ::avcodec_decode_subtitle(avctx, sub, got_sub_ptr, buf, buf_size); } |
25 |
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(52,23,0) |
26 |
+ // API added on: 2009-04-07 |
27 |
+ 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); } |
28 |
+ 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); } |
29 |
+ 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); } |
30 |
+#else |
31 |
+ 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); } |
32 |
+ 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); } |
33 |
+ 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); } |
34 |
+#endif |
35 |
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); } |
36 |
virtual int avpicture_get_size(PixelFormat pix_fmt, int width, int height) { return ::avpicture_get_size(pix_fmt, width, height); } |
37 |
virtual AVCodecContext *avcodec_alloc_context() { return ::avcodec_alloc_context(); } |
38 |
@@ -221,9 +228,9 @@ class DllAvCodec : public DllDynamic, DllAvCodecInterface |
39 |
#ifndef _LINUX |
40 |
DEFINE_FUNC_ALIGNED1(void, __cdecl, avcodec_flush_buffers, AVCodecContext*) |
41 |
DEFINE_FUNC_ALIGNED2(int, __cdecl, avcodec_open_dont_call, AVCodecContext*, AVCodec *) |
42 |
- DEFINE_FUNC_ALIGNED5(int, __cdecl, avcodec_decode_video, AVCodecContext*, AVFrame*, int*, uint8_t*, int) |
43 |
- DEFINE_FUNC_ALIGNED5(int, __cdecl, avcodec_decode_audio2, AVCodecContext*, int16_t*, int*, uint8_t*, int) |
44 |
- DEFINE_FUNC_ALIGNED5(int, __cdecl, avcodec_decode_subtitle, AVCodecContext*, AVSubtitle*, int*, const uint8_t *, int) |
45 |
+ DEFINE_FUNC_ALIGNED4(int, __cdecl, avcodec_decode_video2, AVCodecContext*, AVFrame*, int*, AVPacket*) |
46 |
+ DEFINE_FUNC_ALIGNED4(int, __cdecl, avcodec_decode_audio3, AVCodecContext*, int16_t*, int*, AVPacket*) |
47 |
+ DEFINE_FUNC_ALIGNED4(int, __cdecl, avcodec_decode_subtitle2, AVCodecContext*, AVSubtitle*, int*, AVPacket*) |
48 |
DEFINE_FUNC_ALIGNED4(int, __cdecl, avcodec_encode_audio, AVCodecContext*, uint8_t*, int, const short*) |
49 |
DEFINE_FUNC_ALIGNED0(AVCodecContext*, __cdecl, avcodec_alloc_context) |
50 |
DEFINE_FUNC_ALIGNED1(AVCodecParserContext*, __cdecl, av_parser_init, int) |
51 |
@@ -231,9 +238,9 @@ class DllAvCodec : public DllDynamic, DllAvCodecInterface |
52 |
#else |
53 |
DEFINE_METHOD1(void, avcodec_flush_buffers, (AVCodecContext* p1)) |
54 |
DEFINE_METHOD2(int, avcodec_open_dont_call, (AVCodecContext* p1, AVCodec *p2)) |
55 |
- DEFINE_METHOD5(int, avcodec_decode_video, (AVCodecContext* p1, AVFrame *p2, int *p3, uint8_t *p4, int p5)) |
56 |
- DEFINE_METHOD5(int, avcodec_decode_audio2, (AVCodecContext* p1, int16_t *p2, int *p3, uint8_t *p4, int p5)) |
57 |
- DEFINE_METHOD5(int, avcodec_decode_subtitle, (AVCodecContext* p1, AVSubtitle *p2, int *p3, const uint8_t *p4, int p5)) |
58 |
+ DEFINE_METHOD4(int, avcodec_decode_video2, (AVCodecContext* p1, AVFrame *p2, int *p3, AVPacket *p4)) |
59 |
+ DEFINE_METHOD4(int, avcodec_decode_audio3, (AVCodecContext* p1, int16_t *p2, int *p3, AVPacket *p4)) |
60 |
+ DEFINE_METHOD4(int, avcodec_decode_subtitle2, (AVCodecContext* p1, AVSubtitle *p2, int *p3, AVPacket *p4)) |
61 |
DEFINE_METHOD4(int, avcodec_encode_audio, (AVCodecContext* p1, uint8_t *p2, int p3, const short *p4)) |
62 |
DEFINE_METHOD0(AVCodecContext*, avcodec_alloc_context) |
63 |
DEFINE_METHOD1(AVCodecParserContext*, av_parser_init, (int p1)) |
64 |
@@ -282,9 +289,9 @@ class DllAvCodec : public DllDynamic, DllAvCodecInterface |
65 |
RESOLVE_METHOD(avcodec_alloc_frame) |
66 |
RESOLVE_METHOD_RENAME(avcodec_register_all, avcodec_register_all_dont_call) |
67 |
RESOLVE_METHOD(avpicture_fill) |
68 |
- RESOLVE_METHOD(avcodec_decode_video) |
69 |
- RESOLVE_METHOD(avcodec_decode_audio2) |
70 |
- RESOLVE_METHOD(avcodec_decode_subtitle) |
71 |
+ RESOLVE_METHOD(avcodec_decode_video2) |
72 |
+ RESOLVE_METHOD(avcodec_decode_audio3) |
73 |
+ RESOLVE_METHOD(avcodec_decode_subtitle2) |
74 |
RESOLVE_METHOD(avcodec_encode_audio) |
75 |
RESOLVE_METHOD(avpicture_get_size) |
76 |
RESOLVE_METHOD(avcodec_alloc_context) |
77 |
diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp |
78 |
index c471cd1..0e89d30 100644 |
79 |
--- a/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp |
80 |
+++ b/xbmc/cores/dvdplayer/DVDCodecs/Audio/DVDAudioCodecFFmpeg.cpp |
81 |
@@ -141,11 +141,14 @@ int CDVDAudioCodecFFmpeg::Decode(BYTE* pData, int iSize) |
82 |
m_iBufferSize1 = AVCODEC_MAX_AUDIO_FRAME_SIZE ; |
83 |
m_iBufferSize2 = 0; |
84 |
|
85 |
- iBytesUsed = m_dllAvCodec.avcodec_decode_audio2( m_pCodecContext |
86 |
+ AVPacket avpkt; |
87 |
+ m_dllAvCodec.av_init_packet(&avpkt); |
88 |
+ avpkt.data = pData; |
89 |
+ avpkt.size = iSize; |
90 |
+ iBytesUsed = m_dllAvCodec.avcodec_decode_audio3( m_pCodecContext |
91 |
, (int16_t*)m_pBuffer1 |
92 |
, &m_iBufferSize1 |
93 |
- , pData |
94 |
- , iSize); |
95 |
+ , &avpkt); |
96 |
|
97 |
/* some codecs will attempt to consume more data than what we gave */ |
98 |
if (iBytesUsed > iSize) |
99 |
diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp |
100 |
index 06149d4..563ce78 100644 |
101 |
--- a/xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp |
102 |
+++ b/xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlayCodecFFmpeg.cpp |
103 |
@@ -162,9 +162,14 @@ int CDVDOverlayCodecFFmpeg::Decode(BYTE* data, int size, double pts, double dura |
104 |
|
105 |
FreeSubtitle(m_Subtitle); |
106 |
|
107 |
+ AVPacket avpkt; |
108 |
+ m_dllAvCodec.av_init_packet(&avpkt); |
109 |
+ avpkt.data = data; |
110 |
+ avpkt.size = size; |
111 |
+ |
112 |
try |
113 |
{ |
114 |
- len = m_dllAvCodec.avcodec_decode_subtitle(m_pCodecContext, &m_Subtitle, &gotsub, data, size); |
115 |
+ len = m_dllAvCodec.avcodec_decode_subtitle2(m_pCodecContext, &m_Subtitle, &gotsub, &avpkt); |
116 |
} |
117 |
catch (win32_exception e) |
118 |
{ |
119 |
diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp |
120 |
index bb27ff9..c7b2637 100644 |
121 |
--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp |
122 |
+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp |
123 |
@@ -393,7 +393,14 @@ int CDVDVideoCodecFFmpeg::Decode(BYTE* pData, int iSize, double dts, double pts) |
124 |
m_dts = dts; |
125 |
m_pCodecContext->reordered_opaque = pts_dtoi(pts); |
126 |
|
127 |
- len = m_dllAvCodec.avcodec_decode_video(m_pCodecContext, m_pFrame, &iGotPicture, pData, iSize); |
128 |
+ AVPacket avpkt; |
129 |
+ m_dllAvCodec.av_init_packet(&avpkt); |
130 |
+ avpkt.data = pData; |
131 |
+ avpkt.size = iSize; |
132 |
+ /* We lie, but this flag is only used by pngdec.c. |
133 |
+ * Setting it correctly would allow CorePNG decoding. */ |
134 |
+ avpkt.flags = AV_PKT_FLAG_KEY; |
135 |
+ len = m_dllAvCodec.avcodec_decode_video2(m_pCodecContext, m_pFrame, &iGotPicture, &avpkt); |
136 |
|
137 |
if(m_iLastKeyframe < m_pCodecContext->has_b_frames + 1) |
138 |
m_iLastKeyframe = m_pCodecContext->has_b_frames + 1; |
139 |
-- |
140 |
1.7.5.4 |
141 |
|