1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

simplify pts/dts reading

Originally committed as revision 7565 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Michael Niedermayer 2007-01-17 10:55:01 +00:00
parent 6845801f82
commit b90ba24b9a

View File

@ -1502,13 +1502,13 @@ static int mpegps_read_pes_header(AVFormatContext *s,
c = get_byte(&s->pb); c = get_byte(&s->pb);
len -= 2; len -= 2;
} }
if ((c & 0xf0) == 0x20) { if ((c & 0xe0) == 0x20) {
dts = pts = get_pts(&s->pb, c); dts = pts = get_pts(&s->pb, c);
len -= 4; len -= 4;
} else if ((c & 0xf0) == 0x30) { if (c & 0x10){
pts = get_pts(&s->pb, c);
dts = get_pts(&s->pb, -1); dts = get_pts(&s->pb, -1);
len -= 9; len -= 5;
}
} else if ((c & 0xc0) == 0x80) { } else if ((c & 0xc0) == 0x80) {
/* mpeg 2 PES */ /* mpeg 2 PES */
#if 0 /* some streams have this field set for no apparent reason */ #if 0 /* some streams have this field set for no apparent reason */
@ -1522,15 +1522,15 @@ static int mpegps_read_pes_header(AVFormatContext *s,
len -= 2; len -= 2;
if (header_len > len) if (header_len > len)
goto error_redo; goto error_redo;
if ((flags & 0xc0) == 0x80) { if (flags & 0x80) {
dts = pts = get_pts(&s->pb, -1); dts = pts = get_pts(&s->pb, -1);
header_len -= 5; header_len -= 5;
len -= 5; len -= 5;
} if ((flags & 0xc0) == 0xc0) { if (flags & 0x40) {
pts = get_pts(&s->pb, -1);
dts = get_pts(&s->pb, -1); dts = get_pts(&s->pb, -1);
header_len -= 10; header_len -= 5;
len -= 10; len -= 5;
}
} }
len -= header_len; len -= header_len;
while (header_len > 0) { while (header_len > 0) {