mirror of
https://github.com/IllusionMan1212/avif-odin.git
synced 2026-10-24 10:12:28 +00:00
OBU WIP
This commit is contained in:
@@ -7,7 +7,7 @@ import "core:encoding/endian"
|
||||
import "core:io"
|
||||
import "core:strings"
|
||||
|
||||
Error :: image.Error
|
||||
//Error :: image.Error
|
||||
//Image :: image.Image
|
||||
Options :: image.Options
|
||||
|
||||
@@ -130,14 +130,14 @@ read_box :: proc(img: ^Image, reader: ^Reader) -> (err: io.Error) {
|
||||
}
|
||||
|
||||
// if the Box has a size 0 then it's the last Box, parse it and return EOF
|
||||
if reader.size == 0 {
|
||||
if reader.box.size == 0 {
|
||||
err = .EOF
|
||||
}
|
||||
|
||||
fmt.println("box size:", reader.size)
|
||||
fmt.println("type:", reader.type)
|
||||
fmt.println("box size:", reader.box.size)
|
||||
fmt.println("type:", reader.box.type)
|
||||
|
||||
#partial switch reader.type {
|
||||
#partial switch reader.box.type {
|
||||
case .FTYP:
|
||||
read_ftyp(img, reader)
|
||||
case .META:
|
||||
@@ -164,6 +164,8 @@ read_box :: proc(img: ^Image, reader: ^Reader) -> (err: io.Error) {
|
||||
read_colr(reader)
|
||||
case .IPMA:
|
||||
read_ipma(reader)
|
||||
case .MDAT:
|
||||
read_mdat(reader)
|
||||
case:
|
||||
// Skip unknown boxes
|
||||
skip_box(reader)
|
||||
@@ -172,6 +174,15 @@ read_box :: proc(img: ^Image, reader: ^Reader) -> (err: io.Error) {
|
||||
return err
|
||||
}
|
||||
|
||||
@(private)
|
||||
read_mdat :: proc(reader: ^Reader) {
|
||||
// TODO:
|
||||
read_obu(reader)
|
||||
read_obu(reader)
|
||||
read_obu(reader)
|
||||
read_obu(reader)
|
||||
}
|
||||
|
||||
@(private)
|
||||
read_ipma :: proc(reader: ^Reader) {
|
||||
vaf, _ := read_bitfield(reader, VersionAndFlags)
|
||||
|
||||
Reference in New Issue
Block a user