Commit | Line | Data |
---|---|---|
0444187d RG |
1 | Submitted By: Ken Moffat <ken at linuxfromscratch dot org> |
2 | Date: 2018-05-12 | |
3 | Initial Package Version: 1.2.4 | |
4 | Upstream Status: Defunct | |
5 | Origin: Gentoo | |
6 | Description: Accumulated fixes up to and including building with ffmpeg-4 | |
7 | ||
8 | From gentoo, their libav-9.patch, ffmpeg2.patch, CVE-2016-2399.patch, | |
9 | ffmpeg29.patch, ffmpeg4.patch, and seds to files lqt_ffmpeg.c, video.c, | |
10 | audio.c in plugins/ffmpeg/ to change CODEC_ID to AV_CODEC_ID. | |
11 | ||
12 | Build-tested only. | |
13 | ||
14 | diff -Naur a/plugins/ffmpeg/audio.c b/plugins/ffmpeg/audio.c | |
15 | --- a/plugins/ffmpeg/audio.c 2012-03-29 20:44:28.000000000 +0100 | |
16 | +++ b/plugins/ffmpeg/audio.c 2018-05-11 23:15:21.057985300 +0100 | |
17 | @@ -45,6 +45,11 @@ | |
18 | #define ENCODE_AUDIO 1 | |
19 | #endif | |
20 | ||
21 | +#ifndef AVCODEC_MAX_AUDIO_FRAME_SIZE | |
22 | +/* from libavcodec/avcodec.h dated Dec 23 2012 */ | |
23 | +#define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000 // 1 second of 48khz 32bit audio | |
24 | +#endif | |
25 | + | |
26 | /* The following code was ported from gmerlin_avdecoder (http://gmerlin.sourceforge.net) */ | |
27 | ||
28 | /* MPEG Audio header parsing code */ | |
29 | @@ -540,7 +545,7 @@ | |
30 | ||
31 | #if DECODE_AUDIO3 || DECODE_AUDIO4 | |
32 | codec->pkt.data = codec->chunk_buffer; | |
33 | - codec->pkt.size = packet_size + FF_INPUT_BUFFER_PADDING_SIZE; | |
34 | + codec->pkt.size = packet_size + AV_INPUT_BUFFER_PADDING_SIZE; | |
35 | ||
36 | #if DECODE_AUDIO4 | |
37 | frame_bytes = avcodec_decode_audio4(codec->avctx, &f, | |
38 | @@ -578,7 +583,7 @@ | |
39 | (codec->sample_buffer_end - codec->sample_buffer_start)], | |
40 | &bytes_decoded, | |
41 | codec->chunk_buffer, | |
42 | - packet_size + FF_INPUT_BUFFER_PADDING_SIZE); | |
43 | + packet_size + AV_INPUT_BUFFER_PADDING_SIZE); | |
44 | if(frame_bytes < 0) | |
45 | { | |
46 | lqt_log(file, LQT_LOG_ERROR, LOG_DOMAIN, "avcodec_decode_audio2 error"); | |
47 | @@ -626,7 +631,7 @@ | |
48 | { | |
49 | /* If the codec is mp3, make sure to decode the very last frame */ | |
50 | ||
51 | - if((codec->avctx->codec_id == CODEC_ID_MP3) && | |
52 | + if((codec->avctx->codec_id == AV_CODEC_ID_MP3) && | |
53 | (codec->bytes_in_chunk_buffer >= 4)) | |
54 | { | |
55 | if(!mpa_decode_header(&mph, codec->chunk_buffer, (const mpa_header*)0)) | |
56 | @@ -640,13 +645,13 @@ | |
57 | return 0; | |
58 | } | |
59 | ||
60 | - if(codec->chunk_buffer_alloc < mph.frame_bytes + FF_INPUT_BUFFER_PADDING_SIZE) | |
61 | + if(codec->chunk_buffer_alloc < mph.frame_bytes + AV_INPUT_BUFFER_PADDING_SIZE) | |
62 | { | |
63 | - codec->chunk_buffer_alloc = mph.frame_bytes + FF_INPUT_BUFFER_PADDING_SIZE; | |
64 | + codec->chunk_buffer_alloc = mph.frame_bytes + AV_INPUT_BUFFER_PADDING_SIZE; | |
65 | codec->chunk_buffer = realloc(codec->chunk_buffer, codec->chunk_buffer_alloc); | |
66 | } | |
67 | memset(codec->chunk_buffer + codec->bytes_in_chunk_buffer, 0, | |
68 | - mph.frame_bytes - codec->bytes_in_chunk_buffer + FF_INPUT_BUFFER_PADDING_SIZE); | |
69 | + mph.frame_bytes - codec->bytes_in_chunk_buffer + AV_INPUT_BUFFER_PADDING_SIZE); | |
70 | num_samples = mph.samples_per_frame; | |
71 | codec->bytes_in_chunk_buffer = mph.frame_bytes; | |
72 | } | |
73 | @@ -690,12 +695,12 @@ | |
74 | { | |
75 | ||
76 | ||
77 | - /* BIG NOTE: We pass extra FF_INPUT_BUFFER_PADDING_SIZE for the buffer size | |
78 | + /* BIG NOTE: We pass extra AV_INPUT_BUFFER_PADDING_SIZE for the buffer size | |
79 | because we know, that lqt_read_audio_chunk allocates 16 extra bytes for us */ | |
80 | ||
81 | /* Some really broken mp3 files have the header bytes split across 2 chunks */ | |
82 | ||
83 | - if(codec->avctx->codec_id == CODEC_ID_MP3) | |
84 | + if(codec->avctx->codec_id == AV_CODEC_ID_MP3) | |
85 | { | |
86 | if(codec->bytes_in_chunk_buffer < 4) | |
87 | { | |
88 | @@ -756,7 +761,7 @@ | |
89 | ||
90 | #if DECODE_AUDIO3 || DECODE_AUDIO4 | |
91 | codec->pkt.data = &codec->chunk_buffer[bytes_used]; | |
92 | - codec->pkt.size = codec->bytes_in_chunk_buffer + FF_INPUT_BUFFER_PADDING_SIZE; | |
93 | + codec->pkt.size = codec->bytes_in_chunk_buffer + AV_INPUT_BUFFER_PADDING_SIZE; | |
94 | ||
95 | #if DECODE_AUDIO4 | |
96 | ||
97 | @@ -793,7 +798,7 @@ | |
98 | (codec->sample_buffer_end - codec->sample_buffer_start)], | |
99 | &bytes_decoded, | |
100 | &codec->chunk_buffer[bytes_used], | |
101 | - codec->bytes_in_chunk_buffer + FF_INPUT_BUFFER_PADDING_SIZE); | |
102 | + codec->bytes_in_chunk_buffer + AV_INPUT_BUFFER_PADDING_SIZE); | |
103 | #endif | |
104 | if(frame_bytes < 0) | |
105 | { | |
106 | @@ -806,7 +811,7 @@ | |
107 | ||
108 | if(bytes_decoded < 0) | |
109 | { | |
110 | - if(codec->avctx->codec_id == CODEC_ID_MP3) | |
111 | + if(codec->avctx->codec_id == AV_CODEC_ID_MP3) | |
112 | { | |
113 | /* For mp3, bytes_decoded < 0 means, that the frame should be muted */ | |
114 | memset(&codec->sample_buffer[track_map->channels * (codec->sample_buffer_end - | |
115 | @@ -833,7 +838,7 @@ | |
116 | } | |
117 | } | |
118 | ||
119 | - /* This happens because ffmpeg adds FF_INPUT_BUFFER_PADDING_SIZE to the bytes returned */ | |
120 | + /* This happens because ffmpeg adds AV_INPUT_BUFFER_PADDING_SIZE to the bytes returned */ | |
121 | ||
122 | if(codec->bytes_in_chunk_buffer < 0) | |
123 | codec->bytes_in_chunk_buffer = 0; | |
124 | @@ -866,8 +871,8 @@ | |
125 | quicktime_audio_map_t *track_map = &file->atracks[track]; | |
126 | quicktime_ffmpeg_audio_codec_t *codec = track_map->codec->priv; | |
127 | ||
128 | - if((codec->decoder->id == CODEC_ID_MP2) || | |
129 | - (codec->decoder->id == CODEC_ID_MP3)) | |
130 | + if((codec->decoder->id == AV_CODEC_ID_MP2) || | |
131 | + (codec->decoder->id == AV_CODEC_ID_MP3)) | |
132 | { | |
133 | mpa_header h; | |
134 | uint32_t header; | |
135 | @@ -909,7 +914,7 @@ | |
136 | else | |
137 | track_map->ci.bitrate = h.bitrate; | |
138 | } | |
139 | - else if(codec->decoder->id == CODEC_ID_AC3) | |
140 | + else if(codec->decoder->id == AV_CODEC_ID_AC3) | |
141 | { | |
142 | a52_header h; | |
143 | uint8_t * ptr; | |
144 | @@ -986,7 +991,7 @@ | |
145 | #endif | |
146 | /* Some codecs need extra stuff */ | |
147 | ||
148 | - if(codec->decoder->id == CODEC_ID_ALAC) | |
149 | + if(codec->decoder->id == AV_CODEC_ID_ALAC) | |
150 | { | |
151 | header = quicktime_wave_get_user_atom(track_map->track, "alac", &header_len); | |
152 | if(header) | |
153 | @@ -995,7 +1000,7 @@ | |
154 | codec->avctx->extradata_size = header_len; | |
155 | } | |
156 | } | |
157 | - if(codec->decoder->id == CODEC_ID_QDM2) | |
158 | + if(codec->decoder->id == AV_CODEC_ID_QDM2) | |
159 | { | |
160 | header = quicktime_wave_get_user_atom(track_map->track, "QDCA", &header_len); | |
161 | if(header) | |
162 | @@ -1261,7 +1266,7 @@ | |
163 | pkt.data = codec->chunk_buffer; | |
164 | pkt.size = codec->chunk_buffer_alloc; | |
165 | ||
166 | - avcodec_get_frame_defaults(&f); | |
167 | + av_frame_unref(&f); | |
168 | f.nb_samples = codec->avctx->frame_size; | |
169 | ||
170 | avcodec_fill_audio_frame(&f, channels, codec->avctx->sample_fmt, | |
171 | @@ -1495,9 +1500,9 @@ | |
172 | codec_base->decode_audio = lqt_ffmpeg_decode_audio; | |
173 | codec_base->set_parameter = set_parameter; | |
174 | ||
175 | - if((decoder->id == CODEC_ID_MP3) || (decoder->id == CODEC_ID_MP2)) | |
176 | + if((decoder->id == AV_CODEC_ID_MP3) || (decoder->id == AV_CODEC_ID_MP2)) | |
177 | codec_base->read_packet = read_packet_mpa; | |
178 | - else if(decoder->id == CODEC_ID_AC3) | |
179 | + else if(decoder->id == AV_CODEC_ID_AC3) | |
180 | { | |
181 | codec_base->write_packet = write_packet_ac3; | |
182 | codec_base->read_packet = read_packet_ac3; | |
183 | diff -Naur a/plugins/ffmpeg/ffmpeg.h b/plugins/ffmpeg/ffmpeg.h | |
184 | --- a/plugins/ffmpeg/ffmpeg.h 2012-02-15 19:48:30.000000000 +0000 | |
185 | +++ b/plugins/ffmpeg/ffmpeg.h 2018-05-11 23:10:24.204992468 +0100 | |
186 | @@ -27,6 +27,7 @@ | |
187 | ||
188 | #include <quicktime/qtprivate.h> | |
189 | #include AVCODEC_HEADER | |
190 | +#include <libavutil/mem.h> | |
191 | ||
192 | void quicktime_init_video_codec_ffmpeg(quicktime_codec_t * codec, | |
193 | quicktime_video_map_t *vtrack, | |
194 | diff -Naur a/plugins/ffmpeg/lqt_ffmpeg.c b/plugins/ffmpeg/lqt_ffmpeg.c | |
195 | --- a/plugins/ffmpeg/lqt_ffmpeg.c 2012-02-15 19:48:30.000000000 +0000 | |
196 | +++ b/plugins/ffmpeg/lqt_ffmpeg.c 2018-05-11 23:15:07.583985628 +0100 | |
197 | @@ -386,7 +386,7 @@ | |
198 | struct CODECIDMAP codecidmap_v[] = | |
199 | { | |
200 | { | |
201 | - .id = CODEC_ID_MPEG1VIDEO, | |
202 | + .id = AV_CODEC_ID_MPEG1VIDEO, | |
203 | .index = -1, | |
204 | .encoder = NULL, | |
205 | .decoder = NULL, | |
206 | @@ -397,7 +397,7 @@ | |
207 | .wav_ids = { LQT_WAV_ID_NONE } | |
208 | }, | |
209 | { | |
210 | - .id = CODEC_ID_MPEG4, | |
211 | + .id = AV_CODEC_ID_MPEG4, | |
212 | .index = -1, | |
213 | .encoder = NULL, | |
214 | .decoder = NULL, | |
215 | @@ -415,7 +415,7 @@ | |
216 | .compression_id = LQT_COMPRESSION_MPEG4_ASP, | |
217 | }, | |
218 | { | |
219 | - .id = CODEC_ID_MSMPEG4V1, | |
220 | + .id = AV_CODEC_ID_MSMPEG4V1, | |
221 | .index = -1, | |
222 | .encoder = NULL, | |
223 | .decoder = NULL, | |
224 | @@ -426,7 +426,7 @@ | |
225 | .wav_ids = { LQT_WAV_ID_NONE }, | |
226 | }, | |
227 | { | |
228 | - .id = CODEC_ID_MSMPEG4V2, | |
229 | + .id = AV_CODEC_ID_MSMPEG4V2, | |
230 | .index = -1, | |
231 | .encoder = NULL, | |
232 | .decoder = NULL, | |
233 | @@ -437,7 +437,7 @@ | |
234 | .wav_ids = { LQT_WAV_ID_NONE }, | |
235 | }, | |
236 | { | |
237 | - .id = CODEC_ID_MSMPEG4V3, | |
238 | + .id = AV_CODEC_ID_MSMPEG4V3, | |
239 | .index = -1, | |
240 | .encoder = NULL, | |
241 | .decoder = NULL, | |
242 | @@ -453,7 +453,7 @@ | |
243 | .do_encode = 1, | |
244 | }, | |
245 | { | |
246 | - .id = CODEC_ID_MSMPEG4V3, | |
247 | + .id = AV_CODEC_ID_MSMPEG4V3, | |
248 | .index = -1, | |
249 | .encoder = NULL, | |
250 | .decoder = NULL, | |
251 | @@ -468,7 +468,7 @@ | |
252 | }, | |
253 | #if 0 | |
254 | { | |
255 | - .id = CODEC_ID_WMV1, | |
256 | + .id = AV_CODEC_ID_WMV1, | |
257 | .index = -1, | |
258 | .encoder = NULL, | |
259 | .decoder = NULL, | |
260 | @@ -481,7 +481,7 @@ | |
261 | }, | |
262 | #endif | |
263 | { | |
264 | - .id = CODEC_ID_H263, | |
265 | + .id = AV_CODEC_ID_H263, | |
266 | .index = -1, | |
267 | .encoder = NULL, | |
268 | .decoder = NULL, | |
269 | @@ -493,7 +493,7 @@ | |
270 | .compatibility_flags = LQT_FILE_QT_OLD | LQT_FILE_QT | LQT_FILE_MP4 | LQT_FILE_3GP, | |
271 | }, | |
272 | { | |
273 | - .id = CODEC_ID_H263, | |
274 | + .id = AV_CODEC_ID_H263, | |
275 | .index = -1, | |
276 | .encoder = NULL, | |
277 | .decoder = NULL, | |
278 | @@ -508,7 +508,7 @@ | |
279 | .do_encode = 1, | |
280 | }, | |
281 | { | |
282 | - .id = CODEC_ID_H264, | |
283 | + .id = AV_CODEC_ID_H264, | |
284 | .index = -1, | |
285 | .encoder = NULL, | |
286 | .decoder = NULL, | |
287 | @@ -519,7 +519,7 @@ | |
288 | .wav_ids = { LQT_WAV_ID_NONE }, | |
289 | }, | |
290 | { | |
291 | - .id = CODEC_ID_H263P, | |
292 | + .id = AV_CODEC_ID_H263P, | |
293 | .index = -1, | |
294 | .encoder = NULL, | |
295 | .decoder = NULL, | |
296 | @@ -533,7 +533,7 @@ | |
297 | .do_encode = 1, | |
298 | }, | |
299 | { | |
300 | - .id = CODEC_ID_H263I, | |
301 | + .id = AV_CODEC_ID_H263I, | |
302 | .index = -1, | |
303 | .encoder = NULL, | |
304 | .decoder = NULL, | |
305 | @@ -544,7 +544,7 @@ | |
306 | .wav_ids = { LQT_WAV_ID_NONE }, | |
307 | }, | |
308 | { | |
309 | - .id = CODEC_ID_SVQ1, | |
310 | + .id = AV_CODEC_ID_SVQ1, | |
311 | .index = -1, | |
312 | .encoder = NULL, | |
313 | .decoder = NULL, | |
314 | @@ -555,7 +555,7 @@ | |
315 | .wav_ids = { LQT_WAV_ID_NONE }, | |
316 | }, | |
317 | { | |
318 | - .id = CODEC_ID_SVQ3, | |
319 | + .id = AV_CODEC_ID_SVQ3, | |
320 | .index = -1, | |
321 | .encoder = NULL, | |
322 | .decoder = NULL, | |
323 | @@ -566,7 +566,7 @@ | |
324 | .wav_ids = { LQT_WAV_ID_NONE }, | |
325 | }, | |
326 | { | |
327 | - .id = CODEC_ID_MJPEG, | |
328 | + .id = AV_CODEC_ID_MJPEG, | |
329 | .index = -1, | |
330 | .encoder = NULL, | |
331 | .decoder = NULL, | |
332 | @@ -580,7 +580,7 @@ | |
333 | .do_encode = 1, | |
334 | }, | |
335 | { | |
336 | - .id = CODEC_ID_MJPEGB, | |
337 | + .id = AV_CODEC_ID_MJPEGB, | |
338 | .index = -1, | |
339 | .encoder = NULL, | |
340 | .decoder = NULL, | |
341 | @@ -594,7 +594,7 @@ | |
342 | }, | |
343 | #if LIBAVCODEC_BUILD >= 3346688 | |
344 | { | |
345 | - .id = CODEC_ID_TARGA, | |
346 | + .id = AV_CODEC_ID_TARGA, | |
347 | .index = -1, | |
348 | .encoder = NULL, | |
349 | .decoder = NULL, | |
350 | @@ -606,7 +606,7 @@ | |
351 | #endif | |
352 | #if LIBAVCODEC_BUILD >= 3347456 | |
353 | { | |
354 | - .id = CODEC_ID_TIFF, | |
355 | + .id = AV_CODEC_ID_TIFF, | |
356 | .index = -1, | |
357 | .encoder = NULL, | |
358 | .decoder = NULL, | |
359 | @@ -617,7 +617,7 @@ | |
360 | }, | |
361 | #endif | |
362 | { | |
363 | - .id = CODEC_ID_8BPS, | |
364 | + .id = AV_CODEC_ID_8BPS, | |
365 | .index = -1, | |
366 | .encoder = NULL, | |
367 | .decoder = NULL, | |
368 | @@ -627,7 +627,7 @@ | |
369 | .wav_ids = { LQT_WAV_ID_NONE }, | |
370 | }, | |
371 | { | |
372 | - .id = CODEC_ID_INDEO3, | |
373 | + .id = AV_CODEC_ID_INDEO3, | |
374 | .index = -1, | |
375 | .encoder = NULL, | |
376 | .decoder = NULL, | |
377 | @@ -638,7 +638,7 @@ | |
378 | .wav_ids = { LQT_WAV_ID_NONE }, | |
379 | }, | |
380 | { | |
381 | - .id = CODEC_ID_RPZA, | |
382 | + .id = AV_CODEC_ID_RPZA, | |
383 | .index = -1, | |
384 | .encoder = NULL, | |
385 | .decoder = NULL, | |
386 | @@ -648,7 +648,7 @@ | |
387 | .wav_ids = { LQT_WAV_ID_NONE }, | |
388 | }, | |
389 | { | |
390 | - .id = CODEC_ID_SMC, | |
391 | + .id = AV_CODEC_ID_SMC, | |
392 | .index = -1, | |
393 | .encoder = NULL, | |
394 | .decoder = NULL, | |
395 | @@ -658,7 +658,7 @@ | |
396 | .wav_ids = { LQT_WAV_ID_NONE }, | |
397 | }, | |
398 | { | |
399 | - .id = CODEC_ID_CINEPAK, | |
400 | + .id = AV_CODEC_ID_CINEPAK, | |
401 | .index = -1, | |
402 | .encoder = NULL, | |
403 | .decoder = NULL, | |
404 | @@ -669,7 +669,7 @@ | |
405 | .wav_ids = { LQT_WAV_ID_NONE }, | |
406 | }, | |
407 | { | |
408 | - .id = CODEC_ID_CYUV, | |
409 | + .id = AV_CODEC_ID_CYUV, | |
410 | .index = -1, | |
411 | .encoder = NULL, | |
412 | .decoder = NULL, | |
413 | @@ -680,7 +680,7 @@ | |
414 | .wav_ids = { LQT_WAV_ID_NONE }, | |
415 | }, | |
416 | { | |
417 | - .id = CODEC_ID_QTRLE, | |
418 | + .id = AV_CODEC_ID_QTRLE, | |
419 | .index = -1, | |
420 | .encoder = NULL, | |
421 | .decoder = NULL, | |
422 | @@ -693,7 +693,7 @@ | |
423 | .encoding_colormodels = (int[]){ BC_RGB888, BC_RGBA8888, LQT_COLORMODEL_NONE }, | |
424 | }, | |
425 | { | |
426 | - .id = CODEC_ID_MSRLE, | |
427 | + .id = AV_CODEC_ID_MSRLE, | |
428 | .index = -1, | |
429 | .encoder = NULL, | |
430 | .decoder = NULL, | |
431 | @@ -703,7 +703,7 @@ | |
432 | .wav_ids = { LQT_WAV_ID_NONE }, | |
433 | }, | |
434 | { | |
435 | - .id = CODEC_ID_DVVIDEO, | |
436 | + .id = AV_CODEC_ID_DVVIDEO, | |
437 | .index = -1, | |
438 | .encoder = NULL, | |
439 | .decoder = NULL, | |
440 | @@ -719,7 +719,7 @@ | |
441 | .image_sizes = image_sizes_dv, | |
442 | }, | |
443 | { | |
444 | - .id = CODEC_ID_DVVIDEO, | |
445 | + .id = AV_CODEC_ID_DVVIDEO, | |
446 | .index = -1, | |
447 | .encoder = NULL, | |
448 | .decoder = NULL, | |
449 | @@ -735,7 +735,7 @@ | |
450 | .image_sizes = image_sizes_dv, | |
451 | }, | |
452 | { | |
453 | - .id = CODEC_ID_DVVIDEO, | |
454 | + .id = AV_CODEC_ID_DVVIDEO, | |
455 | .index = -1, | |
456 | .encoder = NULL, | |
457 | .decoder = NULL, | |
458 | @@ -751,7 +751,7 @@ | |
459 | }, | |
460 | /* DVCPRO HD (decoding only for now) */ | |
461 | { | |
462 | - .id = CODEC_ID_DVVIDEO, | |
463 | + .id = AV_CODEC_ID_DVVIDEO, | |
464 | .index = -1, | |
465 | .encoder = NULL, | |
466 | .decoder = NULL, | |
467 | @@ -772,7 +772,7 @@ | |
468 | // .do_encode = 1 | |
469 | }, | |
470 | { | |
471 | - .id = CODEC_ID_FFVHUFF, | |
472 | + .id = AV_CODEC_ID_FFVHUFF, | |
473 | .index = -1, | |
474 | .encoder = NULL, | |
475 | .decoder = NULL, | |
476 | @@ -785,7 +785,7 @@ | |
477 | .do_encode = 1 | |
478 | }, | |
479 | { | |
480 | - .id = CODEC_ID_FFV1, | |
481 | + .id = AV_CODEC_ID_FFV1, | |
482 | .index = -1, | |
483 | .encoder = NULL, | |
484 | .decoder = NULL, | |
485 | @@ -801,7 +801,7 @@ | |
486 | }, | |
487 | #if LIBAVCODEC_BUILD >= 3352576 | |
488 | { | |
489 | - .id = CODEC_ID_DNXHD, | |
490 | + .id = AV_CODEC_ID_DNXHD, | |
491 | .index = -1, | |
492 | .encoder = NULL, | |
493 | .decoder = NULL, | |
494 | @@ -817,7 +817,7 @@ | |
495 | }, | |
496 | #endif | |
497 | { | |
498 | - .id = CODEC_ID_MPEG2VIDEO, | |
499 | + .id = AV_CODEC_ID_MPEG2VIDEO, | |
500 | .index = -1, | |
501 | .encoder = NULL, | |
502 | .decoder = NULL, | |
503 | @@ -839,7 +839,7 @@ | |
504 | struct CODECIDMAP codecidmap_a[] = | |
505 | { | |
506 | { | |
507 | - .id = CODEC_ID_MP3, | |
508 | + .id = AV_CODEC_ID_MP3, | |
509 | .index = -1, | |
510 | .encoder = NULL, | |
511 | .decoder = NULL, | |
512 | @@ -851,7 +851,7 @@ | |
513 | .wav_ids = { 0x50, 0x55, LQT_WAV_ID_NONE }, | |
514 | }, | |
515 | { | |
516 | - .id = CODEC_ID_MP2, | |
517 | + .id = AV_CODEC_ID_MP2, | |
518 | .index = -1, | |
519 | .encoder = NULL, | |
520 | .decoder = NULL, | |
521 | @@ -866,7 +866,7 @@ | |
522 | .compression_id = LQT_COMPRESSION_MP2, | |
523 | }, | |
524 | { | |
525 | - .id = CODEC_ID_AC3, | |
526 | + .id = AV_CODEC_ID_AC3, | |
527 | .index = -1, | |
528 | .encoder = NULL, | |
529 | .decoder = NULL, | |
530 | @@ -881,7 +881,7 @@ | |
531 | .compression_id = LQT_COMPRESSION_AC3, | |
532 | }, | |
533 | { | |
534 | - .id = CODEC_ID_QDM2, | |
535 | + .id = AV_CODEC_ID_QDM2, | |
536 | .index = -1, | |
537 | .encoder = NULL, | |
538 | .decoder = NULL, | |
539 | @@ -896,7 +896,7 @@ | |
540 | #if 1 | |
541 | /* Doesn't work as long as audio chunks are not split into VBR "Samples" */ | |
542 | { | |
543 | - .id = CODEC_ID_ALAC, | |
544 | + .id = AV_CODEC_ID_ALAC, | |
545 | .index = -1, | |
546 | .encoder = NULL, | |
547 | .decoder = NULL, | |
548 | @@ -909,7 +909,7 @@ | |
549 | #if 1 | |
550 | /* Sounds ugly */ | |
551 | { | |
552 | - .id = CODEC_ID_ADPCM_MS, | |
553 | + .id = AV_CODEC_ID_ADPCM_MS, | |
554 | .index = -1, | |
555 | .encoder = NULL, | |
556 | .decoder = NULL, | |
557 | @@ -922,7 +922,7 @@ | |
558 | #if 1 | |
559 | /* Sounds ugly */ | |
560 | { | |
561 | - .id = CODEC_ID_ADPCM_IMA_WAV, | |
562 | + .id = AV_CODEC_ID_ADPCM_IMA_WAV, | |
563 | .index = -1, | |
564 | .encoder = NULL, | |
565 | .decoder = NULL, | |
566 | diff -Naur a/plugins/ffmpeg/params.c b/plugins/ffmpeg/params.c | |
567 | --- a/plugins/ffmpeg/params.c 2012-03-07 14:10:41.000000000 +0000 | |
568 | +++ b/plugins/ffmpeg/params.c 2018-05-11 23:11:59.803990160 +0100 | |
569 | @@ -101,6 +101,17 @@ | |
570 | } \ | |
571 | } | |
572 | ||
573 | +#define PARAM_DICT_INT(name, dict_name) \ | |
574 | + { \ | |
575 | + if(!strcasecmp(name, key)) \ | |
576 | + { \ | |
577 | + char buf[128]; \ | |
578 | + snprintf(buf, sizeof(buf), "%d", *(int*)value); \ | |
579 | + av_dict_set(options, dict_name, buf, 0); \ | |
580 | + found = 1; \ | |
581 | + } \ | |
582 | + } | |
583 | + | |
584 | #define PARAM_DICT_FLAG(name, dict_name) \ | |
585 | { \ | |
586 | if(!strcasecmp(name, key)) \ | |
587 | @@ -113,16 +124,6 @@ | |
588 | } | |
589 | ||
590 | ||
591 | -enum_t me_method[] = | |
592 | - { | |
593 | - { "Zero", ME_ZERO }, | |
594 | - { "Phods", ME_PHODS }, | |
595 | - { "Log", ME_LOG }, | |
596 | - { "X1", ME_X1 }, | |
597 | - { "Epzs", ME_EPZS }, | |
598 | - { "Full", ME_FULL } | |
599 | - }; | |
600 | - | |
601 | enum_t prediction_method[] = | |
602 | { | |
603 | { "Left", FF_PRED_LEFT }, | |
604 | @@ -152,15 +153,6 @@ | |
605 | { "Rate distoration", FF_MB_DECISION_RD } | |
606 | }; | |
607 | ||
608 | -enum_t coder_type[] = | |
609 | - { | |
610 | - { "VLC", FF_CODER_TYPE_VLC }, | |
611 | - { "Arithmetic", FF_CODER_TYPE_AC }, | |
612 | - { "Raw", FF_CODER_TYPE_RAW }, | |
613 | - { "RLE", FF_CODER_TYPE_RLE }, | |
614 | - { "Deflate", FF_CODER_TYPE_DEFLATE }, | |
615 | - }; | |
616 | - | |
617 | #define PARAM_ENUM(name, var, arr) \ | |
618 | if(!strcasecmp(key, name)) \ | |
619 | { \ | |
620 | @@ -192,7 +184,7 @@ | |
621 | PARAM_INT_SCALE("ff_bit_rate_audio",bit_rate,1000); | |
622 | PARAM_INT_SCALE("ff_bit_rate_video",bit_rate,1000); | |
623 | PARAM_INT_SCALE("ff_bit_rate_tolerance",bit_rate_tolerance,1000); | |
624 | - PARAM_ENUM("ff_me_method",me_method,me_method); | |
625 | + PARAM_DICT_INT("ff_me_method","motion-est"); | |
626 | PARAM_INT("ff_gop_size",gop_size); | |
627 | PARAM_FLOAT("ff_qcompress",qcompress); | |
628 | PARAM_FLOAT("ff_qblur",qblur); | |
629 | @@ -202,17 +194,23 @@ | |
630 | PARAM_INT("ff_max_b_frames",max_b_frames); | |
631 | PARAM_FLOAT("ff_b_quant_factor",b_quant_factor); | |
632 | PARAM_INT("ff_b_frame_strategy",b_frame_strategy); | |
633 | + | |
634 | +#if LIBAVCODEC_VERSION_MAJOR >= 55 | |
635 | + PARAM_DICT_INT("ff_luma_elim_threshold","luma_elim_threshold"); | |
636 | + PARAM_DICT_INT("ff_chroma_elim_threshold","chroma_elim_threshold"); | |
637 | +#else | |
638 | PARAM_INT("ff_luma_elim_threshold",luma_elim_threshold); | |
639 | PARAM_INT("ff_chroma_elim_threshold",chroma_elim_threshold); | |
640 | +#endif | |
641 | + | |
642 | PARAM_INT("ff_strict_std_compliance",strict_std_compliance); | |
643 | PARAM_QP2LAMBDA("ff_b_quant_offset",b_quant_offset); | |
644 | PARAM_INT("ff_rc_min_rate",rc_min_rate); | |
645 | PARAM_INT("ff_rc_max_rate",rc_max_rate); | |
646 | PARAM_INT_SCALE("ff_rc_buffer_size",rc_buffer_size,1000); | |
647 | - PARAM_FLOAT("ff_rc_buffer_aggressivity",rc_buffer_aggressivity); | |
648 | PARAM_FLOAT("ff_i_quant_factor",i_quant_factor); | |
649 | PARAM_QP2LAMBDA("ff_i_quant_offset",i_quant_offset); | |
650 | - PARAM_FLOAT("ff_rc_initial_cplx",rc_initial_cplx); | |
651 | + PARAM_DICT_INT("ff_rc_initial_cplx","rc_init_cplx"); | |
652 | PARAM_FLOAT("ff_lumi_masking",lumi_masking); | |
653 | PARAM_FLOAT("ff_temporal_cplx_masking",temporal_cplx_masking); | |
654 | PARAM_FLOAT("ff_spatial_cplx_masking",spatial_cplx_masking); | |
655 | @@ -237,58 +235,68 @@ | |
656 | PARAM_INT("ff_me_range",me_range); | |
657 | PARAM_ENUM("ff_mb_decision",mb_decision,mb_decision); | |
658 | PARAM_INT("ff_scenechange_threshold",scenechange_threshold); | |
659 | - PARAM_QP2LAMBDA("ff_lmin", lmin); | |
660 | - PARAM_QP2LAMBDA("ff_lmax", lmax); | |
661 | + PARAM_DICT_INT("ff_lmin", "lmin"); | |
662 | + PARAM_DICT_INT("ff_lmax", "lmax"); | |
663 | PARAM_INT("ff_noise_reduction",noise_reduction); | |
664 | PARAM_INT_SCALE("ff_rc_initial_buffer_occupancy",rc_initial_buffer_occupancy,1000); | |
665 | + | |
666 | +#if LIBAVCODEC_VERSION_MAJOR >= 55 | |
667 | + PARAM_DICT_INT("ff_inter_threshold","inter_threshold"); | |
668 | + PARAM_DICT_INT("ff_quantizer_noise_shaping","quantizer_noise_shaping"); | |
669 | +#else | |
670 | PARAM_INT("ff_inter_threshold",inter_threshold); | |
671 | PARAM_INT("ff_quantizer_noise_shaping",quantizer_noise_shaping); | |
672 | +#endif | |
673 | + | |
674 | PARAM_INT("ff_thread_count",thread_count); | |
675 | - PARAM_INT("ff_me_threshold",me_threshold); | |
676 | - PARAM_INT("ff_mb_threshold",mb_threshold); | |
677 | PARAM_INT("ff_nsse_weight",nsse_weight); | |
678 | - PARAM_FLOAT("ff_border_masking",border_masking); | |
679 | + PARAM_DICT_INT("ff_border_masking","border_mask"); | |
680 | PARAM_QP2LAMBDA("ff_mb_lmin", mb_lmin); | |
681 | PARAM_QP2LAMBDA("ff_mb_lmax", mb_lmax); | |
682 | PARAM_INT("ff_me_penalty_compensation",me_penalty_compensation); | |
683 | PARAM_INT("ff_bidir_refine",bidir_refine); | |
684 | PARAM_INT("ff_brd_scale",brd_scale); | |
685 | - PARAM_INT("ff_scenechange_factor",scenechange_factor); | |
686 | - PARAM_FLAG("ff_flag_qscale",CODEC_FLAG_QSCALE); | |
687 | - PARAM_FLAG("ff_flag_4mv",CODEC_FLAG_4MV); | |
688 | - PARAM_FLAG("ff_flag_qpel",CODEC_FLAG_QPEL); | |
689 | - PARAM_FLAG("ff_flag_gmc",CODEC_FLAG_GMC); | |
690 | - PARAM_FLAG("ff_flag_mv0",CODEC_FLAG_MV0); | |
691 | + PARAM_FLAG("ff_flag_qscale",AV_CODEC_FLAG_QSCALE); | |
692 | + PARAM_FLAG("ff_flag_4mv",AV_CODEC_FLAG_4MV); | |
693 | + PARAM_FLAG("ff_flag_qpel",AV_CODEC_FLAG_QPEL); | |
694 | + PARAM_DICT_FLAG("ff_flag_gmc","gmc"); | |
695 | + PARAM_DICT_FLAG("ff_flag_mv0","mpv_flags"); | |
696 | // PARAM_FLAG("ff_flag_part",CODEC_FLAG_PART); // Unused | |
697 | - PARAM_FLAG("ff_flag_gray",CODEC_FLAG_GRAY); | |
698 | - PARAM_FLAG("ff_flag_emu_edge",CODEC_FLAG_EMU_EDGE); | |
699 | - PARAM_FLAG("ff_flag_normalize_aqp",CODEC_FLAG_NORMALIZE_AQP); | |
700 | + PARAM_FLAG("ff_flag_gray",AV_CODEC_FLAG_GRAY); | |
701 | + PARAM_DICT_FLAG("ff_flag_normalize_aqp","naq"); | |
702 | // PARAM_FLAG("ff_flag_alt_scan",CODEC_FLAG_ALT_SCAN); // Unused | |
703 | #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0) | |
704 | PARAM_FLAG("ff_flag_trellis_quant",CODEC_FLAG_TRELLIS_QUANT); | |
705 | #else | |
706 | PARAM_INT("ff_trellis",trellis); | |
707 | #endif | |
708 | - PARAM_FLAG("ff_flag_bitexact",CODEC_FLAG_BITEXACT); | |
709 | - PARAM_FLAG("ff_flag_ac_pred",CODEC_FLAG_AC_PRED); | |
710 | + PARAM_FLAG("ff_flag_bitexact",AV_CODEC_FLAG_BITEXACT); | |
711 | + PARAM_FLAG("ff_flag_ac_pred",AV_CODEC_FLAG_AC_PRED); | |
712 | // PARAM_FLAG("ff_flag_h263p_umv",CODEC_FLAG_H263P_UMV); // Unused | |
713 | - PARAM_FLAG("ff_flag_cbp_rd",CODEC_FLAG_CBP_RD); | |
714 | - PARAM_FLAG("ff_flag_qp_rd",CODEC_FLAG_QP_RD); | |
715 | + | |
716 | +#if LIBAVCODEC_VERSION_MAJOR >= 55 | |
717 | + PARAM_DICT_FLAG("ff_flag_cbp_rd","cbp_rd"); | |
718 | + PARAM_DICT_FLAG("ff_flag_qp_rd","qp_rd"); | |
719 | + PARAM_DICT_FLAG("ff_flag2_strict_gop","strict_gop"); | |
720 | +#else | |
721 | + PARAM_FLAG("ff_flag_cbp_rd",AV_CODEC_FLAG_CBP_RD); | |
722 | + PARAM_FLAG("ff_flag_qp_rd",AV_CODEC_FLAG_QP_RD); | |
723 | + PARAM_FLAG2("ff_flag2_strict_gop",AV_CODEC_FLAG2_STRICT_GOP); | |
724 | +#endif | |
725 | ||
726 | #if LIBAVCODEC_VERSION_MAJOR >= 54 | |
727 | PARAM_DICT_FLAG("ff_flag_h263p_aiv", "aiv"); | |
728 | PARAM_DICT_FLAG("ff_flag_obmc","obmc"); | |
729 | PARAM_DICT_FLAG("ff_flag_h263p_slice_struct","structured_slices"); | |
730 | #else | |
731 | - PARAM_FLAG("ff_flag_h263p_aiv",CODEC_FLAG_H263P_AIV); | |
732 | - PARAM_FLAG("ff_flag_obmc",CODEC_FLAG_OBMC); | |
733 | - PARAM_FLAG("ff_flag_h263p_slice_struct",CODEC_FLAG_H263P_SLICE_STRUCT); | |
734 | + PARAM_FLAG("ff_flag_h263p_aiv",AV_CODEC_FLAG_H263P_AIV); | |
735 | + PARAM_FLAG("ff_flag_obmc",AV_CODEC_FLAG_OBMC); | |
736 | + PARAM_FLAG("ff_flag_h263p_slice_struct",AV_CODEC_FLAG_H263P_SLICE_STRUCT); | |
737 | #endif | |
738 | ||
739 | - PARAM_FLAG("ff_flag_loop_filter",CODEC_FLAG_LOOP_FILTER); | |
740 | - PARAM_FLAG("ff_flag_closed_gop",CODEC_FLAG_CLOSED_GOP); | |
741 | - PARAM_FLAG2("ff_flag2_fast",CODEC_FLAG2_FAST); | |
742 | - PARAM_FLAG2("ff_flag2_strict_gop",CODEC_FLAG2_STRICT_GOP); | |
743 | - PARAM_ENUM("ff_coder_type",coder_type,coder_type); | |
744 | + PARAM_FLAG("ff_flag_loop_filter",AV_CODEC_FLAG_LOOP_FILTER); | |
745 | + PARAM_FLAG("ff_flag_closed_gop",AV_CODEC_FLAG_CLOSED_GOP); | |
746 | + PARAM_FLAG2("ff_flag2_fast",AV_CODEC_FLAG2_FAST); | |
747 | + PARAM_DICT_INT("ff_coder_type","coder"); | |
748 | ||
749 | } | |
750 | diff -Naur a/plugins/ffmpeg/params.h b/plugins/ffmpeg/params.h | |
751 | --- a/plugins/ffmpeg/params.h 2011-05-11 16:13:39.000000000 +0100 | |
752 | +++ b/plugins/ffmpeg/params.h 2018-05-11 23:11:59.803990160 +0100 | |
753 | @@ -149,7 +149,7 @@ | |
754 | .type = LQT_PARAMETER_INT, \ | |
755 | .val_default = { .val_int = 0 }, \ | |
756 | .val_min = { .val_int = 0 }, \ | |
757 | - .val_max = { .val_int = FF_MAX_B_FRAMES }, \ | |
758 | + .val_max = { .val_int = 16 }, \ | |
759 | .help_string = TRS("Maximum number of B-frames between non B-frames") \ | |
760 | } | |
761 | ||
762 | diff -Naur a/plugins/ffmpeg/video.c b/plugins/ffmpeg/video.c | |
763 | --- a/plugins/ffmpeg/video.c 2012-02-25 19:46:56.000000000 +0000 | |
764 | +++ b/plugins/ffmpeg/video.c 2018-05-11 23:15:15.697985432 +0100 | |
765 | @@ -37,10 +37,10 @@ | |
766 | #endif | |
767 | ||
768 | ||
769 | -#ifdef PIX_FMT_YUV422P10 | |
770 | -#define PIX_FMT_YUV422P10_OR_DUMMY PIX_FMT_YUV422P10 | |
771 | +#ifdef AV_PIX_FMT_YUV422P10 | |
772 | +#define AV_PIX_FMT_YUV422P10_OR_DUMMY AV_PIX_FMT_YUV422P10 | |
773 | #else | |
774 | -#define PIX_FMT_YUV422P10_OR_DUMMY -1234 | |
775 | +#define AV_PIX_FMT_YUV422P10_OR_DUMMY -1234 | |
776 | #endif | |
777 | ||
778 | #if LIBAVCODEC_VERSION_INT >= ((54<<16)|(1<<8)|0) | |
779 | @@ -90,9 +90,9 @@ | |
780 | int imx_bitrate; | |
781 | int imx_strip_vbi; | |
782 | ||
783 | - /* In some cases FFMpeg would report something like PIX_FMT_YUV422P, while | |
784 | - we would like to treat it as PIX_FMT_YUVJ422P. It's only used for decoding */ | |
785 | - enum PixelFormat reinterpret_pix_fmt; | |
786 | + /* In some cases FFMpeg would report something like AV_PIX_FMT_YUV422P, while | |
787 | + we would like to treat it as AV_PIX_FMT_YUVJ422P. It's only used for decoding */ | |
788 | + enum AVPixelFormat reinterpret_pix_fmt; | |
789 | ||
790 | int is_imx; | |
791 | int y_offset; | |
792 | @@ -137,42 +137,42 @@ | |
793 | ||
794 | static const struct | |
795 | { | |
796 | - enum PixelFormat ffmpeg_id; | |
797 | + enum AVPixelFormat ffmpeg_id; | |
798 | int lqt_id; | |
799 | int exact; | |
800 | } | |
801 | colormodels[] = | |
802 | { | |
803 | - { PIX_FMT_YUV420P, BC_YUV420P, 1 }, ///< Planar YUV 4:2:0 (1 Cr & Cb sample per 2x2 Y samples) | |
804 | + { AV_PIX_FMT_YUV420P, BC_YUV420P, 1 }, ///< Planar YUV 4:2:0 (1 Cr & Cb sample per 2x2 Y samples) | |
805 | #if LIBAVUTIL_VERSION_INT < (50<<16) | |
806 | - { PIX_FMT_YUV422, BC_YUV422, 1 }, | |
807 | + { AV_PIX_FMT_YUV422, BC_YUV422, 1 }, | |
808 | #else | |
809 | - { PIX_FMT_YUYV422, BC_YUV422, 1 }, | |
810 | + { AV_PIX_FMT_YUYV422, BC_YUV422, 1 }, | |
811 | #endif | |
812 | - { PIX_FMT_RGB24, BC_RGB888, 1 }, ///< Packed pixel, 3 bytes per pixel, RGBRGB... | |
813 | - { PIX_FMT_BGR24, BC_BGR888, 1 }, ///< Packed pixel, 3 bytes per pixel, BGRBGR... | |
814 | - { PIX_FMT_YUV422P, BC_YUV422P, 1 }, ///< Planar YUV 4:2:2 (1 Cr & Cb sample per 2x1 Y samples) | |
815 | - { PIX_FMT_YUV444P, BC_YUV444P, 1 }, ///< Planar YUV 4:4:4 (1 Cr & Cb sample per 1x1 Y samples) | |
816 | - { PIX_FMT_YUV411P, BC_YUV411P, 1 }, ///< Planar YUV 4:1:1 (1 Cr & Cb sample per 4x1 Y samples) | |
817 | - { PIX_FMT_YUV422P16, BC_YUV422P16, 1 }, ///< Planar 16 bit YUV 4:2:2 (1 Cr & Cb sample per 2x1 Y samples) | |
818 | -#ifdef PIX_FMT_YUV422P10 | |
819 | - { PIX_FMT_YUV422P10, BC_YUV422P10, 1 }, ///< 10 bit samples in uint16_t containers, planar 4:2:2 | |
820 | -#endif | |
821 | - { PIX_FMT_RGB565, BC_RGB565, 1 }, ///< always stored in cpu endianness | |
822 | - { PIX_FMT_YUVJ420P, BC_YUVJ420P, 1 }, ///< Planar YUV 4:2:0 full scale (jpeg) | |
823 | - { PIX_FMT_YUVJ422P, BC_YUVJ422P, 1 }, ///< Planar YUV 4:2:2 full scale (jpeg) | |
824 | - { PIX_FMT_YUVJ444P, BC_YUVJ444P, 1 }, ///< Planar YUV 4:4:4 full scale (jpeg) | |
825 | + { AV_PIX_FMT_RGB24, BC_RGB888, 1 }, ///< Packed pixel, 3 bytes per pixel, RGBRGB... | |
826 | + { AV_PIX_FMT_BGR24, BC_BGR888, 1 }, ///< Packed pixel, 3 bytes per pixel, BGRBGR... | |
827 | + { AV_PIX_FMT_YUV422P, BC_YUV422P, 1 }, ///< Planar YUV 4:2:2 (1 Cr & Cb sample per 2x1 Y samples) | |
828 | + { AV_PIX_FMT_YUV444P, BC_YUV444P, 1 }, ///< Planar YUV 4:4:4 (1 Cr & Cb sample per 1x1 Y samples) | |
829 | + { AV_PIX_FMT_YUV411P, BC_YUV411P, 1 }, ///< Planar YUV 4:1:1 (1 Cr & Cb sample per 4x1 Y samples) | |
830 | + { AV_PIX_FMT_YUV422P16, BC_YUV422P16, 1 }, ///< Planar 16 bit YUV 4:2:2 (1 Cr & Cb sample per 2x1 Y samples) | |
831 | +#ifdef AV_PIX_FMT_YUV422P10 | |
832 | + { AV_PIX_FMT_YUV422P10, BC_YUV422P10, 1 }, ///< 10 bit samples in uint16_t containers, planar 4:2:2 | |
833 | +#endif | |
834 | + { AV_PIX_FMT_RGB565, BC_RGB565, 1 }, ///< always stored in cpu endianness | |
835 | + { AV_PIX_FMT_YUVJ420P, BC_YUVJ420P, 1 }, ///< Planar YUV 4:2:0 full scale (jpeg) | |
836 | + { AV_PIX_FMT_YUVJ422P, BC_YUVJ422P, 1 }, ///< Planar YUV 4:2:2 full scale (jpeg) | |
837 | + { AV_PIX_FMT_YUVJ444P, BC_YUVJ444P, 1 }, ///< Planar YUV 4:4:4 full scale (jpeg) | |
838 | #if LIBAVUTIL_VERSION_INT < (50<<16) | |
839 | - { PIX_FMT_RGBA32, BC_RGBA8888, 0 }, ///< Packed pixel, 4 bytes per pixel, BGRABGRA... | |
840 | + { AV_PIX_FMT_RGBA32, BC_RGBA8888, 0 }, ///< Packed pixel, 4 bytes per pixel, BGRABGRA... | |
841 | #else | |
842 | - { PIX_FMT_RGB32, BC_RGBA8888, 0 }, ///< Packed pixel, 4 bytes per pixel, BGRABGRA... | |
843 | + { AV_PIX_FMT_RGB32, BC_RGBA8888, 0 }, ///< Packed pixel, 4 bytes per pixel, BGRABGRA... | |
844 | #endif | |
845 | - { PIX_FMT_RGB555, BC_RGB888, 0 }, ///< always stored in cpu endianness, most significant bit to 1 | |
846 | - { PIX_FMT_GRAY8, BC_RGB888, 0 }, | |
847 | - { PIX_FMT_MONOWHITE, BC_RGB888, 0 }, ///< 0 is white | |
848 | - { PIX_FMT_MONOBLACK, BC_RGB888, 0 }, ///< 0 is black | |
849 | - { PIX_FMT_PAL8, BC_RGB888, 0 }, ///< 8 bit with RGBA palette | |
850 | - { PIX_FMT_YUV410P, BC_YUV420P, 0 }, ///< Planar YUV 4:1:0 (1 Cr & Cb sample per 4x4 Y samples) | |
851 | + { AV_PIX_FMT_RGB555, BC_RGB888, 0 }, ///< always stored in cpu endianness, most significant bit to 1 | |
852 | + { AV_PIX_FMT_GRAY8, BC_RGB888, 0 }, | |
853 | + { AV_PIX_FMT_MONOWHITE, BC_RGB888, 0 }, ///< 0 is white | |
854 | + { AV_PIX_FMT_MONOBLACK, BC_RGB888, 0 }, ///< 0 is black | |
855 | + { AV_PIX_FMT_PAL8, BC_RGB888, 0 }, ///< 8 bit with RGBA palette | |
856 | + { AV_PIX_FMT_YUV410P, BC_YUV420P, 0 }, ///< Planar YUV 4:1:0 (1 Cr & Cb sample per 4x4 Y samples) | |
857 | }; | |
858 | ||
859 | static const struct | |
860 | @@ -343,16 +343,16 @@ | |
861 | if (!codec->pix_fmts) | |
862 | return 0; | |
863 | ||
864 | - for (i = 0; codec->pix_fmts[i] != PIX_FMT_NONE; ++i) | |
865 | + for (i = 0; codec->pix_fmts[i] != AV_PIX_FMT_NONE; ++i) | |
866 | { | |
867 | - if (codec->pix_fmts[i] == PIX_FMT_YUV422P10_OR_DUMMY) | |
868 | + if (codec->pix_fmts[i] == AV_PIX_FMT_YUV422P10_OR_DUMMY) | |
869 | return 1; | |
870 | } | |
871 | ||
872 | return 0; | |
873 | } | |
874 | ||
875 | -static enum PixelFormat lqt_ffmpeg_get_ffmpeg_colormodel(int id) | |
876 | +static enum AVPixelFormat lqt_ffmpeg_get_ffmpeg_colormodel(int id) | |
877 | { | |
878 | int i; | |
879 | ||
880 | @@ -361,10 +361,10 @@ | |
881 | if(colormodels[i].lqt_id == id) | |
882 | return colormodels[i].ffmpeg_id; | |
883 | } | |
884 | - return PIX_FMT_NB; | |
885 | + return AV_PIX_FMT_NB; | |
886 | } | |
887 | ||
888 | -static int lqt_ffmpeg_get_lqt_colormodel(enum PixelFormat id, int * exact) | |
889 | +static int lqt_ffmpeg_get_lqt_colormodel(enum AVPixelFormat id, int * exact) | |
890 | { | |
891 | int i; | |
892 | ||
893 | @@ -400,26 +400,26 @@ | |
894 | codec->reinterpret_pix_fmt = codec->avctx->pix_fmt; | |
895 | ||
896 | /* First we try codec-specific colormodel matching. */ | |
897 | - if(codec->decoder->id == CODEC_ID_DNXHD) | |
898 | + if(codec->decoder->id == AV_CODEC_ID_DNXHD) | |
899 | { | |
900 | - /* FFMpeg supports PIX_FMT_YUV422P and PIX_FMT_YUV422P10 for DNxHD, which | |
901 | - we sometimes interpret as PIX_FMT_YUVJ422P and PIX_FMT_YUVJ422P10. */ | |
902 | - if (codec->avctx->pix_fmt == PIX_FMT_YUV422P || codec->avctx->pix_fmt == PIX_FMT_YUV422P10_OR_DUMMY) | |
903 | + /* FFMpeg supports AV_PIX_FMT_YUV422P and AV_PIX_FMT_YUV422P10 for DNxHD, which | |
904 | + we sometimes interpret as AV_PIX_FMT_YUVJ422P and AV_PIX_FMT_YUVJ422P10. */ | |
905 | + if (codec->avctx->pix_fmt == AV_PIX_FMT_YUV422P || codec->avctx->pix_fmt == AV_PIX_FMT_YUV422P10_OR_DUMMY) | |
906 | { | |
907 | - int p10 = (codec->avctx->pix_fmt == PIX_FMT_YUV422P10_OR_DUMMY); | |
908 | + int p10 = (codec->avctx->pix_fmt == AV_PIX_FMT_YUV422P10_OR_DUMMY); | |
909 | *exact = 1; | |
910 | if (lqt_ffmpeg_get_avid_yuv_range(vtrack->track) == AVID_FULL_YUV_RANGE) | |
911 | { | |
912 | vtrack->stream_cmodel = p10 ? BC_YUVJ422P10 : BC_YUVJ422P; | |
913 | - codec->reinterpret_pix_fmt = p10 ? PIX_FMT_YUV422P10_OR_DUMMY : PIX_FMT_YUVJ422P; | |
914 | - // Note: reinterpret_pix_fmt should really be PIX_FMT_YUVJ422P10, except | |
915 | + codec->reinterpret_pix_fmt = p10 ? AV_PIX_FMT_YUV422P10_OR_DUMMY : AV_PIX_FMT_YUVJ422P; | |
916 | + // Note: reinterpret_pix_fmt should really be AV_PIX_FMT_YUVJ422P10, except | |
917 | // there is no such colormodel in FFMpeg. Fortunately, it's not a problem | |
918 | // in this case, as reinterpret_pix_fmt is only used when *exact == 0. | |
919 | } | |
920 | else | |
921 | { | |
922 | vtrack->stream_cmodel = p10 ? BC_YUV422P10 : BC_YUV422P; | |
923 | - codec->reinterpret_pix_fmt = p10 ? PIX_FMT_YUV422P10_OR_DUMMY : PIX_FMT_YUV422P; | |
924 | + codec->reinterpret_pix_fmt = p10 ? AV_PIX_FMT_YUV422P10_OR_DUMMY : AV_PIX_FMT_YUV422P; | |
925 | } | |
926 | return; | |
927 | } | |
928 | @@ -438,16 +438,16 @@ | |
929 | quicktime_ffmpeg_video_codec_t *codec = vtrack->codec->priv; | |
930 | codec->avctx->pix_fmt = lqt_ffmpeg_get_ffmpeg_colormodel(vtrack->stream_cmodel); | |
931 | ||
932 | - if (codec->encoder->id == CODEC_ID_DNXHD) | |
933 | + if (codec->encoder->id == AV_CODEC_ID_DNXHD) | |
934 | { | |
935 | - /* FFMpeg's DNxHD encoder only supports PIX_FMT_YUV422P and PIX_FMT_YUV422P10 | |
936 | - and doesn't know anything about PIX_FMT_YUVJ422P and PIX_FMT_YUVJ422P10 | |
937 | + /* FFMpeg's DNxHD encoder only supports AV_PIX_FMT_YUV422P and AV_PIX_FMT_YUV422P10 | |
938 | + and doesn't know anything about AV_PIX_FMT_YUVJ422P and AV_PIX_FMT_YUVJ422P10 | |
939 | (in fact, the latter doesn't even exist) */ | |
940 | - codec->avctx->pix_fmt = PIX_FMT_YUV422P; | |
941 | + codec->avctx->pix_fmt = AV_PIX_FMT_YUV422P; | |
942 | if (vtrack->stream_cmodel == BC_YUV422P10 || vtrack->stream_cmodel == BC_YUVJ422P10) | |
943 | { | |
944 | if (lqt_tenbit_dnxhd_supported(codec->encoder)) | |
945 | - codec->avctx->pix_fmt = PIX_FMT_YUV422P10_OR_DUMMY; | |
946 | + codec->avctx->pix_fmt = AV_PIX_FMT_YUV422P10_OR_DUMMY; | |
947 | } | |
948 | } | |
949 | } | |
950 | @@ -458,7 +458,7 @@ | |
951 | /* From avcodec.h: */ | |
952 | ||
953 | /* | |
954 | - * PIX_FMT_RGBA32 is handled in an endian-specific manner. A RGBA | |
955 | + * AV_PIX_FMT_RGBA32 is handled in an endian-specific manner. A RGBA | |
956 | * color is put together as: | |
957 | * (A << 24) | (R << 16) | (G << 8) | B | |
958 | * This is stored as BGRA on little endian CPU architectures and ARGB on | |
959 | @@ -530,7 +530,7 @@ | |
960 | */ | |
961 | ||
962 | static void convert_image_decode(quicktime_ffmpeg_video_codec_t *codec, | |
963 | - AVFrame * in_frame, enum PixelFormat in_format, | |
964 | + AVFrame * in_frame, enum AVPixelFormat in_format, | |
965 | unsigned char ** out_frame, int out_format, | |
966 | int width, int height, int row_span, int row_span_uv) | |
967 | { | |
968 | @@ -547,9 +547,9 @@ | |
969 | * RGBA format like in ffmpeg?? | |
970 | */ | |
971 | #if LIBAVUTIL_VERSION_INT < (50<<16) | |
972 | - if((in_format == PIX_FMT_RGBA32) && (out_format == BC_RGBA8888)) | |
973 | + if((in_format == AV_PIX_FMT_RGBA32) && (out_format == BC_RGBA8888)) | |
974 | #else | |
975 | - if((in_format == PIX_FMT_RGB32) && (out_format == BC_RGBA8888)) | |
976 | + if((in_format == AV_PIX_FMT_RGB32) && (out_format == BC_RGBA8888)) | |
977 | #endif | |
978 | { | |
979 | convert_image_decode_rgba(in_frame, out_frame, width, height, codec->y_offset); | |
980 | @@ -728,13 +728,13 @@ | |
981 | ||
982 | /* Set extradata: It's done differently for each codec */ | |
983 | ||
984 | - if(codec->decoder->id == CODEC_ID_SVQ3) | |
985 | + if(codec->decoder->id == AV_CODEC_ID_SVQ3) | |
986 | { | |
987 | extradata = trak->mdia.minf.stbl.stsd.table[0].table_raw + 4; | |
988 | extradata_size = trak->mdia.minf.stbl.stsd.table[0].table_raw_size - 4; | |
989 | ||
990 | } | |
991 | - else if(codec->decoder->id == CODEC_ID_H264) | |
992 | + else if(codec->decoder->id == AV_CODEC_ID_H264) | |
993 | { | |
994 | user_atom = quicktime_stsd_get_user_atom(trak, "avcC", &user_atom_len); | |
995 | ||
996 | @@ -753,7 +753,7 @@ | |
997 | } | |
998 | ||
999 | } | |
1000 | - else if(codec->decoder->id == CODEC_ID_MPEG4) | |
1001 | + else if(codec->decoder->id == AV_CODEC_ID_MPEG4) | |
1002 | { | |
1003 | if(trak->mdia.minf.stbl.stsd.table[0].has_esds) | |
1004 | { | |
1005 | @@ -781,7 +781,7 @@ | |
1006 | if(extradata) | |
1007 | { | |
1008 | codec->extradata = | |
1009 | - calloc(1, extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); | |
1010 | + calloc(1, extradata_size + AV_INPUT_BUFFER_PADDING_SIZE); | |
1011 | memcpy(codec->extradata, extradata, extradata_size); | |
1012 | codec->avctx->extradata_size = extradata_size; | |
1013 | codec->avctx->extradata = codec->extradata; | |
1014 | @@ -829,7 +829,7 @@ | |
1015 | if(avcodec_open2(codec->avctx, codec->decoder, NULL) != 0) | |
1016 | return -1; | |
1017 | #endif | |
1018 | - codec->frame = avcodec_alloc_frame(); | |
1019 | + codec->frame = av_frame_alloc(); | |
1020 | vtrack->stream_cmodel = LQT_COLORMODEL_NONE; | |
1021 | codec->initialized = 1; | |
1022 | } | |
1023 | @@ -929,10 +929,10 @@ | |
1024 | #ifdef HAVE_LIBSWSCALE | |
1025 | ||
1026 | #if LIBAVUTIL_VERSION_INT < (50<<16) | |
1027 | - if(!((codec->avctx->pix_fmt == PIX_FMT_RGBA32) && | |
1028 | + if(!((codec->avctx->pix_fmt == AV_PIX_FMT_RGBA32) && | |
1029 | (vtrack->stream_cmodel == BC_RGBA8888))) | |
1030 | #else | |
1031 | - if(!((codec->avctx->pix_fmt == PIX_FMT_RGB32) && | |
1032 | + if(!((codec->avctx->pix_fmt == AV_PIX_FMT_RGB32) && | |
1033 | (vtrack->stream_cmodel == BC_RGBA8888))) | |
1034 | #endif | |
1035 | { | |
1036 | @@ -947,15 +947,15 @@ | |
1037 | } | |
1038 | #endif | |
1039 | } | |
1040 | - if(codec->decoder->id == CODEC_ID_DVVIDEO) | |
1041 | + if(codec->decoder->id == AV_CODEC_ID_DVVIDEO) | |
1042 | { | |
1043 | if(vtrack->stream_cmodel == BC_YUV420P) | |
1044 | vtrack->chroma_placement = LQT_CHROMA_PLACEMENT_DVPAL; | |
1045 | vtrack->interlace_mode = LQT_INTERLACE_BOTTOM_FIRST; | |
1046 | vtrack->ci.id = LQT_COMPRESSION_DV; | |
1047 | } | |
1048 | - else if((codec->decoder->id == CODEC_ID_MPEG4) || | |
1049 | - (codec->decoder->id == CODEC_ID_H264)) | |
1050 | + else if((codec->decoder->id == AV_CODEC_ID_MPEG4) || | |
1051 | + (codec->decoder->id == AV_CODEC_ID_H264)) | |
1052 | { | |
1053 | if(vtrack->stream_cmodel == BC_YUV420P) | |
1054 | vtrack->chroma_placement = LQT_CHROMA_PLACEMENT_MPEG2; | |
1055 | @@ -1140,8 +1140,8 @@ | |
1056 | codec->avctx->qmin = 1; | |
1057 | codec->avctx->qmax = 3; | |
1058 | codec->avctx->rtp_payload_size = 1; // ?? | |
1059 | - codec->avctx->rc_buffer_aggressivity = 0.25; | |
1060 | - codec->avctx->flags |= CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_LOW_DELAY; | |
1061 | + av_dict_set(&codec->options, "rc_buf_aggressivity", "0.25", 0); | |
1062 | + codec->avctx->flags |= AV_CODEC_FLAG_INTERLACED_DCT|AV_CODEC_FLAG_LOW_DELAY; | |
1063 | ||
1064 | #if (LIBAVCODEC_VERSION_MAJOR < 54) | |
1065 | codec->avctx->flags2 |= CODEC_FLAG2_INTRA_VLC|CODEC_FLAG2_NON_LINEAR_QUANT; | |
1066 | @@ -1299,13 +1299,13 @@ | |
1067 | { | |
1068 | if(vtrack->stream_cmodel == BC_YUV420P) | |
1069 | { | |
1070 | - if(codec->encoder->id == CODEC_ID_MPEG4) | |
1071 | + if(codec->encoder->id == AV_CODEC_ID_MPEG4) | |
1072 | { | |
1073 | vtrack->chroma_placement = LQT_CHROMA_PLACEMENT_MPEG2; | |
1074 | /* enable interlaced encoding */ | |
1075 | vtrack->interlace_mode = LQT_INTERLACE_NONE; | |
1076 | } | |
1077 | - else if(codec->encoder->id == CODEC_ID_DVVIDEO) | |
1078 | + else if(codec->encoder->id == AV_CODEC_ID_DVVIDEO) | |
1079 | { | |
1080 | vtrack->chroma_placement = LQT_CHROMA_PLACEMENT_DVPAL; | |
1081 | } | |
1082 | @@ -1318,7 +1318,7 @@ | |
1083 | ||
1084 | if(!codec->initialized) | |
1085 | { | |
1086 | - codec->frame = avcodec_alloc_frame(); | |
1087 | + codec->frame = av_frame_alloc(); | |
1088 | ||
1089 | /* time_base is 1/framerate for constant framerate */ | |
1090 | ||
1091 | @@ -1328,7 +1328,7 @@ | |
1092 | // codec->avctx->time_base.den = 1; | |
1093 | // codec->avctx->time_base.num = lqt_video_time_scale(file, track); | |
1094 | ||
1095 | - if(codec->avctx->flags & CODEC_FLAG_QSCALE) | |
1096 | + if(codec->avctx->flags & AV_CODEC_FLAG_QSCALE) | |
1097 | codec->avctx->global_quality = codec->qscale; | |
1098 | ||
1099 | codec->avctx->width = width; | |
1100 | @@ -1340,11 +1340,11 @@ | |
1101 | codec->avctx->sample_aspect_ratio.num = pixel_width; | |
1102 | codec->avctx->sample_aspect_ratio.den = pixel_height; | |
1103 | /* Use global headers for mp4v */ | |
1104 | - if(codec->encoder->id == CODEC_ID_MPEG4) | |
1105 | + if(codec->encoder->id == AV_CODEC_ID_MPEG4) | |
1106 | { | |
1107 | if(!(file->file_type & (LQT_FILE_AVI|LQT_FILE_AVI_ODML))) | |
1108 | { | |
1109 | - codec->avctx->flags |= CODEC_FLAG_GLOBAL_HEADER; | |
1110 | + codec->avctx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER; | |
1111 | codec->write_global_header = 1; | |
1112 | } | |
1113 | ||
1114 | @@ -1360,16 +1360,16 @@ | |
1115 | { | |
1116 | lqt_log(file, LQT_LOG_INFO, LOG_DOMAIN, "Enabling interlaced encoding"); | |
1117 | codec->avctx->flags |= | |
1118 | - (CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_INTERLACED_ME|CODEC_FLAG_ALT_SCAN); | |
1119 | + (AV_CODEC_FLAG_INTERLACED_DCT|AV_CODEC_FLAG_INTERLACED_ME|AV_CODEC_FLAG_ALT_SCAN); | |
1120 | } | |
1121 | #endif | |
1122 | } | |
1123 | - else if((codec->encoder->id == CODEC_ID_MSMPEG4V3) && (trak->strl) && | |
1124 | + else if((codec->encoder->id == AV_CODEC_ID_MSMPEG4V3) && (trak->strl) && | |
1125 | !strncmp(trak->strl->strf.bh.biCompression, "DIV3", 4)) | |
1126 | { | |
1127 | strncpy(trak->strl->strh.fccHandler, "div3", 4); | |
1128 | } | |
1129 | - else if((codec->encoder->id == CODEC_ID_H263) && | |
1130 | + else if((codec->encoder->id == AV_CODEC_ID_H263) && | |
1131 | (file->file_type & (LQT_FILE_MP4|LQT_FILE_3GP))) | |
1132 | { | |
1133 | uint8_t d263_data[] = | |
1134 | @@ -1383,34 +1383,34 @@ | |
1135 | strncpy(trak->mdia.minf.stbl.stsd.table[0].format, | |
1136 | "s263", 4); | |
1137 | } | |
1138 | - else if(codec->encoder->id == CODEC_ID_FFVHUFF) | |
1139 | + else if(codec->encoder->id == AV_CODEC_ID_FFVHUFF) | |
1140 | { | |
1141 | if(!(file->file_type & (LQT_FILE_AVI|LQT_FILE_AVI_ODML))) | |
1142 | { | |
1143 | - codec->avctx->flags |= CODEC_FLAG_GLOBAL_HEADER; | |
1144 | + codec->avctx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER; | |
1145 | codec->write_global_header = 1; | |
1146 | } | |
1147 | } | |
1148 | - else if(codec->encoder->id == CODEC_ID_QTRLE) | |
1149 | + else if(codec->encoder->id == AV_CODEC_ID_QTRLE) | |
1150 | { | |
1151 | if(vtrack->stream_cmodel == BC_RGBA8888) | |
1152 | { | |
1153 | /* Libquicktime doesn't natively support a color model equivalent | |
1154 | - to PIX_FMT_ARGB, which is required for QTRLE with alpha channel. | |
1155 | + to AV_PIX_FMT_ARGB, which is required for QTRLE with alpha channel. | |
1156 | So, we use BC_RGBA8888 and do ad hoc conversion below. */ | |
1157 | - codec->avctx->pix_fmt = PIX_FMT_ARGB; | |
1158 | + codec->avctx->pix_fmt = AV_PIX_FMT_ARGB; | |
1159 | vtrack->track->mdia.minf.stbl.stsd.table[0].depth = 32; | |
1160 | } | |
1161 | } | |
1162 | - else if(codec->encoder->id == CODEC_ID_DVVIDEO) | |
1163 | + else if(codec->encoder->id == AV_CODEC_ID_DVVIDEO) | |
1164 | { | |
1165 | set_dv_fourcc(width, height, vtrack->stream_cmodel, trak); | |
1166 | } | |
1167 | - else if(codec->encoder->id == CODEC_ID_DNXHD) | |
1168 | + else if(codec->encoder->id == AV_CODEC_ID_DNXHD) | |
1169 | { | |
1170 | if(vtrack->interlace_mode != LQT_INTERLACE_NONE) | |
1171 | { | |
1172 | - codec->avctx->flags |= CODEC_FLAG_INTERLACED_DCT; | |
1173 | + codec->avctx->flags |= AV_CODEC_FLAG_INTERLACED_DCT; | |
1174 | } | |
1175 | } | |
1176 | else if(codec->is_imx) | |
1177 | @@ -1422,7 +1422,7 @@ | |
1178 | if(codec->pass == 1) | |
1179 | { | |
1180 | codec->stats_file = fopen(codec->stats_filename, "w"); | |
1181 | - codec->avctx->flags |= CODEC_FLAG_PASS1; | |
1182 | + codec->avctx->flags |= AV_CODEC_FLAG_PASS1; | |
1183 | } | |
1184 | else if(codec->pass == codec->total_passes) | |
1185 | { | |
1186 | @@ -1438,7 +1438,7 @@ | |
1187 | fclose(codec->stats_file); | |
1188 | codec->stats_file = (FILE*)0; | |
1189 | ||
1190 | - codec->avctx->flags |= CODEC_FLAG_PASS2; | |
1191 | + codec->avctx->flags |= AV_CODEC_FLAG_PASS2; | |
1192 | } | |
1193 | } | |
1194 | /* Open codec */ | |
1195 | @@ -1467,7 +1467,7 @@ | |
1196 | } | |
1197 | // codec->lqt_colormodel = ffmepg_2_lqt(codec->com.ffcodec_enc); | |
1198 | ||
1199 | - if(codec->y_offset != 0 || codec->avctx->pix_fmt == PIX_FMT_ARGB) | |
1200 | + if(codec->y_offset != 0 || codec->avctx->pix_fmt == AV_PIX_FMT_ARGB) | |
1201 | { | |
1202 | if(!codec->tmp_rows) | |
1203 | { | |
1204 | @@ -1492,7 +1492,7 @@ | |
1205 | vtrack->stream_cmodel, | |
1206 | 0, 0, 0, codec->y_offset); | |
1207 | } | |
1208 | - else if(codec->avctx->pix_fmt == PIX_FMT_ARGB) | |
1209 | + else if(codec->avctx->pix_fmt == AV_PIX_FMT_ARGB) | |
1210 | { | |
1211 | convert_rgba_to_argb(row_pointers[0], vtrack->stream_row_span, | |
1212 | codec->tmp_rows[0], codec->tmp_row_span, | |
1213 | @@ -1516,7 +1516,7 @@ | |
1214 | } | |
1215 | ||
1216 | codec->frame->pts = vtrack->timestamp; | |
1217 | - if(codec->avctx->flags & CODEC_FLAG_QSCALE) | |
1218 | + if(codec->avctx->flags & AV_CODEC_FLAG_QSCALE) | |
1219 | codec->frame->quality = codec->qscale; | |
1220 | #ifdef DO_INTERLACE | |
1221 | if(vtrack->interlace_mode != LQT_INTERLACE_NONE) | |
1222 | @@ -1558,12 +1558,12 @@ | |
1223 | ||
1224 | #endif | |
1225 | ||
1226 | - if(!was_initialized && codec->encoder->id == CODEC_ID_DNXHD) | |
1227 | + if(!was_initialized && codec->encoder->id == AV_CODEC_ID_DNXHD) | |
1228 | setup_avid_atoms(file, vtrack, codec->buffer, bytes_encoded); | |
1229 | ||
1230 | if(bytes_encoded) | |
1231 | { | |
1232 | - if (pts == AV_NOPTS_VALUE || (codec->encoder->id == CODEC_ID_DNXHD && pts == 0)) | |
1233 | + if (pts == AV_NOPTS_VALUE || (codec->encoder->id == AV_CODEC_ID_DNXHD && pts == 0)) | |
1234 | { | |
1235 | /* Some codecs don't bother generating presentation timestamps. | |
1236 | FFMpeg's DNxHD encoder doesn't even bother to set it to AV_NOPTS_VALUE. */ | |
1237 | @@ -1590,17 +1590,16 @@ | |
1238 | ||
1239 | if(codec->write_global_header && !codec->global_header_written) | |
1240 | { | |
1241 | - if(codec->encoder->id == CODEC_ID_FFVHUFF) | |
1242 | + if(codec->encoder->id == AV_CODEC_ID_FFVHUFF) | |
1243 | { | |
1244 | quicktime_user_atoms_add_atom(&trak->mdia.minf.stbl.stsd.table[0].user_atoms, | |
1245 | "glbl", | |
1246 | codec->avctx->extradata, codec->avctx->extradata_size ); | |
1247 | } | |
1248 | - else if(codec->encoder->id == CODEC_ID_MPEG4) | |
1249 | + else if(codec->encoder->id == AV_CODEC_ID_MPEG4) | |
1250 | { | |
1251 | int advanced = 0; | |
1252 | - if(codec->avctx->max_b_frames || | |
1253 | - (codec->avctx->flags & (CODEC_FLAG_QPEL|CODEC_FLAG_GMC))) | |
1254 | + if(codec->avctx->max_b_frames) | |
1255 | advanced = 1; | |
1256 | ||
1257 | setup_header_mpeg4(file, track, codec->avctx->extradata, | |
1258 | @@ -1903,18 +1902,18 @@ | |
1259 | codec_base->encode_video = lqt_ffmpeg_encode_video; | |
1260 | codec_base->set_pass = set_pass_ffmpeg; | |
1261 | ||
1262 | - if(encoder->id == CODEC_ID_MPEG4) | |
1263 | + if(encoder->id == AV_CODEC_ID_MPEG4) | |
1264 | { | |
1265 | codec_base->writes_compressed = writes_compressed_mpeg4; | |
1266 | codec_base->init_compressed = init_compressed_mpeg4; | |
1267 | codec_base->write_packet = write_packet_mpeg4; | |
1268 | } | |
1269 | - else if(encoder->id == CODEC_ID_MPEG2VIDEO) | |
1270 | + else if(encoder->id == AV_CODEC_ID_MPEG2VIDEO) | |
1271 | { | |
1272 | codec_base->writes_compressed = writes_compressed_imx; | |
1273 | codec_base->init_compressed = init_compressed_imx; | |
1274 | } | |
1275 | - else if(encoder->id == CODEC_ID_DVVIDEO) | |
1276 | + else if(encoder->id == AV_CODEC_ID_DVVIDEO) | |
1277 | { | |
1278 | codec_base->init_compressed = init_compressed_dv; | |
1279 | } | |
1280 | @@ -1922,7 +1921,7 @@ | |
1281 | } | |
1282 | if(decoder) | |
1283 | { | |
1284 | - if(decoder->id == CODEC_ID_H264) | |
1285 | + if(decoder->id == AV_CODEC_ID_H264) | |
1286 | codec_base->read_packet = read_packet_h264; | |
1287 | codec_base->decode_video = lqt_ffmpeg_decode_video; | |
1288 | } | |
1289 | diff -Naur a/src/util.c b/src/util.c | |
1290 | --- a/src/util.c 2011-01-07 14:40:47.000000000 +0000 | |
1291 | +++ b/src/util.c 2018-05-11 23:11:04.367991499 +0100 | |
1292 | @@ -340,9 +340,14 @@ | |
1293 | ||
1294 | void quicktime_read_pascal(quicktime_t *file, char *data) | |
1295 | { | |
1296 | - char len = quicktime_read_char(file); | |
1297 | - quicktime_read_data(file, (uint8_t*)data, len); | |
1298 | - data[(int)len] = 0; | |
1299 | + int len = quicktime_read_char(file); | |
1300 | + if ((len > 0) && (len < 256)) { | |
1301 | + /* data[] is expected to be 256 bytes long */ | |
1302 | + quicktime_read_data(file, (uint8_t*)data, len); | |
1303 | + data[len] = 0; | |
1304 | + } else { | |
1305 | + data[0] = 0; | |
1306 | + } | |
1307 | } | |
1308 | ||
1309 | void quicktime_write_pascal(quicktime_t *file, char *data) |