OLD | NEW |
1 Index: patched-ffmpeg-mt/libavcodec/vorbis_dec.c | 1 Only in unpatched_ffmpeg-mt: ffmpeg-mt |
2 =================================================================== | 2 diff -rpu unpatched_ffmpeg-mt/libavcodec/Makefile ffmpeg-mt/libavcodec/Makefile |
3 --- patched-ffmpeg-mt/libavcodec/vorbis_dec.c» (revision 40662) | 3 --- unpatched_ffmpeg-mt/libavcodec/Makefile» 2010-03-11 17:46:30 -0800 |
4 +++ patched-ffmpeg-mt/libavcodec/vorbis_dec.c» (working copy) | 4 +++ ffmpeg-mt/libavcodec/Makefile» 2010-03-11 19:12:33 -0800 |
5 @@ -960,6 +960,7 @@ | 5 @@ -493,8 +493,7 @@ OBJS-$(CONFIG_MATROSKA_MUXER) + |
| 6 OBJS-$(CONFIG_MOV_DEMUXER) += mpeg4audio.o mpegaudiodata.o |
| 7 OBJS-$(CONFIG_MPEGTS_MUXER) += mpegvideo.o |
| 8 OBJS-$(CONFIG_NUT_MUXER) += mpegaudiodata.o |
| 9 -OBJS-$(CONFIG_OGG_DEMUXER) += flacdec.o flacdata.o flac.o \ |
| 10 - dirac.o mpeg12data.o |
| 11 +OBJS-$(CONFIG_OGG_DEMUXER) += dirac.o mpeg12data.o |
| 12 OBJS-$(CONFIG_OGG_MUXER) += xiph.o flacdec.o flacdata.o flac.o |
| 13 OBJS-$(CONFIG_RTP_MUXER) += mpegvideo.o |
| 14 |
| 15 @@ -564,6 +563,14 @@ OBJS-$(CONFIG_VP3_PARSER) + |
| 16 OBJS-$(CONFIG_AAC_ADTSTOASC_BSF) += aac_adtstoasc_bsf.o |
| 17 OBJS-$(CONFIG_DUMP_EXTRADATA_BSF) += dump_extradata_bsf.o |
| 18 OBJS-$(CONFIG_H264_MP4TOANNEXB_BSF) += h264_mp4toannexb_bsf.o |
| 19 +OBJS-$(CONFIG_MPEG4VIDEO_ES_BSF) += mpeg4video_es_bsf.o \ |
| 20 + mpeg4videoenc.o ituh263enc.o \ |
| 21 + mpegvideo_enc.o motion_est.o \ |
| 22 + ratecontrol.o mpeg12data.o \ |
| 23 + aandcttab.o jfdctfst.o \ |
| 24 + jfdctint.o faandct.o \ |
| 25 + mpeg4video_parser.o mpegvideo.o \ |
| 26 + error_resilience.o |
| 27 OBJS-$(CONFIG_IMX_DUMP_HEADER_BSF) += imx_dump_header_bsf.o |
| 28 OBJS-$(CONFIG_MJPEGA_DUMP_HEADER_BSF) += mjpega_dump_header_bsf.o |
| 29 OBJS-$(CONFIG_MOV2TEXTSUB_BSF) += movsub_bsf.o |
| 30 @@ -573,6 +580,9 @@ OBJS-$(CONFIG_MP3_HEADER_DECOMPRESS_BSF) |
| 31 OBJS-$(CONFIG_NOISE_BSF) += noise_bsf.o |
| 32 OBJS-$(CONFIG_REMOVE_EXTRADATA_BSF) += remove_extradata_bsf.o |
| 33 OBJS-$(CONFIG_TEXT2MOVSUB_BSF) += movsub_bsf.o |
| 34 +OBJS-$(CONFIG_VC1_ASFTORCV_BSF) += vc1_asftorcv_bsf.o |
| 35 +OBJS-$(CONFIG_VC1_ASFTOANNEXG_BSF) += vc1_asftoannexg_bsf.o vc1.o \ |
| 36 + vc1data.o |
| 37 |
| 38 # thread libraries |
| 39 OBJS-$(HAVE_BEOSTHREADS) += beosthread.o |
| 40 Only in ffmpeg-mt/libavcodec: Makefile~ |
| 41 diff -rpu unpatched_ffmpeg-mt/libavcodec/allcodecs.c ffmpeg-mt/libavcodec/allcod
ecs.c |
| 42 --- unpatched_ffmpeg-mt/libavcodec/allcodecs.c» 2010-03-11 17:46:29 -0800 |
| 43 +++ ffmpeg-mt/libavcodec/allcodecs.c» 2010-03-11 19:12:19 -0800 |
| 44 @@ -384,13 +384,15 @@ void avcodec_register_all(void) |
| 45 REGISTER_BSF (AAC_ADTSTOASC, aac_adtstoasc); |
| 46 REGISTER_BSF (DUMP_EXTRADATA, dump_extradata); |
| 47 REGISTER_BSF (H264_MP4TOANNEXB, h264_mp4toannexb); |
| 48 + REGISTER_BSF (MPEG4VIDEO_ES, mpeg4video_es); |
| 49 REGISTER_BSF (IMX_DUMP_HEADER, imx_dump_header); |
| 50 REGISTER_BSF (MJPEGA_DUMP_HEADER, mjpega_dump_header); |
| 51 REGISTER_BSF (MP3_HEADER_COMPRESS, mp3_header_compress); |
| 52 REGISTER_BSF (MP3_HEADER_DECOMPRESS, mp3_header_decompress); |
| 53 + REGISTER_BSF (VC1_ASFTORCV, vc1_asftorcv); |
| 54 + REGISTER_BSF (VC1_ASFTOANNEXG, vc1_asftoannexg); |
| 55 REGISTER_BSF (MOV2TEXTSUB, mov2textsub); |
| 56 REGISTER_BSF (NOISE, noise); |
| 57 REGISTER_BSF (REMOVE_EXTRADATA, remove_extradata); |
| 58 REGISTER_BSF (TEXT2MOVSUB, text2movsub); |
| 59 } |
| 60 - |
| 61 Only in ffmpeg-mt/libavcodec: allcodecs.c~ |
| 62 diff -rpu unpatched_ffmpeg-mt/libavcodec/get_bits.h ffmpeg-mt/libavcodec/get_bit
s.h |
| 63 --- unpatched_ffmpeg-mt/libavcodec/get_bits.h» 2010-03-11 17:46:30 -0800 |
| 64 +++ ffmpeg-mt/libavcodec/get_bits.h» 2010-03-11 19:13:14 -0800 |
| 65 @@ -53,13 +53,21 @@ |
| 66 /* buffer, buffer_end and size_in_bits must be present and used by every reader
*/ |
| 67 typedef struct GetBitContext { |
| 68 const uint8_t *buffer, *buffer_end; |
| 69 + /* Ugly, but clients of this bit reader do not seem to check for enough |
| 70 + * data before calling. So we'll return 0's on overrun rather than crashing |
| 71 + * with random read faults. |
| 72 + */ |
| 73 + int buffer_exhausted; |
| 74 + int buffer_enforcing; |
| 75 #ifdef ALT_BITSTREAM_READER |
| 76 int index; |
| 77 #elif defined LIBMPEG2_BITSTREAM_READER |
| 78 +#error TODO - secure this against read overrun |
| 79 uint8_t *buffer_ptr; |
| 80 uint32_t cache; |
| 81 int bit_count; |
| 82 #elif defined A32_BITSTREAM_READER |
| 83 +#warning TODO - secure this against read overrun |
| 84 uint32_t *buffer_ptr; |
| 85 uint32_t cache0; |
| 86 uint32_t cache1; |
| 87 @@ -139,13 +147,19 @@ for examples see get_bits, show_bits, sk |
| 88 |
| 89 # ifdef ALT_BITSTREAM_READER_LE |
| 90 # define UPDATE_CACHE(name, gb)\ |
| 91 + if (!(gb)->buffer_exhausted)\ |
| 92 name##_cache= AV_RL32( ((const uint8_t *)(gb)->buffer)+(name##_index>>3
) ) >> (name##_index&0x07);\ |
| 93 + else\ |
| 94 + name##_cache = 0;\ |
| 95 |
| 96 # define SKIP_CACHE(name, gb, num)\ |
| 97 name##_cache >>= (num); |
| 98 # else |
| 99 # define UPDATE_CACHE(name, gb)\ |
| 100 + if (!(gb)->buffer_exhausted)\ |
| 101 name##_cache= AV_RB32( ((const uint8_t *)(gb)->buffer)+(name##_index>>3
) ) << (name##_index&0x07);\ |
| 102 + else\ |
| 103 + name##_cache = 0;\ |
| 104 |
| 105 # define SKIP_CACHE(name, gb, num)\ |
| 106 name##_cache <<= (num); |
| 107 @@ -154,6 +168,8 @@ for examples see get_bits, show_bits, sk |
| 108 // FIXME name? |
| 109 # define SKIP_COUNTER(name, gb, num)\ |
| 110 name##_index += (num);\ |
| 111 + if ((gb)->buffer_enforcing && name##_index >= (gb)->size_in_bits)\ |
| 112 + (gb)->buffer_exhausted = 1;\ |
| 113 |
| 114 # define SKIP_BITS(name, gb, num)\ |
| 115 {\ |
| 116 @@ -187,6 +203,12 @@ static inline int get_bits_count(const G |
| 117 |
| 118 static inline void skip_bits_long(GetBitContext *s, int n){ |
| 119 s->index += n; |
| 120 + if (s->buffer_enforcing) { |
| 121 + if (n < 0 && s->index < s->size_in_bits) |
| 122 + s->buffer_exhausted = 0; |
| 123 + else if (s->index >= s->size_in_bits) |
| 124 + s->buffer_exhausted = 1; |
| 125 + } |
| 126 } |
| 127 |
| 128 #elif defined LIBMPEG2_BITSTREAM_READER |
| 129 @@ -391,7 +413,10 @@ static inline void skip_bits(GetBitConte |
| 130 } |
| 131 |
| 132 static inline unsigned int get_bits1(GetBitContext *s){ |
| 133 + if (s->buffer_exhausted) |
| 134 + return 0; |
| 135 #ifdef ALT_BITSTREAM_READER |
| 136 + { |
| 137 unsigned int index= s->index; |
| 138 uint8_t result= s->buffer[ index>>3 ]; |
| 139 #ifdef ALT_BITSTREAM_READER_LE |
| 140 @@ -402,9 +427,12 @@ static inline unsigned int get_bits1(Get |
| 141 result>>= 8 - 1; |
| 142 #endif |
| 143 index++; |
| 144 + if (s->buffer_enforcing && index >= s->size_in_bits) |
| 145 + s->buffer_exhausted = 1; |
| 146 s->index= index; |
| 147 |
| 148 return result; |
| 149 + } |
| 150 #else |
| 151 return get_bits(s, 1); |
| 152 #endif |
| 153 @@ -482,6 +510,8 @@ static inline void init_get_bits(GetBitC |
| 154 s->buffer= buffer; |
| 155 s->size_in_bits= bit_size; |
| 156 s->buffer_end= buffer + buffer_size; |
| 157 + s->buffer_exhausted = 0; |
| 158 + s->buffer_enforcing = 0; |
| 159 #ifdef ALT_BITSTREAM_READER |
| 160 s->index=0; |
| 161 #elif defined LIBMPEG2_BITSTREAM_READER |
| 162 Only in ffmpeg-mt/libavcodec: get_bits.h~ |
| 163 diff -rpu unpatched_ffmpeg-mt/libavcodec/h264.h ffmpeg-mt/libavcodec/h264.h |
| 164 --- unpatched_ffmpeg-mt/libavcodec/h264.h» 2010-03-11 17:46:30 -0800 |
| 165 +++ ffmpeg-mt/libavcodec/h264.h»2010-03-11 19:12:59 -0800 |
| 166 @@ -599,9 +599,20 @@ typedef struct H264Context{ |
| 167 |
| 168 extern const uint8_t ff_h264_chroma_qp[52]; |
| 169 |
| 170 +#if CONFIG_SVQ3_DECODER |
| 171 void ff_svq3_luma_dc_dequant_idct_c(DCTELEM *block, int qp); |
| 172 |
| 173 void ff_svq3_add_idct_c(uint8_t *dst, DCTELEM *block, int stride, int qp, int d
c); |
| 174 +#else |
| 175 + |
| 176 +#define SVQ3_DISABLED_FUNC { av_log(NULL, AV_LOG_FATAL, "Calling svq3 when disa
bled.\n"); } |
| 177 + |
| 178 +static void inline ff_svq3_luma_dc_dequant_idct_c(DCTELEM *block, int qp) SVQ3_
DISABLED_FUNC; |
| 179 + |
| 180 +static void inline ff_svq3_add_idct_c(uint8_t *dst, DCTELEM *block, int stride,
int qp, int dc) SVQ3_DISABLED_FUNC; |
| 181 + |
| 182 +#endif |
| 183 + |
| 184 |
| 185 /** |
| 186 * Decode SEI |
| 187 Only in ffmpeg-mt/libavcodec: h264.h~ |
| 188 diff -rpu unpatched_ffmpeg-mt/libavcodec/mpeg4video.h ffmpeg-mt/libavcodec/mpeg4
video.h |
| 189 --- unpatched_ffmpeg-mt/libavcodec/mpeg4video.h»2010-03-11 17:46:30 -0800 |
| 190 +++ ffmpeg-mt/libavcodec/mpeg4video.h» 2010-03-11 19:12:02 -0800 |
| 191 @@ -91,6 +91,9 @@ void mpeg4_encode_mb(MpegEncContext *s, |
| 192 void mpeg4_pred_ac(MpegEncContext * s, DCTELEM *block, int n, |
| 193 int dir); |
| 194 void ff_set_mpeg4_time(MpegEncContext * s); |
| 195 +void mpeg4_encode_gop_header(MpegEncContext * s); |
| 196 +void mpeg4_encode_visual_object_header(MpegEncContext * s); |
| 197 +void mpeg4_encode_vol_header(MpegEncContext * s, int vo_number, int vol_number)
; |
| 198 void mpeg4_encode_picture_header(MpegEncContext *s, int picture_number); |
| 199 |
| 200 int ff_mpeg4_decode_picture_header(MpegEncContext * s, GetBitContext *gb); |
| 201 Only in ffmpeg-mt/libavcodec: mpeg4video.h~ |
| 202 Only in ffmpeg-mt/libavcodec: mpeg4video_es_bsf.c |
| 203 diff -rpu unpatched_ffmpeg-mt/libavcodec/mpeg4videoenc.c ffmpeg-mt/libavcodec/mp
eg4videoenc.c |
| 204 --- unpatched_ffmpeg-mt/libavcodec/mpeg4videoenc.c» 2010-03-11 17:46:30 -080
0 |
| 205 +++ ffmpeg-mt/libavcodec/mpeg4videoenc.c» 2010-03-11 19:12:02 -0800 |
| 206 @@ -872,7 +872,7 @@ void ff_set_mpeg4_time(MpegEncContext * |
6 } | 207 } |
7 | 208 } |
| 209 |
| 210 -static void mpeg4_encode_gop_header(MpegEncContext * s){ |
| 211 +void mpeg4_encode_gop_header(MpegEncContext * s){ |
| 212 int hours, minutes, seconds; |
| 213 int64_t time; |
| 214 |
| 215 @@ -902,7 +902,7 @@ static void mpeg4_encode_gop_header(Mpeg |
| 216 ff_mpeg4_stuffing(&s->pb); |
| 217 } |
| 218 |
| 219 -static void mpeg4_encode_visual_object_header(MpegEncContext * s){ |
| 220 +void mpeg4_encode_visual_object_header(MpegEncContext * s){ |
| 221 int profile_and_level_indication; |
| 222 int vo_ver_id; |
| 223 |
| 224 @@ -947,7 +947,7 @@ static void mpeg4_encode_visual_object_h |
| 225 ff_mpeg4_stuffing(&s->pb); |
| 226 } |
| 227 |
| 228 -static void mpeg4_encode_vol_header(MpegEncContext * s, int vo_number, int vol_
number) |
| 229 +void mpeg4_encode_vol_header(MpegEncContext * s, int vo_number, int vol_number) |
| 230 { |
| 231 int vo_ver_id; |
| 232 |
| 233 Only in ffmpeg-mt/libavcodec: vc1_asftoannexg_bsf.c |
| 234 Only in ffmpeg-mt/libavcodec: vc1_asftorcv_bsf.c |
| 235 diff -rpu unpatched_ffmpeg-mt/libavcodec/vorbis_dec.c ffmpeg-mt/libavcodec/vorbi
s_dec.c |
| 236 --- unpatched_ffmpeg-mt/libavcodec/vorbis_dec.c»2010-03-11 17:46:30 -0800 |
| 237 +++ ffmpeg-mt/libavcodec/vorbis_dec.c» 2010-03-11 19:13:34 -0800 |
| 238 @@ -961,6 +961,7 @@ static av_cold int vorbis_decode_init(AV |
| 239 } |
| 240 |
8 init_get_bits(gb, header_start[0], header_len[0]*8); | 241 init_get_bits(gb, header_start[0], header_len[0]*8); |
9 + gb->buffer_enforcing=1; | 242 + gb->buffer_enforcing=1; |
10 hdr_type = get_bits(gb, 8); | 243 hdr_type = get_bits(gb, 8); |
11 if (hdr_type != 1) { | 244 if (hdr_type != 1) { |
12 av_log(avccontext, AV_LOG_ERROR, "First header is not the id header.\n"
); | 245 av_log(avccontext, AV_LOG_ERROR, "First header is not the id header.\n"
); |
13 @@ -972,6 +973,7 @@ | 246 @@ -973,6 +974,7 @@ static av_cold int vorbis_decode_init(AV |
14 } | 247 } |
15 | 248 |
16 init_get_bits(gb, header_start[2], header_len[2]*8); | 249 init_get_bits(gb, header_start[2], header_len[2]*8); |
17 + gb->buffer_enforcing=1; | 250 + gb->buffer_enforcing=1; |
18 hdr_type = get_bits(gb, 8); | 251 hdr_type = get_bits(gb, 8); |
19 if (hdr_type != 5) { | 252 if (hdr_type != 5) { |
20 av_log(avccontext, AV_LOG_ERROR, "Third header is not the setup header.
\n"); | 253 av_log(avccontext, AV_LOG_ERROR, "Third header is not the setup header.
\n"); |
21 @@ -1193,7 +1195,7 @@ | 254 @@ -1194,7 +1196,7 @@ static uint_fast8_t vorbis_floor1_decode |
22 adx = vf->list[high_neigh_offs].x - vf->list[low_neigh_offs].x; | 255 adx = vf->list[high_neigh_offs].x - vf->list[low_neigh_offs].x; |
23 ady = FFABS(dy); | 256 ady = FFABS(dy); |
24 err = ady * (vf->list[i].x - vf->list[low_neigh_offs].x); | 257 err = ady * (vf->list[i].x - vf->list[low_neigh_offs].x); |
25 - off = (int16_t)err / (int16_t)adx; | 258 - off = (int16_t)err / (int16_t)adx; |
26 + off = (int16_t)err / (int16_t)(adx?adx:1); | 259 + off = (int16_t)err / (int16_t)(adx?adx:1); |
27 if (dy < 0) { | 260 if (dy < 0) { |
28 predicted = floor1_Y_final[low_neigh_offs] - off; | 261 predicted = floor1_Y_final[low_neigh_offs] - off; |
29 } else { | 262 } else { |
30 @@ -1280,7 +1282,7 @@ | 263 @@ -1281,7 +1283,7 @@ static av_always_inline int vorbis_resid |
31 uint_fast16_t j_times_ptns_to_read; | 264 uint_fast16_t j_times_ptns_to_read; |
32 | 265 |
33 voffset = vr->begin; | 266 voffset = vr->begin; |
34 - for (partition_count = 0; partition_count < ptns_to_read;) { // SPEC
error | 267 - for (partition_count = 0; partition_count < ptns_to_read;) { // SPEC
error |
35 + for(partition_count=0;partition_count<ptns_to_read && !(gb->buffer_exha
usted && gb->index > gb->size_in_bits);) { // SPEC error | 268 + for(partition_count=0;partition_count<ptns_to_read && !(gb->buffer_exha
usted && gb->index > gb->size_in_bits);) { // SPEC error |
36 if (!pass) { | 269 if (!pass) { |
37 uint_fast32_t inverse_class = ff_inverse[vr->classifications]; | 270 uint_fast32_t inverse_class = ff_inverse[vr->classifications]; |
38 for (j_times_ptns_to_read = 0, j = 0; j < ch_used; ++j) { | 271 for (j_times_ptns_to_read = 0, j = 0; j < ch_used; ++j) { |
39 @@ -1600,6 +1602,7 @@ | 272 @@ -1601,6 +1603,7 @@ static int vorbis_decode_frame(AVCodecCo |
40 AV_DEBUG("packet length %d \n", buf_size); | 273 AV_DEBUG("packet length %d \n", buf_size); |
41 | 274 |
42 init_get_bits(gb, buf, buf_size*8); | 275 init_get_bits(gb, buf, buf_size*8); |
43 + gb->buffer_enforcing=1; | 276 + gb->buffer_enforcing=1; |
44 | 277 |
45 len = vorbis_parse_audio_packet(vc); | 278 len = vorbis_parse_audio_packet(vc); |
46 | 279 |
| 280 Only in ffmpeg-mt/libavcodec: vorbis_dec.c~ |
| 281 diff -rpu unpatched_ffmpeg-mt/libavcodec/vp3.c ffmpeg-mt/libavcodec/vp3.c |
| 282 --- unpatched_ffmpeg-mt/libavcodec/vp3.c» 2010-03-11 17:46:30 -0800 |
| 283 +++ ffmpeg-mt/libavcodec/vp3.c» 2010-03-11 19:13:21 -0800 |
| 284 @@ -922,6 +922,11 @@ static int unpack_vlcs(Vp3DecodeContext |
| 285 int num_coeffs = s->num_coded_frags[plane][coeff_index]; |
| 286 int16_t *dct_tokens = s->dct_tokens[plane][coeff_index]; |
| 287 |
| 288 +#ifdef ALT_BITSTREAM_READER |
| 289 + if (gb->buffer_exhausted && gb->index > gb->size_in_bits) |
| 290 + return 0; |
| 291 +#endif |
| 292 + |
| 293 /* local references to structure members to avoid repeated deferences */ |
| 294 int *coded_fragment_list = s->coded_fragment_list[plane]; |
| 295 Vp3Fragment *all_fragments = s->all_fragments; |
| 296 @@ -1099,6 +1104,11 @@ static int unpack_dct_coeffs(Vp3DecodeCo |
| 297 2, residual_eob_run); |
| 298 } |
| 299 |
| 300 +#ifdef ALT_BITSTREAM_READER |
| 301 + if (gb->buffer_exhausted && gb->index > gb->size_in_bits) |
| 302 + return 1; |
| 303 +#endif |
| 304 + |
| 305 return 0; |
| 306 } |
| 307 |
| 308 @@ -1882,6 +1892,7 @@ static int vp3_decode_frame(AVCodecConte |
| 309 int i; |
| 310 |
| 311 init_get_bits(&gb, buf, buf_size * 8); |
| 312 + gb.buffer_enforcing = 1; |
| 313 |
| 314 if (s->theora && get_bits1(&gb)) |
| 315 { |
| 316 @@ -2305,6 +2316,7 @@ static av_cold int theora_decode_init(AV |
| 317 |
| 318 for(i=0;i<3;i++) { |
| 319 init_get_bits(&gb, header_start[i], header_len[i] * 8); |
| 320 + gb.buffer_enforcing = 1; |
| 321 |
| 322 ptype = get_bits(&gb, 8); |
| 323 |
| 324 Only in ffmpeg-mt/libavcodec: vp3.c~ |
| 325 diff -rpu unpatched_ffmpeg-mt/libavformat/Makefile ffmpeg-mt/libavformat/Makefil
e |
| 326 --- unpatched_ffmpeg-mt/libavformat/Makefile» 2010-03-11 17:46:31 -0800 |
| 327 +++ ffmpeg-mt/libavformat/Makefile» 2010-03-11 19:12:33 -0800 |
| 328 @@ -141,13 +141,13 @@ OBJS-$(CONFIG_NUT_DEMUXER) |
| 329 OBJS-$(CONFIG_NUT_MUXER) += nutenc.o nut.o riff.o |
| 330 OBJS-$(CONFIG_NUV_DEMUXER) += nuv.o riff.o |
| 331 OBJS-$(CONFIG_OGG_DEMUXER) += oggdec.o \ |
| 332 - oggparsedirac.o \ |
| 333 - oggparseflac.o \ |
| 334 oggparseogm.o \ |
| 335 - oggparsespeex.o \ |
| 336 oggparsetheora.o \ |
| 337 oggparsevorbis.o \ |
| 338 riff.o |
| 339 +OBJS-$(CONFIG_DIRAC_DEMUXER) += oggparsedirac.o |
| 340 +OBJS-$(CONFIG_FLAC_DECODER) += oggparseflac.o |
| 341 +OBJS-$(CONFIG_LIBSPEEX) += oggparsespeex.o |
| 342 OBJS-$(CONFIG_OGG_MUXER) += oggenc.o |
| 343 OBJS-$(CONFIG_OMA_DEMUXER) += oma.o raw.o |
| 344 OBJS-$(CONFIG_PCM_ALAW_DEMUXER) += raw.o |
| 345 diff -rpu unpatched_ffmpeg-mt/libavformat/mov.c ffmpeg-mt/libavformat/mov.c |
| 346 --- unpatched_ffmpeg-mt/libavformat/mov.c» 2010-03-11 17:46:31 -0800 |
| 347 +++ ffmpeg-mt/libavformat/mov.c»2010-03-11 19:08:40 -0800 |
| 348 @@ -312,6 +312,8 @@ static int mov_read_dref(MOVContext *c, |
| 349 MOVDref *dref = &sc->drefs[i]; |
| 350 uint32_t size = get_be32(pb); |
| 351 int64_t next = url_ftell(pb) + size - 4; |
| 352 + if (size < 8) |
| 353 + return -1; |
| 354 |
| 355 dref->type = get_le32(pb); |
| 356 get_be32(pb); // version + flags |
| 357 Only in ffmpeg-mt/libavformat: mov.c~ |
| 358 diff -rpu unpatched_ffmpeg-mt/libavformat/oggdec.c ffmpeg-mt/libavformat/oggdec.
c |
| 359 --- unpatched_ffmpeg-mt/libavformat/oggdec.c» 2010-03-11 17:46:31 -0800 |
| 360 +++ ffmpeg-mt/libavformat/oggdec.c» 2010-03-11 19:12:46 -0800 |
| 361 @@ -38,13 +38,23 @@ |
| 362 #define DECODER_BUFFER_SIZE MAX_PAGE_SIZE |
| 363 |
| 364 static const struct ogg_codec * const ogg_codecs[] = { |
| 365 +#if CONFIG_DIRAC_DEMUXER |
| 366 &ff_dirac_codec, |
| 367 +#endif |
| 368 +#if CONFIG_LIBSPEEX |
| 369 &ff_speex_codec, |
| 370 +#endif |
| 371 &ff_vorbis_codec, |
| 372 &ff_theora_codec, |
| 373 +#if CONFIG_FLAC_DECODER |
| 374 &ff_flac_codec, |
| 375 +#endif |
| 376 +#if CONFIG_DIRAC_DEMUXER |
| 377 &ff_old_dirac_codec, |
| 378 +#endif |
| 379 +#if CONFIG_FLAC_DECODER |
| 380 &ff_old_flac_codec, |
| 381 +#endif |
| 382 &ff_ogm_video_codec, |
| 383 &ff_ogm_audio_codec, |
| 384 &ff_ogm_text_codec, |
| 385 @@ -200,7 +210,7 @@ ogg_new_buf(struct ogg *ogg, int idx) |
| 386 } |
| 387 |
| 388 static int |
| 389 -ogg_read_page (AVFormatContext * s, int *str) |
| 390 +ogg_read_page (AVFormatContext * s, int *str, int64_t *offset) |
| 391 { |
| 392 ByteIOContext *bc = s->pb; |
| 393 struct ogg *ogg = s->priv_data; |
| 394 @@ -214,6 +224,7 @@ ogg_read_page (AVFormatContext * s, int |
| 395 int size, idx; |
| 396 uint8_t sync[4]; |
| 397 int sp = 0; |
| 398 + int64_t poffset = url_ftell(bc); |
| 399 |
| 400 if (get_buffer (bc, sync, 4) < 4) |
| 401 return -1; |
| 402 @@ -298,18 +309,22 @@ ogg_read_page (AVFormatContext * s, int |
| 403 |
| 404 if (str) |
| 405 *str = idx; |
| 406 + if (offset) |
| 407 + *offset = poffset; |
| 408 |
| 409 return 0; |
| 410 } |
| 411 |
| 412 static int |
| 413 -ogg_packet (AVFormatContext * s, int *str, int *dstart, int *dsize) |
| 414 +ogg_packet (AVFormatContext * s, int *str, int *dstart, int *dsize, int64_t* of
fset) |
| 415 { |
| 416 struct ogg *ogg = s->priv_data; |
| 417 int idx, i; |
| 418 struct ogg_stream *os; |
| 419 int complete = 0; |
| 420 int segp = 0, psize = 0; |
| 421 + int64_t poffset; |
| 422 + int pnum = 0; |
| 423 |
| 424 #if 0 |
| 425 av_log (s, AV_LOG_DEBUG, "ogg_packet: curidx=%i\n", ogg->curidx); |
| 426 @@ -319,10 +334,13 @@ ogg_packet (AVFormatContext * s, int *st |
| 427 idx = ogg->curidx; |
| 428 |
| 429 while (idx < 0){ |
| 430 - if (ogg_read_page (s, &idx) < 0) |
| 431 + if (ogg_read_page (s, &idx, &poffset) < 0) |
| 432 return -1; |
| 433 } |
| 434 |
| 435 + if (pnum++ == 0 && offset) |
| 436 + *offset = poffset; |
| 437 + |
| 438 os = ogg->streams + idx; |
| 439 |
| 440 #if 0 |
| 441 @@ -418,12 +436,15 @@ static int |
| 442 ogg_get_headers (AVFormatContext * s) |
| 443 { |
| 444 struct ogg *ogg = s->priv_data; |
| 445 + int64_t pos = 0; |
| 446 |
| 447 do{ |
| 448 - if (ogg_packet (s, NULL, NULL, NULL) < 0) |
| 449 + if (ogg_packet (s, NULL, NULL, NULL, &pos) < 0) |
| 450 return -1; |
| 451 }while (!ogg->headers); |
| 452 |
| 453 + s->data_offset = pos; |
| 454 + |
| 455 #if 0 |
| 456 av_log (s, AV_LOG_DEBUG, "found headers\n"); |
| 457 #endif |
| 458 @@ -472,7 +493,7 @@ ogg_get_length (AVFormatContext * s) |
| 459 ogg_save (s); |
| 460 url_fseek (s->pb, end, SEEK_SET); |
| 461 |
| 462 - while (!ogg_read_page (s, &i)){ |
| 463 + while (!ogg_read_page (s, &i, NULL)){ |
| 464 if (ogg->streams[i].granule != -1 && ogg->streams[i].granule != 0 && |
| 465 ogg->streams[i].codec) |
| 466 idx = i; |
| 467 @@ -523,7 +544,7 @@ ogg_read_packet (AVFormatContext * s, AV |
| 468 |
| 469 //Get an ogg packet |
| 470 do{ |
| 471 - if (ogg_packet (s, &idx, &pstart, &psize) < 0) |
| 472 + if (ogg_packet (s, &idx, &pstart, &psize, NULL) < 0) |
| 473 return AVERROR(EIO); |
| 474 }while (idx < 0 || !s->streams[idx]); |
| 475 |
| 476 @@ -585,14 +606,17 @@ ogg_read_timestamp (AVFormatContext * s, |
| 477 ByteIOContext *bc = s->pb; |
| 478 int64_t pts = AV_NOPTS_VALUE; |
| 479 int i; |
| 480 + int64_t fpoffset = AV_NOPTS_VALUE; |
| 481 + int64_t poffset; |
| 482 url_fseek(bc, *pos_arg, SEEK_SET); |
| 483 - while (url_ftell(bc) < pos_limit && !ogg_read_page (s, &i)) { |
| 484 + while (url_ftell(bc) < pos_limit && !ogg_read_page (s, &i, &poffset)) { |
| 485 + if (fpoffset == AV_NOPTS_VALUE && i == stream_index) |
| 486 + fpoffset = poffset; |
| 487 if (ogg->streams[i].granule != -1 && ogg->streams[i].granule != 0 && |
| 488 ogg->streams[i].codec && i == stream_index) { |
| 489 pts = ogg_gptopts(s, i, ogg->streams[i].granule, NULL); |
| 490 - // FIXME: this is the position of the packet after the one with abo
ve |
| 491 - // pts. |
| 492 - *pos_arg = url_ftell(bc); |
| 493 + *pos_arg = fpoffset; |
| 494 + url_fseek(bc, fpoffset, SEEK_SET); |
| 495 break; |
| 496 } |
| 497 } |
| 498 Only in ffmpeg-mt/libavformat: oggdec.c~ |
OLD | NEW |