aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/electronicarts.c
diff options
context:
space:
mode:
authorAurelien Jacobs <aurel@gnuage.org>2007-10-18 22:26:23 +0000
committerAurelien Jacobs <aurel@gnuage.org>2007-10-18 22:26:23 +0000
commitf8cab062caacba2982a0d0bccd504b11c073caf6 (patch)
treeaa285952bbe6077aba595bed6f162e121dd86612 /libavformat/electronicarts.c
parentaf704ee420b03c65c3d3f8aabb56418722f70179 (diff)
downloadffmpeg-f8cab062caacba2982a0d0bccd504b11c073caf6.tar.gz
parse header chunk in a loop (don't depend on a fixed chunk ordering)
Originally committed as revision 10792 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/electronicarts.c')
-rw-r--r--libavformat/electronicarts.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/libavformat/electronicarts.c b/libavformat/electronicarts.c
index dd129f158e..74ef7c8d12 100644
--- a/libavformat/electronicarts.c
+++ b/libavformat/electronicarts.c
@@ -162,17 +162,16 @@ static int process_ea_header(AVFormatContext *s) {
uint32_t blockid, size = 0;
EaDemuxContext *ea = s->priv_data;
ByteIOContext *pb = &s->pb;
+ int i;
+
+ for (i=0; i<5 && (!ea->audio_codec || !ea->video_codec); i++) {
+ unsigned int startpos = url_ftell(pb);
blockid = get_le32(pb);
- if (blockid == MVhd_TAG) {
size = get_le32(pb);
- process_video_header_vp6(s);
- url_fskip(pb, size-32);
- blockid = get_le32(pb);
- }
- if (blockid != SCHl_TAG)
- return 0;
- size += get_le32(pb);
+
+ switch (blockid) {
+ case SCHl_TAG :
blockid = get_le32(pb);
if (blockid == GSTR_TAG) {
url_fskip(pb, 4);
@@ -182,9 +181,17 @@ static int process_ea_header(AVFormatContext *s) {
}
process_audio_header_elements(s);
+ break;
+
+ case MVhd_TAG :
+ process_video_header_vp6(s);
+ break;
+ }
+
+ url_fseek(pb, startpos + size, SEEK_SET);
+ }
- /* skip to the start of the data */
- url_fseek(pb, size, SEEK_SET);
+ url_fseek(pb, 0, SEEK_SET);
return 1;
}