diff --git a/libavformat/av1dec.c b/libavformat/av1dec.c index 5e7a057cb7..1be2fac1c1 100644 --- a/libavformat/av1dec.c +++ b/libavformat/av1dec.c @@ -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; - } - if (type == AV1_OBU_TILE_GROUP && !frame_header) + 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; + } 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)