- if (buf_end - cur < 92)
- return AVERROR_INVALIDDATA;
- version = AV_RL32(cur);
- d3d_format = AV_RL32(cur+76);
- w = AV_RL16(cur+80);
- h = AV_RL16(cur+82);
- depth = AV_RL8 (cur+84);
- mipmap_count = AV_RL8 (cur+85);
- flags = AV_RL8 (cur+87);
- cur += 92;
+ bytestream2_init(&gb, avpkt->data, avpkt->size);
+ version = bytestream2_get_le32(&gb);
+ bytestream2_skip(&gb, 72);
+ d3d_format = bytestream2_get_le32(&gb);
+ w = bytestream2_get_le16(&gb);
+ h = bytestream2_get_le16(&gb);
+ depth = bytestream2_get_byte(&gb);
+ bytestream2_skip(&gb, 2);
+ flags = bytestream2_get_byte(&gb);