mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-03-23 04:24:35 +02:00
remove unneeded length checks
Originally committed as revision 18834 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
357ec71f09
commit
58a830239d
@ -1308,7 +1308,7 @@ static int mxf_parse_mpeg2_frame(AVFormatContext *s, AVStream *st, AVPacket *pkt
|
|||||||
for(i = 0; i < pkt->size - 4; i++) {
|
for(i = 0; i < pkt->size - 4; i++) {
|
||||||
c = (c<<8) + pkt->data[i];
|
c = (c<<8) + pkt->data[i];
|
||||||
if (c == 0x1B5) {
|
if (c == 0x1B5) {
|
||||||
if (i + 2 < pkt->size && (pkt->data[i+1] & 0xf0) == 0x10) { // seq ext
|
if ((pkt->data[i+1] & 0xf0) == 0x10) { // seq ext
|
||||||
st->codec->profile = pkt->data[i+1] & 0x07;
|
st->codec->profile = pkt->data[i+1] & 0x07;
|
||||||
st->codec->level = pkt->data[i+2] >> 4;
|
st->codec->level = pkt->data[i+2] >> 4;
|
||||||
} else if (i + 5 < pkt->size && (pkt->data[i+1] & 0xf0) == 0x80) { // pict coding ext
|
} else if (i + 5 < pkt->size && (pkt->data[i+1] & 0xf0) == 0x80) { // pict coding ext
|
||||||
@ -1316,7 +1316,6 @@ static int mxf_parse_mpeg2_frame(AVFormatContext *s, AVStream *st, AVPacket *pkt
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (c == 0x1b8) { // gop
|
} else if (c == 0x1b8) { // gop
|
||||||
if (i + 4 < pkt->size) {
|
|
||||||
if (pkt->data[i+4]>>6 & 0x01) // closed
|
if (pkt->data[i+4]>>6 & 0x01) // closed
|
||||||
*flags |= 0x80; // random access
|
*flags |= 0x80; // random access
|
||||||
if (!mxf->header_written) {
|
if (!mxf->header_written) {
|
||||||
@ -1334,10 +1333,8 @@ static int mxf_parse_mpeg2_frame(AVFormatContext *s, AVStream *st, AVPacket *pkt
|
|||||||
av_log(s, AV_LOG_DEBUG, "frame %d %d:%d:%d%c%d\n", mxf->timecode_start,
|
av_log(s, AV_LOG_DEBUG, "frame %d %d:%d:%d%c%d\n", mxf->timecode_start,
|
||||||
hours, minutes, seconds, mxf->timecode_drop_frame ? ';':':', frames);
|
hours, minutes, seconds, mxf->timecode_drop_frame ? ';':':', frames);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else if (c == 0x1b3) { // seq
|
} else if (c == 0x1b3) { // seq
|
||||||
*flags |= 0x40;
|
*flags |= 0x40;
|
||||||
if (i + 4 < pkt->size) {
|
|
||||||
switch ((pkt->data[i+4]>>4) & 0xf) {
|
switch ((pkt->data[i+4]>>4) & 0xf) {
|
||||||
case 2: sc->aspect_ratio = (AVRational){ 4, 3}; break;
|
case 2: sc->aspect_ratio = (AVRational){ 4, 3}; break;
|
||||||
case 3: sc->aspect_ratio = (AVRational){ 16, 9}; break;
|
case 3: sc->aspect_ratio = (AVRational){ 16, 9}; break;
|
||||||
@ -1346,7 +1343,6 @@ static int mxf_parse_mpeg2_frame(AVFormatContext *s, AVStream *st, AVPacket *pkt
|
|||||||
av_reduce(&sc->aspect_ratio.num, &sc->aspect_ratio.den,
|
av_reduce(&sc->aspect_ratio.num, &sc->aspect_ratio.den,
|
||||||
st->codec->width, st->codec->height, 1024*1024);
|
st->codec->width, st->codec->height, 1024*1024);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else if (c == 0x100) { // pic
|
} else if (c == 0x100) { // pic
|
||||||
int pict_type = (pkt->data[i+2]>>3) & 0x07;
|
int pict_type = (pkt->data[i+2]>>3) & 0x07;
|
||||||
if (pict_type == 2) { // P frame
|
if (pict_type == 2) { // P frame
|
||||||
|
Loading…
x
Reference in New Issue
Block a user