diff options
author | Michael Niedermayer | 2004-10-19 10:37:02 +0000 |
---|---|---|
committer | Michael Niedermayer | 2004-10-19 10:37:02 +0000 |
commit | 4a8d51356f7f93d905f3dce36fba922d1adf5d95 (patch) | |
tree | abeba8625b248f6c7af7ca0aece7aedc7c83de40 /libavformat/avidec.c | |
parent | 7494cac0fd849a1950799e82bc04e8e6dd15cedc (diff) |
fixing demuxing of vc2_intro.avi
Originally committed as revision 3610 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/avidec.c')
-rw-r--r-- | libavformat/avidec.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/libavformat/avidec.c b/libavformat/avidec.c index 11561686d3..507375f98e 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -383,18 +383,18 @@ static int avi_read_packet(AVFormatContext *s, AVPacket *pkt) AVIContext *avi = s->priv_data; ByteIOContext *pb = &s->pb; int n, d[8], size; - offset_t i; + offset_t i, sync; void* dstr; - - memset(d, -1, sizeof(int)*8); if (avi->dv_demux) { size = dv_get_packet(avi->dv_demux, pkt); if (size >= 0) return size; } - - for(i=url_ftell(pb); !url_feof(pb); i++) { + +resync: + memset(d, -1, sizeof(int)*8); + for(i=sync=url_ftell(pb); !url_feof(pb); i++) { int j; if (i >= avi->movi_end) { @@ -426,10 +426,8 @@ static int avi_read_packet(AVFormatContext *s, AVPacket *pkt) //parse JUNK ||(d[0] == 'J' && d[1] == 'U' && d[2] == 'N' && d[3] == 'K')){ url_fskip(pb, size); - i+= size; - memset(d, -1, sizeof(int)*8); //av_log(NULL, AV_LOG_DEBUG, "SKIP\n"); - continue; + goto resync; } if( d[0] >= '0' && d[0] <= '9' @@ -446,7 +444,7 @@ static int avi_read_packet(AVFormatContext *s, AVPacket *pkt) st = s->streams[n]; ast = st->priv_data; - if( (ast->prefix_count<5 && d[2]<128 && d[3]<128) || + if( ((ast->prefix_count<5 || sync+9 > i) && d[2]<128 && d[3]<128) || d[2]*256+d[3] == ast->prefix /*|| (d[2] == 'd' && d[3] == 'c') || (d[2] == 'w' && d[3] == 'b')*/) { @@ -525,6 +523,7 @@ static int avi_read_packet(AVFormatContext *s, AVPacket *pkt) st->codec.palctrl->palette[k] = b + (g << 8) + (r << 16); } st->codec.palctrl->palette_changed = 1; + goto resync; } } |