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?

Originally committed as revision 1644 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Michael Niedermayer 2003-03-08 00:44:52 +00:00
parent 63f6082633
commit 9bf9a5fcae

View File

@ -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;