Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(434)

Side by Side Diff: patches/to_upstream/08_ogg_seek_missing_first_frame.patch

Issue 789004: ffmpeg roll of source to mar 9 version... (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/ffmpeg/
Patch Set: '' Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 Index: patched-ffmpeg-mt/libavformat/oggdec.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/libavformat/oggdec.c (revision 40341) 3 --- unpatched_ffmpeg-mt/libavcodec/Makefile» 2010-03-11 17:46:30 -0800
4 +++ patched-ffmpeg-mt/libavformat/oggdec.c (working copy) 4 +++ ffmpeg-mt/libavcodec/Makefile» 2010-03-11 19:12:33 -0800
5 @@ -209,7 +209,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);
6 } 59 }
7 60 -
61 Only in ffmpeg-mt/libavcodec: allcodecs.c~
62 diff -rpu unpatched_ffmpeg-mt/libavcodec/mpeg4video.h ffmpeg-mt/libavcodec/mpeg4 video.h
63 --- unpatched_ffmpeg-mt/libavcodec/mpeg4video.h»2010-03-11 17:46:30 -0800
64 +++ ffmpeg-mt/libavcodec/mpeg4video.h» 2010-03-11 19:12:02 -0800
65 @@ -91,6 +91,9 @@ void mpeg4_encode_mb(MpegEncContext *s,
66 void mpeg4_pred_ac(MpegEncContext * s, DCTELEM *block, int n,
67 int dir);
68 void ff_set_mpeg4_time(MpegEncContext * s);
69 +void mpeg4_encode_gop_header(MpegEncContext * s);
70 +void mpeg4_encode_visual_object_header(MpegEncContext * s);
71 +void mpeg4_encode_vol_header(MpegEncContext * s, int vo_number, int vol_number) ;
72 void mpeg4_encode_picture_header(MpegEncContext *s, int picture_number);
73
74 int ff_mpeg4_decode_picture_header(MpegEncContext * s, GetBitContext *gb);
75 Only in ffmpeg-mt/libavcodec: mpeg4video.h~
76 Only in ffmpeg-mt/libavcodec: mpeg4video_es_bsf.c
77 diff -rpu unpatched_ffmpeg-mt/libavcodec/mpeg4videoenc.c ffmpeg-mt/libavcodec/mp eg4videoenc.c
78 --- unpatched_ffmpeg-mt/libavcodec/mpeg4videoenc.c» 2010-03-11 17:46:30 -080 0
79 +++ ffmpeg-mt/libavcodec/mpeg4videoenc.c» 2010-03-11 19:12:02 -0800
80 @@ -872,7 +872,7 @@ void ff_set_mpeg4_time(MpegEncContext *
81 }
82 }
83
84 -static void mpeg4_encode_gop_header(MpegEncContext * s){
85 +void mpeg4_encode_gop_header(MpegEncContext * s){
86 int hours, minutes, seconds;
87 int64_t time;
88
89 @@ -902,7 +902,7 @@ static void mpeg4_encode_gop_header(Mpeg
90 ff_mpeg4_stuffing(&s->pb);
91 }
92
93 -static void mpeg4_encode_visual_object_header(MpegEncContext * s){
94 +void mpeg4_encode_visual_object_header(MpegEncContext * s){
95 int profile_and_level_indication;
96 int vo_ver_id;
97
98 @@ -947,7 +947,7 @@ static void mpeg4_encode_visual_object_h
99 ff_mpeg4_stuffing(&s->pb);
100 }
101
102 -static void mpeg4_encode_vol_header(MpegEncContext * s, int vo_number, int vol_ number)
103 +void mpeg4_encode_vol_header(MpegEncContext * s, int vo_number, int vol_number)
104 {
105 int vo_ver_id;
106
107 Only in ffmpeg-mt/libavcodec: vc1_asftoannexg_bsf.c
108 Only in ffmpeg-mt/libavcodec: vc1_asftorcv_bsf.c
109 diff -rpu unpatched_ffmpeg-mt/libavformat/Makefile ffmpeg-mt/libavformat/Makefil e
110 --- unpatched_ffmpeg-mt/libavformat/Makefile» 2010-03-11 17:46:31 -0800
111 +++ ffmpeg-mt/libavformat/Makefile» 2010-03-11 19:12:33 -0800
112 @@ -141,13 +141,13 @@ OBJS-$(CONFIG_NUT_DEMUXER)
113 OBJS-$(CONFIG_NUT_MUXER) += nutenc.o nut.o riff.o
114 OBJS-$(CONFIG_NUV_DEMUXER) += nuv.o riff.o
115 OBJS-$(CONFIG_OGG_DEMUXER) += oggdec.o \
116 - oggparsedirac.o \
117 - oggparseflac.o \
118 oggparseogm.o \
119 - oggparsespeex.o \
120 oggparsetheora.o \
121 oggparsevorbis.o \
122 riff.o
123 +OBJS-$(CONFIG_DIRAC_DEMUXER) += oggparsedirac.o
124 +OBJS-$(CONFIG_FLAC_DECODER) += oggparseflac.o
125 +OBJS-$(CONFIG_LIBSPEEX) += oggparsespeex.o
126 OBJS-$(CONFIG_OGG_MUXER) += oggenc.o
127 OBJS-$(CONFIG_OMA_DEMUXER) += oma.o raw.o
128 OBJS-$(CONFIG_PCM_ALAW_DEMUXER) += raw.o
129 diff -rpu unpatched_ffmpeg-mt/libavformat/mov.c ffmpeg-mt/libavformat/mov.c
130 --- unpatched_ffmpeg-mt/libavformat/mov.c» 2010-03-11 17:46:31 -0800
131 +++ ffmpeg-mt/libavformat/mov.c»2010-03-11 19:08:40 -0800
132 @@ -312,6 +312,8 @@ static int mov_read_dref(MOVContext *c,
133 MOVDref *dref = &sc->drefs[i];
134 uint32_t size = get_be32(pb);
135 int64_t next = url_ftell(pb) + size - 4;
136 + if (size < 8)
137 + return -1;
138
139 dref->type = get_le32(pb);
140 get_be32(pb); // version + flags
141 Only in ffmpeg-mt/libavformat: mov.c~
142 diff -rpu unpatched_ffmpeg-mt/libavformat/oggdec.c ffmpeg-mt/libavformat/oggdec. c
143 --- unpatched_ffmpeg-mt/libavformat/oggdec.c» 2010-03-11 17:46:31 -0800
144 +++ ffmpeg-mt/libavformat/oggdec.c» 2010-03-11 19:12:46 -0800
145 @@ -38,13 +38,23 @@
146 #define DECODER_BUFFER_SIZE MAX_PAGE_SIZE
147
148 static const struct ogg_codec * const ogg_codecs[] = {
149 +#if CONFIG_DIRAC_DEMUXER
150 &ff_dirac_codec,
151 +#endif
152 +#if CONFIG_LIBSPEEX
153 &ff_speex_codec,
154 +#endif
155 &ff_vorbis_codec,
156 &ff_theora_codec,
157 +#if CONFIG_FLAC_DECODER
158 &ff_flac_codec,
159 +#endif
160 +#if CONFIG_DIRAC_DEMUXER
161 &ff_old_dirac_codec,
162 +#endif
163 +#if CONFIG_FLAC_DECODER
164 &ff_old_flac_codec,
165 +#endif
166 &ff_ogm_video_codec,
167 &ff_ogm_audio_codec,
168 &ff_ogm_text_codec,
169 @@ -200,7 +210,7 @@ ogg_new_buf(struct ogg *ogg, int idx)
170 }
171
8 static int 172 static int
9 -ogg_read_page (AVFormatContext * s, int *str) 173 -ogg_read_page (AVFormatContext * s, int *str)
10 +ogg_read_page (AVFormatContext * s, int *str, int64_t *offset) 174 +ogg_read_page (AVFormatContext * s, int *str, int64_t *offset)
11 { 175 {
12 ByteIOContext *bc = s->pb; 176 ByteIOContext *bc = s->pb;
13 struct ogg *ogg = s->priv_data; 177 struct ogg *ogg = s->priv_data;
14 @@ -223,6 +223,7 @@ 178 @@ -214,6 +224,7 @@ ogg_read_page (AVFormatContext * s, int
15 int size, idx; 179 int size, idx;
16 uint8_t sync[4]; 180 uint8_t sync[4];
17 int sp = 0; 181 int sp = 0;
18 + int64_t poffset = url_ftell(bc); 182 + int64_t poffset = url_ftell(bc);
19 183
20 if (get_buffer (bc, sync, 4) < 4) 184 if (get_buffer (bc, sync, 4) < 4)
21 return -1; 185 return -1;
22 @@ -307,18 +308,22 @@ 186 @@ -298,18 +309,22 @@ ogg_read_page (AVFormatContext * s, int
23 187
24 if (str) 188 if (str)
25 *str = idx; 189 *str = idx;
26 + if (offset) 190 + if (offset)
27 + *offset = poffset; 191 + *offset = poffset;
28 192
29 return 0; 193 return 0;
30 } 194 }
31 195
32 static int 196 static int
33 -ogg_packet (AVFormatContext * s, int *str, int *dstart, int *dsize) 197 -ogg_packet (AVFormatContext * s, int *str, int *dstart, int *dsize)
34 +ogg_packet (AVFormatContext * s, int *str, int *dstart, int *dsize, int64_t* of fset) 198 +ogg_packet (AVFormatContext * s, int *str, int *dstart, int *dsize, int64_t* of fset)
35 { 199 {
36 struct ogg *ogg = s->priv_data; 200 struct ogg *ogg = s->priv_data;
37 int idx, i; 201 int idx, i;
38 struct ogg_stream *os; 202 struct ogg_stream *os;
39 int complete = 0; 203 int complete = 0;
40 int segp = 0, psize = 0; 204 int segp = 0, psize = 0;
41 + int64_t poffset; 205 + int64_t poffset;
42 + int pnum = 0; 206 + int pnum = 0;
43 207
44 #if 0 208 #if 0
45 av_log (s, AV_LOG_DEBUG, "ogg_packet: curidx=%i\n", ogg->curidx); 209 av_log (s, AV_LOG_DEBUG, "ogg_packet: curidx=%i\n", ogg->curidx);
46 @@ -328,10 +333,13 @@ 210 @@ -319,10 +334,13 @@ ogg_packet (AVFormatContext * s, int *st
47 idx = ogg->curidx; 211 idx = ogg->curidx;
48 212
49 while (idx < 0){ 213 while (idx < 0){
50 - if (ogg_read_page (s, &idx) < 0) 214 - if (ogg_read_page (s, &idx) < 0)
51 + if (ogg_read_page (s, &idx, &poffset) < 0) 215 + if (ogg_read_page (s, &idx, &poffset) < 0)
52 return -1; 216 return -1;
53 } 217 }
54 218
55 + if (pnum++ == 0 && offset) 219 + if (pnum++ == 0 && offset)
56 + *offset = poffset; 220 + *offset = poffset;
57 + 221 +
58 os = ogg->streams + idx; 222 os = ogg->streams + idx;
59 223
60 #if 0 224 #if 0
61 @@ -425,12 +433,15 @@ 225 @@ -418,12 +436,15 @@ static int
62 ogg_get_headers (AVFormatContext * s) 226 ogg_get_headers (AVFormatContext * s)
63 { 227 {
64 struct ogg *ogg = s->priv_data; 228 struct ogg *ogg = s->priv_data;
65 + int64_t pos = 0; 229 + int64_t pos = 0;
66 230
67 do{ 231 do{
68 - if (ogg_packet (s, NULL, NULL, NULL) < 0) 232 - if (ogg_packet (s, NULL, NULL, NULL) < 0)
69 + if (ogg_packet (s, NULL, NULL, NULL, &pos) < 0) 233 + if (ogg_packet (s, NULL, NULL, NULL, &pos) < 0)
70 return -1; 234 return -1;
71 }while (!ogg->headers); 235 }while (!ogg->headers);
72 236
73 + s->data_offset = pos; 237 + s->data_offset = pos;
74 + 238 +
75 #if 0 239 #if 0
76 av_log (s, AV_LOG_DEBUG, "found headers\n"); 240 av_log (s, AV_LOG_DEBUG, "found headers\n");
77 #endif 241 #endif
78 @@ -479,7 +490,7 @@ 242 @@ -472,7 +493,7 @@ ogg_get_length (AVFormatContext * s)
79 ogg_save (s); 243 ogg_save (s);
80 url_fseek (s->pb, end, SEEK_SET); 244 url_fseek (s->pb, end, SEEK_SET);
81 245
82 - while (!ogg_read_page (s, &i)){ 246 - while (!ogg_read_page (s, &i)){
83 + while (!ogg_read_page (s, &i, NULL)){ 247 + while (!ogg_read_page (s, &i, NULL)){
84 if (ogg->streams[i].granule != -1 && ogg->streams[i].granule != 0 && 248 if (ogg->streams[i].granule != -1 && ogg->streams[i].granule != 0 &&
85 ogg->streams[i].codec) 249 ogg->streams[i].codec)
86 idx = i; 250 idx = i;
87 @@ -530,7 +541,7 @@ 251 @@ -523,7 +544,7 @@ ogg_read_packet (AVFormatContext * s, AV
88 252
89 //Get an ogg packet 253 //Get an ogg packet
90 do{ 254 do{
91 - if (ogg_packet (s, &idx, &pstart, &psize) < 0) 255 - if (ogg_packet (s, &idx, &pstart, &psize) < 0)
92 + if (ogg_packet (s, &idx, &pstart, &psize, NULL) < 0) 256 + if (ogg_packet (s, &idx, &pstart, &psize, NULL) < 0)
93 return AVERROR(EIO); 257 return AVERROR(EIO);
94 }while (idx < 0 || !s->streams[idx]); 258 }while (idx < 0 || !s->streams[idx]);
95 259
96 @@ -592,14 +603,17 @@ 260 @@ -585,14 +606,17 @@ ogg_read_timestamp (AVFormatContext * s,
97 ByteIOContext *bc = s->pb; 261 ByteIOContext *bc = s->pb;
98 int64_t pts = AV_NOPTS_VALUE; 262 int64_t pts = AV_NOPTS_VALUE;
99 int i; 263 int i;
100 + int64_t fpoffset = AV_NOPTS_VALUE; 264 + int64_t fpoffset = AV_NOPTS_VALUE;
101 + int64_t poffset; 265 + int64_t poffset;
102 url_fseek(bc, *pos_arg, SEEK_SET); 266 url_fseek(bc, *pos_arg, SEEK_SET);
103 - while (url_ftell(bc) < pos_limit && !ogg_read_page (s, &i)) { 267 - while (url_ftell(bc) < pos_limit && !ogg_read_page (s, &i)) {
104 + while (url_ftell(bc) < pos_limit && !ogg_read_page (s, &i, &poffset)) { 268 + while (url_ftell(bc) < pos_limit && !ogg_read_page (s, &i, &poffset)) {
105 + if (fpoffset == AV_NOPTS_VALUE && i == stream_index) 269 + if (fpoffset == AV_NOPTS_VALUE && i == stream_index)
106 + fpoffset = poffset; 270 + fpoffset = poffset;
107 if (ogg->streams[i].granule != -1 && ogg->streams[i].granule != 0 && 271 if (ogg->streams[i].granule != -1 && ogg->streams[i].granule != 0 &&
108 ogg->streams[i].codec && i == stream_index) { 272 ogg->streams[i].codec && i == stream_index) {
109 pts = ogg_gptopts(s, i, ogg->streams[i].granule, NULL); 273 pts = ogg_gptopts(s, i, ogg->streams[i].granule, NULL);
110 - // FIXME: this is the position of the packet after the one with abo ve 274 - // FIXME: this is the position of the packet after the one with abo ve
111 - // pts. 275 - // pts.
112 - *pos_arg = url_ftell(bc); 276 - *pos_arg = url_ftell(bc);
113 + *pos_arg = fpoffset; 277 + *pos_arg = fpoffset;
114 + url_fseek(bc, fpoffset, SEEK_SET); 278 + url_fseek(bc, fpoffset, SEEK_SET);
115 break; 279 break;
116 } 280 }
117 } 281 }
118 282 Only in ffmpeg-mt/libavformat: oggdec.c~
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698