diff options
author | James Almer <jamrial@gmail.com> | 2019-11-15 20:34:08 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2019-11-16 15:56:36 -0300 |
commit | 81d54531f788a1da65b124694c5ef389352289fc (patch) | |
tree | 96862be19ffa8575163a316eb80c391b1e7a4558 /libavformat | |
parent | 2703068110dce2c145a2d3a0f380f8e0de79b632 (diff) | |
download | ffmpeg-81d54531f788a1da65b124694c5ef389352289fc.tar.gz |
avformat/av1dec: simplify annexb_probe()
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/av1dec.c | 23 |
1 files changed, 13 insertions, 10 deletions
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) |