Commit 4b149169 authored by michaelni's avatar michaelni

reversing not yet reversed changes from r1.7 -> r1.8 except the static/const stuff

this seems to fix all avi parsing bugs
kabi, can u explain what this was good for?


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@1644 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 3af5a91d
......@@ -124,14 +124,17 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
get_le32(pb); /* XXX: initial frame ? */
get_le32(pb); /* scale */
get_le32(pb); /* rate */
size -= 6 * 4;
url_fskip(pb, size - 7 * 4);
break;
case MKTAG('a', 'u', 'd', 's'):
codec_type = CODEC_TYPE_AUDIO;
/* nothing really useful */
}
url_fskip(pb, size - 4);
break;
default:
goto fail;
}
break;
case MKTAG('s', 't', 'r', 'f'):
/* stream header */
if (stream_index >= s->nb_streams) {
......@@ -195,24 +198,26 @@ static int avi_read_packet(AVFormatContext *s, AVPacket *pkt)
ByteIOContext *pb = &s->pb;
int n, d1, d2, size;
for(;;) {
find_next:
if (url_feof(pb) || url_ftell(pb) >= avi->movi_end)
return -1;
d1 = get_byte(pb) - '0';
d2 = get_byte(pb) - '0';
if (d1 < 0 || d1 > 9 || d2 < 0 || d2 > 9)
continue;
d1 = get_byte(pb);
if (d1 < '0' || d1 > '9')
goto find_next;
d2 = get_byte(pb);
if (d2 < '0' || d2 > '9')
goto find_next;
n = (d1 - '0') * 10 + (d2 - '0');
n = d1 * 10 + d2;
if (n < 0 || n >= s->nb_streams)
continue;
goto find_next;
d1 = get_byte(pb);
d2 = get_byte(pb);
if ((d1 == 'd' && d2 == 'c')
|| (d1 == 'w' && d2 == 'b'))
break;
}
if ((d1 != 'd' && d2 != 'c') &&
(d1 != 'w' && d2 != 'b'))
goto find_next;
size = get_le32(pb);
av_new_packet(pkt, size);
pkt->stream_index = n;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment