1 |
From 621be69b5977b1bbdb4e1ce276f8b4819b1462ef Mon Sep 17 00:00:00 2001 |
2 |
From: elupus <elupus@xbmc.org> |
3 |
Date: Sat, 10 Sep 2011 17:29:45 +0200 |
4 |
Subject: [PATCH 108/145] replace depreciated ByteIOContext with AVIOContext |
5 |
(cherry picked from commit |
6 |
564d77c6a6773388e0c1e0b5a44a25bfe49dfb3d) |
7 |
|
8 |
--- |
9 |
lib/DllAvFormat.h | 104 ++++++++++----------- |
10 |
xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.h | 2 +- |
11 |
2 files changed, 53 insertions(+), 53 deletions(-) |
12 |
|
13 |
diff --git a/lib/DllAvFormat.h b/lib/DllAvFormat.h |
14 |
index 9008cab..dc036c7 100644 |
15 |
--- a/lib/DllAvFormat.h |
16 |
+++ b/lib/DllAvFormat.h |
17 |
@@ -62,7 +62,7 @@ public: |
18 |
virtual ~DllAvFormatInterface() {} |
19 |
virtual void av_register_all_dont_call(void)=0; |
20 |
virtual AVInputFormat *av_find_input_format(const char *short_name)=0; |
21 |
- virtual int url_feof(ByteIOContext *s)=0; |
22 |
+ virtual int url_feof(AVIOContext *s)=0; |
23 |
virtual AVMetadataTag *av_metadata_get(AVMetadata *m, const char *key, const AVMetadataTag *prev, int flags)=0; |
24 |
virtual void av_close_input_file(AVFormatContext *s)=0; |
25 |
virtual void av_close_input_stream(AVFormatContext *s)=0; |
26 |
@@ -76,32 +76,32 @@ public: |
27 |
#endif |
28 |
virtual void url_set_interrupt_cb(URLInterruptCB *interrupt_cb)=0; |
29 |
virtual int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputFormat *fmt, AVDictionary **options)=0; |
30 |
- virtual int init_put_byte(ByteIOContext *s, unsigned char *buffer, int buffer_size, int write_flag, void *opaque, |
31 |
+ virtual int init_put_byte(AVIOContext *s, unsigned char *buffer, int buffer_size, int write_flag, void *opaque, |
32 |
int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), |
33 |
int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), |
34 |
offset_t (*seek)(void *opaque, offset_t offset, int whence))=0; |
35 |
virtual AVInputFormat *av_probe_input_format(AVProbeData *pd, int is_opened)=0; |
36 |
virtual AVInputFormat *av_probe_input_format2(AVProbeData *pd, int is_opened, int *score_max)=0; |
37 |
- virtual int av_probe_input_buffer(ByteIOContext *pb, AVInputFormat **fmt, const char *filename, void *logctx, unsigned int offset, unsigned int max_probe_size)=0; |
38 |
+ virtual int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt, const char *filename, void *logctx, unsigned int offset, unsigned int max_probe_size)=0; |
39 |
virtual void dump_format(AVFormatContext *ic, int index, const char *url, int is_output)=0; |
40 |
- virtual int url_fdopen(ByteIOContext **s, URLContext *h)=0; |
41 |
- virtual int url_fopen(ByteIOContext **s, const char *filename, int flags)=0; |
42 |
- virtual int url_fclose(ByteIOContext *s)=0; |
43 |
- virtual int url_open_dyn_buf(ByteIOContext **s)=0; |
44 |
- virtual int url_close_dyn_buf(ByteIOContext *s, uint8_t **pbuffer)=0; |
45 |
- virtual offset_t url_fseek(ByteIOContext *s, offset_t offset, int whence)=0; |
46 |
- virtual int get_buffer(ByteIOContext *s, unsigned char *buf, int size)=0; |
47 |
- virtual int get_partial_buffer(ByteIOContext *s, unsigned char *buf, int size)=0; |
48 |
- virtual void put_byte(ByteIOContext *s, int b)=0; |
49 |
- virtual void put_buffer(ByteIOContext *s, const unsigned char *buf, int size)=0; |
50 |
- virtual void put_be24(ByteIOContext *s, unsigned int val)=0; |
51 |
- virtual void put_be32(ByteIOContext *s, unsigned int val)=0; |
52 |
- virtual void put_be16(ByteIOContext *s, unsigned int val)=0; |
53 |
+ virtual int url_fdopen(AVIOContext **s, URLContext *h)=0; |
54 |
+ virtual int url_fopen(AVIOContext **s, const char *filename, int flags)=0; |
55 |
+ virtual int url_fclose(AVIOContext *s)=0; |
56 |
+ virtual int url_open_dyn_buf(AVIOContext **s)=0; |
57 |
+ virtual int url_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer)=0; |
58 |
+ virtual offset_t url_fseek(AVIOContext *s, offset_t offset, int whence)=0; |
59 |
+ virtual int get_buffer(AVIOContext *s, unsigned char *buf, int size)=0; |
60 |
+ virtual int get_partial_buffer(AVIOContext *s, unsigned char *buf, int size)=0; |
61 |
+ virtual void put_byte(AVIOContext *s, int b)=0; |
62 |
+ virtual void put_buffer(AVIOContext *s, const unsigned char *buf, int size)=0; |
63 |
+ virtual void put_be24(AVIOContext *s, unsigned int val)=0; |
64 |
+ virtual void put_be32(AVIOContext *s, unsigned int val)=0; |
65 |
+ virtual void put_be16(AVIOContext *s, unsigned int val)=0; |
66 |
virtual AVFormatContext *avformat_alloc_context(void)=0; |
67 |
virtual AVStream *av_new_stream(AVFormatContext *s, int id)=0; |
68 |
virtual AVOutputFormat *av_guess_format(const char *short_name, const char *filename, const char *mime_type)=0; |
69 |
virtual int av_set_parameters(AVFormatContext *s, AVFormatParameters *ap)=0; |
70 |
- virtual ByteIOContext *av_alloc_put_byte(unsigned char *buffer, int buffer_size, int write_flag, void *opaque, |
71 |
+ virtual AVIOContext *av_alloc_put_byte(unsigned char *buffer, int buffer_size, int write_flag, void *opaque, |
72 |
int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), |
73 |
int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), |
74 |
offset_t (*seek)(void *opaque, offset_t offset, int whence))=0; |
75 |
@@ -125,7 +125,7 @@ public: |
76 |
} |
77 |
virtual void av_register_all_dont_call() { *(int* )0x0 = 0; } |
78 |
virtual AVInputFormat *av_find_input_format(const char *short_name) { return ::av_find_input_format(short_name); } |
79 |
- virtual int url_feof(ByteIOContext *s) { return ::url_feof(s); } |
80 |
+ virtual int url_feof(AVIOContext *s) { return ::url_feof(s); } |
81 |
#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(52,31,0) |
82 |
// API added on: 2009-03-01 |
83 |
virtual AVMetadataTag *av_metadata_get(AVMetadata *m, const char *key, const AVMetadataTag *prev, int flags){ return ::av_metadata_get(m, key, prev, flags); } |
84 |
@@ -147,7 +147,7 @@ public: |
85 |
virtual void url_set_interrupt_cb(URLInterruptCB *interrupt_cb) { ::url_set_interrupt_cb(interrupt_cb); } |
86 |
virtual int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputFormat *fmt, AVDictionary **options) |
87 |
{ return ::avformat_open_input(ps, filename, fmt, opt, ap); } |
88 |
- virtual int init_put_byte(ByteIOContext *s, unsigned char *buffer, int buffer_size, int write_flag, void *opaque, |
89 |
+ virtual int init_put_byte(AVIOContext *s, unsigned char *buffer, int buffer_size, int write_flag, void *opaque, |
90 |
int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), |
91 |
int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), |
92 |
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); } |
93 |
@@ -155,24 +155,24 @@ public: |
94 |
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 |
95 |
#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(52,98,0) |
96 |
// API added on: 2010-02-08 |
97 |
- 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); } |
98 |
+ 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); } |
99 |
#else |
100 |
- 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; } |
101 |
+ virtual int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt, const char *filename, void *logctx, unsigned int offset, unsigned int max_probe_size) { return -1; } |
102 |
#endif |
103 |
virtual void dump_format(AVFormatContext *ic, int index, const char *url, int is_output) { ::dump_format(ic, index, url, is_output); } |
104 |
- virtual int url_fdopen(ByteIOContext **s, URLContext *h) { return ::url_fdopen(s, h); } |
105 |
- virtual int url_fopen(ByteIOContext **s, const char *filename, int flags) { return ::url_fopen(s, filename, flags); } |
106 |
- virtual int url_fclose(ByteIOContext *s) { return ::url_fclose(s); } |
107 |
- virtual int url_open_dyn_buf(ByteIOContext **s) { return ::url_open_dyn_buf(s); } |
108 |
- virtual int url_close_dyn_buf(ByteIOContext *s, uint8_t **pbuffer) { return ::url_close_dyn_buf(s, pbuffer); } |
109 |
- virtual offset_t url_fseek(ByteIOContext *s, offset_t offset, int whence) { return ::url_fseek(s, offset, whence); } |
110 |
- virtual int get_buffer(ByteIOContext *s, unsigned char *buf, int size) { return ::get_buffer(s, buf, size); } |
111 |
- virtual int get_partial_buffer(ByteIOContext *s, unsigned char *buf, int size) { return ::get_partial_buffer(s, buf, size); } |
112 |
- virtual void put_byte(ByteIOContext *s, int b) { ::put_byte(s, b); } |
113 |
- virtual void put_buffer(ByteIOContext *s, const unsigned char *buf, int size) { ::put_buffer(s, buf, size); } |
114 |
- virtual void put_be24(ByteIOContext *s, unsigned int val) { ::put_be24(s, val); } |
115 |
- virtual void put_be32(ByteIOContext *s, unsigned int val) { ::put_be32(s, val); } |
116 |
- virtual void put_be16(ByteIOContext *s, unsigned int val) { ::put_be16(s, val); } |
117 |
+ virtual int url_fdopen(AVIOContext **s, URLContext *h) { return ::url_fdopen(s, h); } |
118 |
+ virtual int url_fopen(AVIOContext **s, const char *filename, int flags) { return ::url_fopen(s, filename, flags); } |
119 |
+ virtual int url_fclose(AVIOContext *s) { return ::url_fclose(s); } |
120 |
+ virtual int url_open_dyn_buf(AVIOContext **s) { return ::url_open_dyn_buf(s); } |
121 |
+ virtual int url_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer) { return ::url_close_dyn_buf(s, pbuffer); } |
122 |
+ virtual offset_t url_fseek(AVIOContext *s, offset_t offset, int whence) { return ::url_fseek(s, offset, whence); } |
123 |
+ virtual int get_buffer(AVIOContext *s, unsigned char *buf, int size) { return ::get_buffer(s, buf, size); } |
124 |
+ virtual int get_partial_buffer(AVIOContext *s, unsigned char *buf, int size) { return ::get_partial_buffer(s, buf, size); } |
125 |
+ virtual void put_byte(AVIOContext *s, int b) { ::put_byte(s, b); } |
126 |
+ virtual void put_buffer(AVIOContext *s, const unsigned char *buf, int size) { ::put_buffer(s, buf, size); } |
127 |
+ virtual void put_be24(AVIOContext *s, unsigned int val) { ::put_be24(s, val); } |
128 |
+ virtual void put_be32(AVIOContext *s, unsigned int val) { ::put_be32(s, val); } |
129 |
+ virtual void put_be16(AVIOContext *s, unsigned int val) { ::put_be16(s, val); } |
130 |
virtual AVFormatContext *avformat_alloc_context() { return ::avformat_alloc_context(); } |
131 |
virtual AVStream *av_new_stream(AVFormatContext *s, int id) { return ::av_new_stream(s, id); } |
132 |
#if LIBAVFORMAT_VERSION_INT < (52<<16 | 45<<8) |
133 |
@@ -181,7 +181,7 @@ public: |
134 |
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); } |
135 |
#endif |
136 |
virtual int av_set_parameters(AVFormatContext *s, AVFormatParameters *ap) { return ::av_set_parameters(s, ap); } |
137 |
- virtual ByteIOContext *av_alloc_put_byte(unsigned char *buffer, int buffer_size, int write_flag, void *opaque, |
138 |
+ virtual AVIOContext *av_alloc_put_byte(unsigned char *buffer, int buffer_size, int write_flag, void *opaque, |
139 |
int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), |
140 |
int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), |
141 |
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); } |
142 |
@@ -217,7 +217,7 @@ class DllAvFormat : public DllDynamic, DllAvFormatInterface |
143 |
|
144 |
DEFINE_METHOD0(void, av_register_all_dont_call) |
145 |
DEFINE_METHOD1(AVInputFormat*, av_find_input_format, (const char *p1)) |
146 |
- DEFINE_METHOD1(int, url_feof, (ByteIOContext *p1)) |
147 |
+ DEFINE_METHOD1(int, url_feof, (AVIOContext *p1)) |
148 |
DEFINE_METHOD4(AVMetadataTag*, av_metadata_get, (AVMetadata *p1, const char *p2, const AVMetadataTag *p3, int p4)) |
149 |
DEFINE_METHOD1(void, av_close_input_file, (AVFormatContext *p1)) |
150 |
DEFINE_METHOD1(void, av_close_input_stream, (AVFormatContext *p1)) |
151 |
@@ -230,26 +230,26 @@ class DllAvFormat : public DllDynamic, DllAvFormatInterface |
152 |
DEFINE_FUNC_ALIGNED4(int, __cdecl, avformat_open_input, AVFormatContext **, const char *, AVInputFormat *, AVDictionary **) |
153 |
DEFINE_FUNC_ALIGNED2(AVInputFormat*, __cdecl, av_probe_input_format, AVProbeData*, int) |
154 |
DEFINE_FUNC_ALIGNED3(AVInputFormat*, __cdecl, av_probe_input_format2, AVProbeData*, int, int*) |
155 |
- DEFINE_FUNC_ALIGNED6(int, __cdecl, av_probe_input_buffer, ByteIOContext *, AVInputFormat **, const char *, void *, unsigned int, unsigned int) |
156 |
- DEFINE_FUNC_ALIGNED3(int, __cdecl, get_buffer, ByteIOContext*, unsigned char *, int) |
157 |
- DEFINE_FUNC_ALIGNED3(int, __cdecl, get_partial_buffer, ByteIOContext*, unsigned char *, int) |
158 |
- DEFINE_FUNC_ALIGNED2(void, __cdecl, put_byte, ByteIOContext*, int) |
159 |
- DEFINE_FUNC_ALIGNED3(void, __cdecl, put_buffer, ByteIOContext*, const unsigned char *, int) |
160 |
- DEFINE_FUNC_ALIGNED2(void, __cdecl, put_be24, ByteIOContext*, unsigned int) |
161 |
- DEFINE_FUNC_ALIGNED2(void, __cdecl, put_be32, ByteIOContext*, unsigned int) |
162 |
- DEFINE_FUNC_ALIGNED2(void, __cdecl, put_be16, ByteIOContext*, unsigned int) |
163 |
+ DEFINE_FUNC_ALIGNED6(int, __cdecl, av_probe_input_buffer, AVIOContext *, AVInputFormat **, const char *, void *, unsigned int, unsigned int) |
164 |
+ DEFINE_FUNC_ALIGNED3(int, __cdecl, get_buffer, AVIOContext*, unsigned char *, int) |
165 |
+ DEFINE_FUNC_ALIGNED3(int, __cdecl, get_partial_buffer, AVIOContext*, unsigned char *, int) |
166 |
+ DEFINE_FUNC_ALIGNED2(void, __cdecl, put_byte, AVIOContext*, int) |
167 |
+ DEFINE_FUNC_ALIGNED3(void, __cdecl, put_buffer, AVIOContext*, const unsigned char *, int) |
168 |
+ DEFINE_FUNC_ALIGNED2(void, __cdecl, put_be24, AVIOContext*, unsigned int) |
169 |
+ DEFINE_FUNC_ALIGNED2(void, __cdecl, put_be32, AVIOContext*, unsigned int) |
170 |
+ DEFINE_FUNC_ALIGNED2(void, __cdecl, put_be16, AVIOContext*, unsigned int) |
171 |
DEFINE_METHOD1(void, url_set_interrupt_cb, (URLInterruptCB *p1)) |
172 |
- DEFINE_METHOD8(int, init_put_byte, (ByteIOContext *p1, unsigned char *p2, int p3, int p4, void *p5, |
173 |
+ DEFINE_METHOD8(int, init_put_byte, (AVIOContext *p1, unsigned char *p2, int p3, int p4, void *p5, |
174 |
int (*p6)(void *opaque, uint8_t *buf, int buf_size), |
175 |
int (*p7)(void *opaque, uint8_t *buf, int buf_size), |
176 |
offset_t (*p8)(void *opaque, offset_t offset, int whence))) |
177 |
DEFINE_METHOD4(void, dump_format, (AVFormatContext *p1, int p2, const char *p3, int p4)) |
178 |
- DEFINE_METHOD2(int, url_fdopen, (ByteIOContext **p1, URLContext *p2)) |
179 |
- DEFINE_METHOD3(int, url_fopen, (ByteIOContext **p1, const char *p2, int p3)) |
180 |
- DEFINE_METHOD1(int, url_fclose, (ByteIOContext *p1)) |
181 |
- DEFINE_METHOD1(int, url_open_dyn_buf, (ByteIOContext **p1)) |
182 |
- DEFINE_METHOD2(int, url_close_dyn_buf, (ByteIOContext *p1, uint8_t **p2)) |
183 |
- DEFINE_METHOD3(offset_t, url_fseek, (ByteIOContext *p1, offset_t p2, int p3)) |
184 |
+ DEFINE_METHOD2(int, url_fdopen, (AVIOContext **p1, URLContext *p2)) |
185 |
+ DEFINE_METHOD3(int, url_fopen, (AVIOContext **p1, const char *p2, int p3)) |
186 |
+ DEFINE_METHOD1(int, url_fclose, (AVIOContext *p1)) |
187 |
+ DEFINE_METHOD1(int, url_open_dyn_buf, (AVIOContext **p1)) |
188 |
+ DEFINE_METHOD2(int, url_close_dyn_buf, (AVIOContext *p1, uint8_t **p2)) |
189 |
+ DEFINE_METHOD3(offset_t, url_fseek, (AVIOContext *p1, offset_t p2, int p3)) |
190 |
DEFINE_METHOD0(AVFormatContext *, avformat_alloc_context) |
191 |
DEFINE_METHOD2(AVStream *, av_new_stream, (AVFormatContext *p1, int p2)) |
192 |
#if LIBAVFORMAT_VERSION_INT < (52<<16 | 45<<8) |
193 |
@@ -258,7 +258,7 @@ class DllAvFormat : public DllDynamic, DllAvFormatInterface |
194 |
DEFINE_METHOD3(AVOutputFormat *, av_guess_format, (const char *p1, const char *p2, const char *p3)) |
195 |
#endif |
196 |
DEFINE_METHOD2(int, av_set_parameters, (AVFormatContext *p1, AVFormatParameters *p2)); |
197 |
- DEFINE_METHOD7(ByteIOContext *, av_alloc_put_byte, (unsigned char *p1, int p2, int p3, void *p4, |
198 |
+ DEFINE_METHOD7(AVIOContext *, av_alloc_put_byte, (unsigned char *p1, int p2, int p3, void *p4, |
199 |
int(*p5)(void *opaque, uint8_t *buf, int buf_size), |
200 |
int(*p6)(void *opaque, uint8_t *buf, int buf_size), |
201 |
offset_t(*p7)(void *opaque, offset_t offset, int whence))) |
202 |
diff --git a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.h b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.h |
203 |
index 018d9b3..84ea4b7 100644 |
204 |
--- a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.h |
205 |
+++ b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxFFmpeg.h |
206 |
@@ -128,7 +128,7 @@ protected: |
207 |
#define MAX_STREAMS 100 |
208 |
CDemuxStream* m_streams[MAX_STREAMS]; // maximum number of streams that ffmpeg can handle |
209 |
|
210 |
- ByteIOContext* m_ioContext; |
211 |
+ AVIOContext* m_ioContext; |
212 |
|
213 |
DllAvFormat m_dllAvFormat; |
214 |
DllAvCodec m_dllAvCodec; |
215 |
-- |
216 |
1.7.10 |
217 |
|