]>
Commit | Line | Data |
---|---|---|
1 | --- avifile-0.7-0.7.45/lib/aviread/FFReadHandler.cpp.orig 2013-07-16 16:48:12.312338353 +0200 | |
2 | +++ avifile-0.7-0.7.45/lib/aviread/FFReadHandler.cpp 2013-07-19 17:06:37.738081034 +0200 | |
3 | @@ -46,14 +46,12 @@ | |
4 | ||
5 | int FFReadHandler::Init(const char* url) | |
6 | { | |
7 | - AVFormatParameters avfp; | |
8 | AVInputFormat* fmt = 0; | |
9 | // av_find_input_format(url); | |
10 | // printf("find input format %p %s\n", fmt, url); | |
11 | - memset(&avfp, 0, sizeof(avfp)); | |
12 | //if (!fmt) return -1; | |
13 | - int r = av_open_input_file(&m_pContext, url, | |
14 | - fmt, 64000, &avfp); | |
15 | + int r = avformat_open_input(&m_pContext, url, | |
16 | + fmt, NULL); | |
17 | if (r < 0) | |
18 | { | |
19 | AVM_WRITE("FF reader", "OPEN INPUT failed\n"); | |
20 | @@ -100,8 +98,8 @@ | |
21 | uint_t j = 0; | |
22 | switch (type) | |
23 | { | |
24 | - case IStream::Audio: t = CODEC_TYPE_AUDIO; break; | |
25 | - case IStream::Video: t = CODEC_TYPE_VIDEO; break; | |
26 | + case IStream::Audio: t = AVMEDIA_TYPE_AUDIO; break; | |
27 | + case IStream::Video: t = AVMEDIA_TYPE_VIDEO; break; | |
28 | default: return 0; | |
29 | } | |
30 | ||
31 | @@ -125,8 +123,8 @@ | |
32 | ||
33 | switch (type) | |
34 | { | |
35 | - case IStream::Audio: t = CODEC_TYPE_AUDIO; break; | |
36 | - case IStream::Video: t = CODEC_TYPE_VIDEO; break; | |
37 | + case IStream::Audio: t = AVMEDIA_TYPE_AUDIO; break; | |
38 | + case IStream::Video: t = AVMEDIA_TYPE_VIDEO; break; | |
39 | default: return 0; | |
40 | } | |
41 | ||
42 | @@ -152,7 +150,7 @@ | |
43 | int FFReadHandler::seek(framepos_t pos) | |
44 | { | |
45 | Locker locker(m_Mutex); | |
46 | - url_fseek(m_pContext->pb, 0, SEEK_SET); | |
47 | + avio_seek(m_pContext->pb, 0, SEEK_SET); | |
48 | flush(); | |
49 | //av_find_stream_info(m_pContext); | |
50 | return 0; | |
51 | @@ -177,8 +175,8 @@ | |
52 | AVFrame pic; | |
53 | int got_pic = 0; | |
54 | memset(&pic, 0, sizeof(pic)); | |
55 | - int r = avcodec_decode_video(s->m_pAvContext, | |
56 | - &pic, &got_pic, pkt.data, pkt.size); | |
57 | + int r = avcodec_decode_video2(s->m_pAvContext, | |
58 | + &pic, &got_pic, &pkt); | |
59 | AVM_WRITE("FF reader", "____ %d %d\n", r, got_pic); | |
60 | } | |
61 | //printf("FFMPEG pktsize: %u %llu %d\n", pkt.size, pkt.pts, pkt.stream_index);fflush(stdout); | |
62 | @@ -203,19 +201,19 @@ | |
63 | / st->codec.frame_rate; | |
64 | } | |
65 | #endif | |
66 | - //if (st->codec.codec_type == CODEC_TYPE_VIDEO) printf("FRATE %d pts:%lld %d %d t:%lld\n", p->position, pkt.pts,st->codec.frame_rate_base, st->codec.frame_rate, p->timestamp); | |
67 | + //if (st->codec.codec_type == AVMEDIA_TYPE_VIDEO) printf("FRATE %d pts:%lld %d %d t:%lld\n", p->position, pkt.pts,st->codec.frame_rate_base, st->codec.frame_rate, p->timestamp); | |
68 | //else printf("Bitrate %d\n", st->codec.bit_rate); | |
69 | //printf("TIMESTAMP %lld %d %d bitrate:%d\n", p->timestamp, s->m_pAvStream->r_frame_rate_base, s->m_pAvStream->r_frame_rate, st->codec.bit_rate); | |
70 | ||
71 | switch (st->codec->codec_type) | |
72 | { | |
73 | - case CODEC_TYPE_AUDIO: | |
74 | + case AVMEDIA_TYPE_AUDIO: | |
75 | if (!pkt.pts && st->codec->bit_rate) | |
76 | p->timestamp = (int64_t)p->position * 8 * 1000000 / | |
77 | st->codec->bit_rate; | |
78 | s->m_uiPosition += pkt.size; | |
79 | break; | |
80 | - case CODEC_TYPE_VIDEO: | |
81 | + case AVMEDIA_TYPE_VIDEO: | |
82 | default: | |
83 | s->m_uiPosition++; | |
84 | break; | |
85 | @@ -227,7 +225,7 @@ | |
86 | pkt.stream_index, m_Streams[pkt.stream_index]->m_Packets.size(), | |
87 | pkt.pts, pkt.size, p->timestamp, pkt.flags); | |
88 | #endif | |
89 | - if (pkt.flags & PKT_FLAG_KEY) | |
90 | + if (pkt.flags & AV_PKT_FLAG_KEY) | |
91 | p->flags |= KEYFRAME; | |
92 | av_free_packet(&pkt); | |
93 | ||
94 | --- avifile-0.7-0.7.45/lib/aviread/FFReadStream.cpp.orig 2013-07-19 17:08:37.194742686 +0200 | |
95 | +++ avifile-0.7-0.7.45/lib/aviread/FFReadStream.cpp 2013-07-19 17:45:26.764649961 +0200 | |
96 | @@ -18,7 +18,7 @@ | |
97 | AVM_BEGIN_NAMESPACE; | |
98 | ||
99 | static const struct id2fcc { | |
100 | - enum CodecID id; | |
101 | + enum AVCodecID id; | |
102 | uint32_t fcc; | |
103 | } id2fcct[] = { | |
104 | { CODEC_ID_MPEG1VIDEO, RIFFINFO_MPG1 }, | |
105 | @@ -32,7 +32,7 @@ | |
106 | { CODEC_ID_NONE } | |
107 | }; | |
108 | ||
109 | -static int get_fcc(enum CodecID id) | |
110 | +static int get_fcc(enum AVCodecID id) | |
111 | { | |
112 | for (const struct id2fcc* p = id2fcct; p->id; p++) | |
113 | if (p->id == id) | |
114 | @@ -53,15 +53,15 @@ | |
115 | //printf("CODECRA %d %d %d\n", avs->codec.frame_rate, avs->codec->frame_rate_base, m_pAvStream->r_frame_rate_base); | |
116 | if (0 && avs->codec->codec_id == CODEC_ID_MPEG1VIDEO) | |
117 | { | |
118 | - m_pAvContext = avcodec_alloc_context(); | |
119 | + m_pAvContext = avcodec_alloc_context3(NULL); | |
120 | //AVCodec* codec = avcodec_find_encoder(avs->codec->codec_id); | |
121 | if (m_pAvContext) | |
122 | { | |
123 | AVCodec* codec = avcodec_find_decoder(avs->codec->codec_id); | |
124 | - if (codec && avcodec_open(m_pAvContext, codec) == 0) | |
125 | + if (codec && avcodec_open2(m_pAvContext, codec, NULL) == 0) | |
126 | { | |
127 | m_pAvContext->flags |= CODEC_FLAG_TRUNCATED; | |
128 | - m_pAvContext->hurry_up = 5; | |
129 | + m_pAvContext->skip_idct = m_pAvContext->skip_frame = AVDISCARD_ALL; | |
130 | //printf("Opened hurryup decoder %p %p\n", codec, m_pAvContext->codec->decode); | |
131 | } | |
132 | else | |
133 | @@ -148,7 +148,7 @@ | |
134 | ||
135 | switch (avs->codec->codec_type) | |
136 | { | |
137 | - case CODEC_TYPE_AUDIO: | |
138 | + case AVMEDIA_TYPE_AUDIO: | |
139 | m_StreamInfo.m_p->setAudio(avs->codec->channels, | |
140 | avs->codec->sample_rate, | |
141 | avs->codec->frame_bits); | |
142 | @@ -157,7 +157,7 @@ | |
143 | AVM_WRITE("FF stream", "Audio Format: %.4s (0x%x)\n", | |
144 | (const char*)&avs->codec->codec_tag, avs->codec->codec_tag); | |
145 | break; | |
146 | - case CODEC_TYPE_VIDEO: | |
147 | + case AVMEDIA_TYPE_VIDEO: | |
148 | m_StreamInfo.m_p->setVideo(avs->codec->width, avs->codec->height, | |
149 | 0, avs->codec->sample_aspect_ratio.num / | |
150 | (float) avs->codec->sample_aspect_ratio.den); | |
151 | @@ -191,8 +191,8 @@ | |
152 | { | |
153 | switch (m_pHandler->m_pContext->streams[m_uiSId]->codec->codec_type) | |
154 | { | |
155 | - case CODEC_TYPE_AUDIO: return IStream::Audio; | |
156 | - case CODEC_TYPE_VIDEO: return IStream::Video; | |
157 | + case AVMEDIA_TYPE_AUDIO: return IStream::Audio; | |
158 | + case AVMEDIA_TYPE_VIDEO: return IStream::Video; | |
159 | default: return IStream::Other; | |
160 | } | |
161 | } | |
162 | @@ -202,7 +202,7 @@ | |
163 | AVStream* avs = m_pHandler->m_pContext->streams[m_uiSId]; | |
164 | switch (avs->codec->codec_type) | |
165 | { | |
166 | - case CODEC_TYPE_AUDIO: | |
167 | + case AVMEDIA_TYPE_AUDIO: | |
168 | if (pFormat && lSize >= sizeof(WAVEFORMATEX)) | |
169 | { | |
170 | WAVEFORMATEX* wf = (WAVEFORMATEX*) pFormat; | |
171 | @@ -228,7 +228,7 @@ | |
172 | //printf("EEEEEEEEEEE %d\n", avs->codec->extradata_size); | |
173 | return sizeof(WAVEFORMATEX) | |
174 | + ((avs->codec->extradata) ? avs->codec->extradata_size : 0); | |
175 | - case CODEC_TYPE_VIDEO: | |
176 | + case AVMEDIA_TYPE_VIDEO: | |
177 | if (pFormat && lSize >= sizeof(BITMAPINFOHEADER)) | |
178 | { | |
179 | BITMAPINFOHEADER* bh = (BITMAPINFOHEADER*) pFormat; | |
180 | @@ -312,7 +312,7 @@ | |
181 | { | |
182 | if (time < 1.) | |
183 | { | |
184 | - if (m_pAvStream->codec->codec_type == CODEC_TYPE_AUDIO) | |
185 | + if (m_pAvStream->codec->codec_type == AVMEDIA_TYPE_AUDIO) | |
186 | // check if more streams are available | |
187 | // and seek only with the video | |
188 | return 0; | |
189 | --- avifile-0.7-0.7.45/lib/codeckeeper.cpp.orig 2013-07-19 17:48:46.567974909 +0200 | |
190 | +++ avifile-0.7-0.7.45/lib/codeckeeper.cpp 2013-07-19 17:53:49.324628870 +0200 | |
191 | @@ -295,7 +295,6 @@ | |
192 | audio_codecs.clear(); | |
193 | ||
194 | // FFMPEG initialization | |
195 | - avcodec_init(); | |
196 | avcodec_register_all(); | |
197 | ||
198 | uncompressed_FillPlugins(video_codecs); | |
199 | --- avifile-0.7-0.7.45/plugins/libffmpeg/libffmpeg.cpp.orig 2006-03-05 21:44:59.000000000 +0100 | |
200 | +++ avifile-0.7-0.7.45/plugins/libffmpeg/libffmpeg.cpp 2013-07-19 18:00:25.221278922 +0200 | |
201 | @@ -137,7 +137,6 @@ | |
202 | static int is_init = 0; | |
203 | if (!is_init) | |
204 | { | |
205 | - avcodec_init(); | |
206 | avcodec_register_all(); | |
207 | is_init++; | |
208 | } | |
209 | --- avifile-0.7-0.7.45/plugins/libffmpeg/FFAudioDecoder.cpp.orig 2013-07-19 18:01:05.454610568 +0200 | |
210 | +++ avifile-0.7-0.7.45/plugins/libffmpeg/FFAudioDecoder.cpp 2013-07-19 18:15:09.351241818 +0200 | |
211 | @@ -25,7 +25,7 @@ | |
212 | { | |
213 | if (!m_pAvContext) | |
214 | { | |
215 | - m_pAvContext = avcodec_alloc_context(); | |
216 | + m_pAvContext = avcodec_alloc_context3(NULL); | |
217 | m_pAvContext->channels = m_pFormat->nChannels; | |
218 | if (m_pAvContext->channels > 2) | |
219 | m_pAvContext->channels = 2; | |
220 | @@ -33,7 +33,7 @@ | |
221 | m_pAvContext->sample_rate = m_pFormat->nSamplesPerSec; | |
222 | m_pAvContext->block_align = m_pFormat->nBlockAlign; | |
223 | m_pAvContext->codec_tag = m_Info.fourcc; | |
224 | - m_pAvContext->codec_id = (CodecID) m_pAvCodec->id; | |
225 | + m_pAvContext->codec_id = (AVCodecID) m_pAvCodec->id; | |
226 | ||
227 | if (m_pFormat->cbSize > 0) | |
228 | { | |
229 | @@ -41,7 +41,7 @@ | |
230 | m_pAvContext->extradata_size = m_pFormat->cbSize; | |
231 | } | |
232 | ||
233 | - if (avcodec_open(m_pAvContext, m_pAvCodec) < 0) | |
234 | + if (avcodec_open2(m_pAvContext, m_pAvCodec, NULL) < 0) | |
235 | { | |
236 | AVM_WRITE("FFAudioDecoder", "WARNING: can't open avcodec\n"); | |
237 | free(m_pAvContext); | |
238 | @@ -50,8 +50,12 @@ | |
239 | } | |
240 | } | |
241 | int framesz = 0; | |
242 | - int hr = avcodec_decode_audio2(m_pAvContext, (int16_t*)out_data, &framesz, | |
243 | - (uint8_t*)in_data, in_size); | |
244 | + AVPacket avpkt; | |
245 | + av_init_packet(&avpkt); | |
246 | + avpkt.data = (uint8_t*)in_data; | |
247 | + avpkt.size = in_size; | |
248 | + int hr = avcodec_decode_audio3(m_pAvContext, (int16_t*)out_data, &framesz, | |
249 | + &avpkt); | |
250 | //printf("CONVERT i:%d o:%d f:%d h:%d\n", in_size, out_size, framesz, hr); | |
251 | if (size_read) | |
252 | *size_read = (hr < 0) ? in_size : hr; | |
253 | --- avifile-0.7-0.7.45/plugins/libffmpeg/FFVideoDecoder.cpp.orig 2013-07-19 18:15:45.704573627 +0200 | |
254 | +++ avifile-0.7-0.7.45/plugins/libffmpeg/FFVideoDecoder.cpp 2013-07-19 20:13:57.874275997 +0200 | |
255 | @@ -101,36 +101,29 @@ | |
256 | pic->pts = pImage->m_lTimestamp; | |
257 | pic->type = FF_BUFFER_TYPE_USER; | |
258 | pImage->m_iType = pic->pict_type; | |
259 | - //pic->age = pic->coded_picture_number - pImage->m_iAge; | |
260 | - //pImage->m_iAge = (pic->pict_type == FF_B_TYPE) ? | |
261 | + //pImage->m_iAge = (pic->pict_type == AV_PICTURE_TYPE_B) ? | |
262 | //pImage->m_iAge = (pic->reference) ? | |
263 | // -256*256*256*64 : pic->coded_picture_number; | |
264 | ||
265 | d->m_iAgeIP[0]++; | |
266 | - pic->age = d->m_iAgeIP[0] - pImage->m_iAge; | |
267 | - pImage->m_iAge = (pic->pict_type == FF_B_TYPE) ? | |
268 | + pImage->m_iAge = (pic->pict_type == AV_PICTURE_TYPE_B) ? | |
269 | 256*256*256*64 : d->m_iAgeIP[0]; | |
270 | - if (pic->age < 1) | |
271 | - pic->age = 256*256*256*64; | |
272 | ||
273 | #if 0 | |
274 | // mplayer code | |
275 | if (pic->reference) | |
276 | { | |
277 | - pic->age = d->m_iAgeIP[0]; | |
278 | d->m_iAgeIP[0] = d->m_iAgeIP[1] + 1; | |
279 | d->m_iAgeIP[1] = 1; | |
280 | d->m_iAgeB++; | |
281 | } | |
282 | else | |
283 | { | |
284 | - pic->age = d->m_iAgeB; | |
285 | d->m_iAgeIP[0]++; | |
286 | d->m_iAgeIP[1]++; | |
287 | d->m_iAgeB = 1; | |
288 | } | |
289 | #endif | |
290 | - //printf("Age %d %d cp:%d %p\n", pic->age, pImage->m_iAge, pic->coded_picture_number, pImage); | |
291 | //printf("PictType %d %d\n", pic->pict_type, pic->reference); | |
292 | //printf("%p %p %p %d %d\n", avctx->dr_buffer[0], avctx->dr_buffer[1], avctx->dr_buffer[2], avctx->dr_stride, avctx->dr_uvstride); | |
293 | return 0; | |
294 | @@ -172,7 +165,7 @@ | |
295 | //printf("FFMPEG space \n"); m_Dest.Print(); pImage->GetFmt()->Print(); | |
296 | if (!m_pAvContext) | |
297 | { | |
298 | - m_pAvContext = avcodec_alloc_context(); | |
299 | + m_pAvContext = avcodec_alloc_context3(NULL); | |
300 | // for autodetection errors | |
301 | m_pAvContext->codec_tag = m_pFormat->biCompression; | |
302 | m_pAvContext->bits_per_coded_sample = m_pFormat->biBitCount; | |
303 | @@ -198,8 +191,6 @@ | |
304 | { | |
305 | m_pAvContext->extradata_size = m_pFormat->biSize - sizeof(BITMAPINFOHEADER); | |
306 | m_pAvContext->extradata = (uint8_t*) m_pFormat + sizeof(BITMAPINFOHEADER); | |
307 | - if (m_pAvContext->extradata_size > 40) | |
308 | - m_pAvContext->flags |= CODEC_FLAG_EXTERN_HUFF; // somewhat useless | |
309 | } | |
310 | ||
311 | m_uiBuffers = (pImage && pImage->GetAllocator()) ? pImage->GetAllocator()->GetImages() : 0; | |
312 | @@ -297,7 +288,7 @@ | |
313 | m_pAvContext->workaround_bugs |= p->flag; | |
314 | } | |
315 | */ | |
316 | - if (avcodec_open(m_pAvContext, m_pAvCodec) < 0) | |
317 | + if (avcodec_open2(m_pAvContext, m_pAvCodec, NULL) < 0) | |
318 | { | |
319 | AVM_WRITE(m_Info.GetPrivateName(), "WARNING: FFVideoDecoder::DecodeFrame() can't open avcodec\n"); | |
320 | Stop(); | |
321 | @@ -317,9 +308,13 @@ | |
322 | m_bUsed = false; | |
323 | m_pReleased = 0; | |
324 | AVFrame pic; | |
325 | + AVPacket avpkt; | |
326 | int got_picture = 0; | |
327 | - int hr = avcodec_decode_video(m_pAvContext, &pic, &got_picture, | |
328 | - (unsigned char*) src, size); | |
329 | + av_init_packet(&avpkt); | |
330 | + avpkt.data = (unsigned char*)src; | |
331 | + avpkt.size = size; | |
332 | + int hr = avcodec_decode_video2(m_pAvContext, &pic, &got_picture, | |
333 | + &avpkt); | |
334 | //printf("DECFF got_picture %d %p del:%d hr:%d size:%d\n", got_picture, src, m_pAvContext->delay, hr, size); | |
335 | //printf("PictType %d\n", m_pAvContext->pict_type); | |
336 | //static int ctr=0; printf("WIDTH %dx%d %d r:%d\n", m_pAvContext->width, m_pAvContext->height, ctr++, m_pAvContext->pict_type); | |
337 | @@ -365,7 +360,7 @@ | |
338 | } | |
339 | ||
340 | Debug printf("FF: r=0x%x sz=%d %d b:%d img:%p out:%p\n", hr, size, got_picture, m_bUsed, pImage, pOut); | |
341 | - Debug printf("FF: frame_size %d number %d picnum %d\n", m_pAvContext->frame_size, m_pAvContext->frame_number, m_pAvContext->real_pict_num); | |
342 | + Debug printf("FF: frame_size %d number %d\n", m_pAvContext->frame_size, m_pAvContext->frame_number); | |
343 | if (!got_picture) | |
344 | { | |
345 | Debug printf("FF: NO PICTURE released=%p\n", m_pReleased); | |
346 | @@ -388,8 +383,8 @@ | |
347 | switch (m_pAvContext->pix_fmt) | |
348 | { | |
349 | case PIX_FMT_BGR24: imfmt = IMG_FMT_BGR24; break; | |
350 | - case PIX_FMT_RGBA32: imfmt = IMG_FMT_BGR32; break; | |
351 | - case PIX_FMT_YUV422: imfmt = IMG_FMT_YUY2; break; | |
352 | + case PIX_FMT_RGB32: imfmt = IMG_FMT_BGR32; break; | |
353 | + case PIX_FMT_YUYV422: imfmt = IMG_FMT_YUY2; break; | |
354 | case PIX_FMT_YUV410P: imfmt = IMG_FMT_I410; break; | |
355 | case PIX_FMT_YUV411P: imfmt = IMG_FMT_I411; break; | |
356 | case PIX_FMT_YUV420P: imfmt = IMG_FMT_I420; break; | |
357 | --- avifile-0.7-0.7.45/plugins/libffmpeg/FFVideoEncoder.cpp.orig 2005-09-12 14:06:48.000000000 +0200 | |
358 | +++ avifile-0.7-0.7.45/plugins/libffmpeg/FFVideoEncoder.cpp 2013-07-19 20:15:08.434273035 +0200 | |
359 | @@ -122,7 +122,7 @@ | |
360 | ||
361 | if (!m_pAvContext) | |
362 | { | |
363 | - m_pAvContext = avcodec_alloc_context(); | |
364 | + m_pAvContext = avcodec_alloc_context3(NULL); | |
365 | m_pAvContext->width = m_bh.biWidth; | |
366 | m_pAvContext->height = m_obh.biHeight; | |
367 | //m_pAvContext->pix_fmt = PIX_FMT_YUV420P; | |
368 | @@ -138,7 +138,7 @@ | |
369 | ||
370 | printf("CODEC opening %dx%d\n", m_bh.biWidth, m_obh.biHeight); | |
371 | ||
372 | - if (avcodec_open(m_pAvContext, m_pAvCodec) < 0) | |
373 | + if (avcodec_open2(m_pAvContext, m_pAvCodec, NULL) < 0) | |
374 | { | |
375 | free(m_pAvContext); | |
376 | m_pAvContext = 0; |