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

avformat/av1dec: simplify annexb_probe()

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2019-11-15 20:34:08 -03:00
parent 2703068110
commit 81d54531f7

View File

@ -75,7 +75,7 @@ static int annexb_probe(const AVProbeData *p)
AVIOContext pb;
int64_t obu_size;
uint32_t temporal_unit_size, frame_unit_size, obu_unit_size;
int seq = 0, frame_header = 0;
int seq = 0;
int ret, type, cnt = 0;
ffio_init_context(&pb, p->buf, p->buf_size, 0,
@ -123,22 +123,25 @@ static int annexb_probe(const AVProbeData *p)
return 0;
cnt += obu_unit_size;
if (type == AV1_OBU_SEQUENCE_HEADER)
switch (type) {
case AV1_OBU_SEQUENCE_HEADER:
seq = 1;
if (type == AV1_OBU_FRAME || type == AV1_OBU_FRAME_HEADER) {
if (frame_header || !seq)
return 0;
frame_header = 1;
break;
case AV1_OBU_FRAME:
case AV1_OBU_FRAME_HEADER:
return seq ? AVPROBE_SCORE_EXTENSION + 1 : 0;
case AV1_OBU_TILE_GROUP:
case AV1_OBU_TEMPORAL_DELIMITER:
return 0;
default:
break;
}
if (type == AV1_OBU_TILE_GROUP && !frame_header)
return 0;
temporal_unit_size -= obu_unit_size + ret;
frame_unit_size -= obu_unit_size + ret;
} while (!frame_header && frame_unit_size);
} while (frame_unit_size);
return frame_header ? AVPROBE_SCORE_EXTENSION + 1 : 0;
return 0;
}
static int annexb_read_header(AVFormatContext *s)