mirror of
https://github.com/IllusionMan1212/flac-odin.git
synced 2026-10-24 02:12:29 +00:00
WIP: better API
This commit is contained in:
@@ -2,6 +2,15 @@
|
|||||||
|
|
||||||
FLAC decoder library written in Odin (WIP)
|
FLAC decoder library written in Odin (WIP)
|
||||||
|
|
||||||
|
### References
|
||||||
|
Reference material that was used in the development of this library.
|
||||||
|
|
||||||
|
- **Official FLAC documentation**: https://xiph.org/flac/format.html
|
||||||
|
- **IETF draft specification**: https://datatracker.ietf.org/doc/draft-ietf-cellar-flac/
|
||||||
|
- **UTF-8 RFC3629**: https://datatracker.ietf.org/doc/html/rfc3629
|
||||||
|
- **IETF specification's rfc backmatter**: https://github.com/ietf-wg-cellar/flac-specification/blob/master/rfc_backmatter.md
|
||||||
|
- **mewkiz's excellent library**: https://github.com/mewkiz/flac
|
||||||
|
|
||||||
## LICENSE
|
## LICENSE
|
||||||
No license has been decided on yet. A suitable license will be chosen once the project is near "completion".
|
No license has been decided on yet. A suitable license will be chosen once the project is near "completion".
|
||||||
|
|
||||||
|
|||||||
@@ -20,21 +20,16 @@ faulty/09 -> This one works when it shouldn't. (Blocksize 1, below the allowed m
|
|||||||
|
|
||||||
Things:-
|
Things:-
|
||||||
[ ] Options
|
[ ] Options
|
||||||
|
- [ ] Vorbis comment data
|
||||||
|
- [ ] Cuesheet ?
|
||||||
|
- [ ] Seektable ?
|
||||||
|
- [x] Picture data
|
||||||
[ ] File streaming API? io.Stream??
|
[ ] File streaming API? io.Stream??
|
||||||
[ ] Lots of checks (look at the TODOs in flac.odin)
|
[ ] Lots of checks (look at the TODOs in flac.odin)
|
||||||
[ ] Memory optimizations
|
[ ] Memory optimizations
|
||||||
[ ] Speed optimizations
|
[ ] Speed optimizations
|
||||||
[ ] Seeking
|
[ ] Seeking
|
||||||
[x] RICE2
|
[ ] Fuzzing to test the stability of the code
|
||||||
[x] Add check for mismatched bits per sample
|
|
||||||
[x] Unencoded BPS is zero
|
|
||||||
[x] CONSTANT subframe
|
|
||||||
[x] Stereo Decorrelation
|
|
||||||
[x] MD5 checksums
|
|
||||||
- [x] VERBATIM subframe
|
|
||||||
- [x] CONSTANT subframe
|
|
||||||
- [x] FIXED subframe
|
|
||||||
- [x] LPC subframe
|
|
||||||
|
|
||||||
[ ] Encoder (low priority for now)
|
[ ] Encoder (low priority for now)
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -23,7 +23,7 @@ main :: proc() {
|
|||||||
allocator := virtual.arena_allocator(&arena)
|
allocator := virtual.arena_allocator(&arena)
|
||||||
|
|
||||||
start := time.now()
|
start := time.now()
|
||||||
err := flac.load_from_file(os.args[1], allocator = allocator)
|
flac_data, err := flac.load_from_file(os.args[1], allocator = allocator)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.eprintln(err)
|
fmt.eprintln(err)
|
||||||
os.exit(1)
|
os.exit(1)
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ Option :: enum {
|
|||||||
|
|
||||||
Options :: bit_set[Option]
|
Options :: bit_set[Option]
|
||||||
|
|
||||||
PictureType :: enum u32be {
|
PictureType :: enum u32 {
|
||||||
OTHER,
|
OTHER,
|
||||||
FILE_ICON_32x32_PNG,
|
FILE_ICON_32x32_PNG,
|
||||||
OTHER_FILE_ICON,
|
OTHER_FILE_ICON,
|
||||||
@@ -77,24 +77,30 @@ PictureType :: enum u32be {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Flac :: struct {
|
Flac :: struct {
|
||||||
// TODO: Sample slice or array, other stuff
|
// TODO: Other stuff
|
||||||
metadata: Flac_Metadata,
|
metadata: FlacMetadata,
|
||||||
samples: []i32,
|
samples: []i32,
|
||||||
}
|
}
|
||||||
|
|
||||||
Flac_Metadata :: struct {
|
FlacMetadata :: struct {
|
||||||
// TODO: Picture info and data and other stuff
|
total_samples: u64,
|
||||||
total_samples: u32,
|
|
||||||
bits_per_sample: u8,
|
bits_per_sample: u8,
|
||||||
channels: u8,
|
channels: u8,
|
||||||
sample_rate: u32,
|
sample_rate: u32,
|
||||||
|
expected_md5: [16]byte,
|
||||||
|
calculated_md5: [16]byte,
|
||||||
|
pictures: []Picture,
|
||||||
}
|
}
|
||||||
|
|
||||||
#assert(size_of(FlacHeader) == 0x2A)
|
Picture :: struct {
|
||||||
FlacHeader :: struct #packed {
|
type: PictureType,
|
||||||
magic: u32be,
|
mimetype: string,
|
||||||
streaminfo_header: u32be,
|
description: string,
|
||||||
streaminfo: StreamInfoBlock,
|
width: u32,
|
||||||
|
height: u32,
|
||||||
|
depth: u32,
|
||||||
|
num_colors: u32,
|
||||||
|
data: []byte,
|
||||||
}
|
}
|
||||||
|
|
||||||
decode_subframe :: proc(r: ^Reader, bps: u8, block_size: u16) -> (samples: []i32, err: Error) #no_bounds_check {
|
decode_subframe :: proc(r: ^Reader, bps: u8, block_size: u16) -> (samples: []i32, err: Error) #no_bounds_check {
|
||||||
@@ -168,6 +174,7 @@ decode_subframe :: proc(r: ^Reader, bps: u8, block_size: u16) -> (samples: []i32
|
|||||||
}
|
}
|
||||||
|
|
||||||
coefficients := make([]i32, predictor_order)
|
coefficients := make([]i32, predictor_order)
|
||||||
|
defer delete(coefficients)
|
||||||
|
|
||||||
for i in 0..<predictor_order {
|
for i in 0..<predictor_order {
|
||||||
unencoded_coefficient := i32(read_bits(r, uint(coeff_precision)) or_return)
|
unencoded_coefficient := i32(read_bits(r, uint(coeff_precision)) or_return)
|
||||||
@@ -393,9 +400,7 @@ frame_num := 0
|
|||||||
|
|
||||||
decode_frame :: proc(
|
decode_frame :: proc(
|
||||||
r: ^Reader,
|
r: ^Reader,
|
||||||
streaminfo_bps: u8,
|
flac: ^Flac,
|
||||||
streaminfo_sample_rate: u32,
|
|
||||||
channels: u8,
|
|
||||||
) -> (
|
) -> (
|
||||||
err: Error,
|
err: Error,
|
||||||
) #no_bounds_check {
|
) #no_bounds_check {
|
||||||
@@ -462,8 +467,7 @@ decode_frame :: proc(
|
|||||||
actual_sample_rate_in_Hz: u32
|
actual_sample_rate_in_Hz: u32
|
||||||
switch sample_rate {
|
switch sample_rate {
|
||||||
case .USE_STREAMINFO:
|
case .USE_STREAMINFO:
|
||||||
// TODO: ditto for global streaminfo
|
actual_sample_rate_in_Hz = flac.metadata.sample_rate
|
||||||
actual_sample_rate_in_Hz = streaminfo_sample_rate
|
|
||||||
case ._88_2kHz:
|
case ._88_2kHz:
|
||||||
actual_sample_rate_in_Hz = 88200
|
actual_sample_rate_in_Hz = 88200
|
||||||
case ._176_4kHz:
|
case ._176_4kHz:
|
||||||
@@ -522,9 +526,7 @@ decode_frame :: proc(
|
|||||||
bps: u8
|
bps: u8
|
||||||
switch sample_size {
|
switch sample_size {
|
||||||
case .USE_STREAMINFO:
|
case .USE_STREAMINFO:
|
||||||
// TODO: maybe we'll store the streaminfo data in a global flac struct and then retrieve from there
|
bps = flac.metadata.bits_per_sample
|
||||||
// instead of passing a parameter
|
|
||||||
bps = streaminfo_bps
|
|
||||||
case ._8BPS:
|
case ._8BPS:
|
||||||
bps = 8
|
bps = 8
|
||||||
case ._12BPS:
|
case ._12BPS:
|
||||||
@@ -539,11 +541,11 @@ decode_frame :: proc(
|
|||||||
bps = 32
|
bps = 32
|
||||||
}
|
}
|
||||||
|
|
||||||
if bps != streaminfo_bps {
|
if bps != flac.metadata.bits_per_sample {
|
||||||
return .Bits_Per_Second_Mismatch
|
return .Bits_Per_Second_Mismatch
|
||||||
}
|
}
|
||||||
|
|
||||||
frame_channels := channels
|
frame_channels := flac.metadata.channels
|
||||||
switch channel_assignment {
|
switch channel_assignment {
|
||||||
case .MONO:
|
case .MONO:
|
||||||
frame_channels = 1
|
frame_channels = 1
|
||||||
@@ -566,7 +568,7 @@ decode_frame :: proc(
|
|||||||
frame_channels = 2
|
frame_channels = 2
|
||||||
}
|
}
|
||||||
|
|
||||||
if frame_channels != channels {
|
if frame_channels != flac.metadata.channels {
|
||||||
// TODO: warning or error?
|
// TODO: warning or error?
|
||||||
// we have a faulty file that says it has 5 channels but subframes all say they got 1
|
// we have a faulty file that says it has 5 channels but subframes all say they got 1
|
||||||
// we also have an two uncommon files with increasing and decreasing number of channels
|
// we also have an two uncommon files with increasing and decreasing number of channels
|
||||||
@@ -576,6 +578,7 @@ decode_frame :: proc(
|
|||||||
|
|
||||||
// TODO: remember to clean this up
|
// TODO: remember to clean this up
|
||||||
subframes := make([][]i32, frame_channels)
|
subframes := make([][]i32, frame_channels)
|
||||||
|
defer delete(subframes)
|
||||||
for i in 0..<frame_channels {
|
for i in 0..<frame_channels {
|
||||||
frame_bps := bps
|
frame_bps := bps
|
||||||
// For side channels we increase the bps by 1
|
// For side channels we increase the bps by 1
|
||||||
@@ -650,6 +653,14 @@ decode_frame :: proc(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: We need a way to copy (or better yet just point to) the decoded sample data
|
||||||
|
// We'll probably either copy each subframe's samples somehow, or have a dynamic array and append to that.
|
||||||
|
// Both are slow-ish but I can't think of a faster way that just works.
|
||||||
|
// This doesn't work btw, just for my future self to not think this is fine.
|
||||||
|
for subframe in subframes {
|
||||||
|
copy(flac.samples, subframe)
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Frame Footer
|
// Frame Footer
|
||||||
//
|
//
|
||||||
@@ -667,7 +678,7 @@ decode_frame :: proc(
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
load_from_bytes :: proc(data: []byte, options := Options{}, allocator := context.allocator) -> (err: Error) {
|
load_from_bytes :: proc(data: []byte, options := Options{}, allocator := context.allocator) -> (flac: ^Flac, err: Error) {
|
||||||
r: Reader
|
r: Reader
|
||||||
bytes.reader_init(&r, data)
|
bytes.reader_init(&r, data)
|
||||||
|
|
||||||
@@ -676,26 +687,14 @@ load_from_bytes :: proc(data: []byte, options := Options{}, allocator := context
|
|||||||
|
|
||||||
header := read_data(&r, FlacHeader) or_return
|
header := read_data(&r, FlacHeader) or_return
|
||||||
if header.magic != FLAC_MAGIC {
|
if header.magic != FLAC_MAGIC {
|
||||||
return .Invalid_Signature
|
return nil, .Invalid_Signature
|
||||||
}
|
}
|
||||||
|
|
||||||
//fmt.println(header)
|
|
||||||
|
|
||||||
sample_rate := header.streaminfo.sr_chan_bps_ts >> 44
|
sample_rate := header.streaminfo.sr_chan_bps_ts >> 44
|
||||||
num_channel_minus_one := (header.streaminfo.sr_chan_bps_ts >> 41) & 7
|
num_channel_minus_one := (header.streaminfo.sr_chan_bps_ts >> 41) & 7
|
||||||
bits_per_sample_minus_one := (header.streaminfo.sr_chan_bps_ts >> 36) & 0x1F
|
bits_per_sample_minus_one := (header.streaminfo.sr_chan_bps_ts >> 36) & 0x1F
|
||||||
total_samples := header.streaminfo.sr_chan_bps_ts & 0xFFFFFFFFF
|
total_samples := header.streaminfo.sr_chan_bps_ts & 0xFFFFFFFFF
|
||||||
|
|
||||||
//fmt.println("sample rate:", sample_rate)
|
|
||||||
//fmt.println("channels:", num_channel_minus_one + 1)
|
|
||||||
//fmt.println("bits per sample:", bits_per_sample_minus_one + 1)
|
|
||||||
//fmt.println("total samples:", total_samples)
|
|
||||||
|
|
||||||
/*bit_field u32be {
|
|
||||||
last_block: bool | 1,
|
|
||||||
type: BlockType | 7,
|
|
||||||
length: u32be | 24,
|
|
||||||
}*/
|
|
||||||
streaminfo_header := MetadataBlockHeader {
|
streaminfo_header := MetadataBlockHeader {
|
||||||
last_block = bool(header.streaminfo_header >> 31),
|
last_block = bool(header.streaminfo_header >> 31),
|
||||||
type = BlockType((header.streaminfo_header >> 24) & 0x7F),
|
type = BlockType((header.streaminfo_header >> 24) & 0x7F),
|
||||||
@@ -703,9 +702,20 @@ load_from_bytes :: proc(data: []byte, options := Options{}, allocator := context
|
|||||||
}
|
}
|
||||||
|
|
||||||
if streaminfo_header.type != .STREAMINFO {
|
if streaminfo_header.type != .STREAMINFO {
|
||||||
return .Missing_StreamInfo
|
return flac, .Missing_StreamInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if flac == nil {
|
||||||
|
flac = new(Flac)
|
||||||
|
}
|
||||||
|
|
||||||
|
flac.metadata.channels = u8(num_channel_minus_one + 1)
|
||||||
|
flac.metadata.sample_rate = u32(sample_rate)
|
||||||
|
flac.metadata.bits_per_sample = u8(bits_per_sample_minus_one + 1)
|
||||||
|
flac.metadata.total_samples = u64(total_samples)
|
||||||
|
flac.metadata.expected_md5 = header.streaminfo.md5
|
||||||
|
|
||||||
|
pictures := make([dynamic]Picture, 0, 2, allocator)
|
||||||
last_block := streaminfo_header.last_block
|
last_block := streaminfo_header.last_block
|
||||||
for !last_block {
|
for !last_block {
|
||||||
md_block_hdr := read_data(&r, u32be) or_return
|
md_block_hdr := read_data(&r, u32be) or_return
|
||||||
@@ -714,7 +724,6 @@ load_from_bytes :: proc(data: []byte, options := Options{}, allocator := context
|
|||||||
type = BlockType((md_block_hdr >> 24) & 0x7F),
|
type = BlockType((md_block_hdr >> 24) & 0x7F),
|
||||||
length = u32(md_block_hdr & 0xFFFFFF),
|
length = u32(md_block_hdr & 0xFFFFFF),
|
||||||
}
|
}
|
||||||
//fmt.println("Metadata block", metadata_block_header)
|
|
||||||
|
|
||||||
last_block = cast(bool)(metadata_block_header.last_block)
|
last_block = cast(bool)(metadata_block_header.last_block)
|
||||||
|
|
||||||
@@ -757,7 +766,7 @@ load_from_bytes :: proc(data: []byte, options := Options{}, allocator := context
|
|||||||
// I think so, the comment isn't crucial to the decoding process.
|
// I think so, the comment isn't crucial to the decoding process.
|
||||||
//fmt.println("Metadata header length mismatch!")
|
//fmt.println("Metadata header length mismatch!")
|
||||||
//fmt.printfln("Expected size: %d, Got %d", metadata_block_header.length, actual_size)
|
//fmt.printfln("Expected size: %d, Got %d", metadata_block_header.length, actual_size)
|
||||||
return .Metadata_Block_Length_Mismatch
|
return flac, .Metadata_Block_Length_Mismatch
|
||||||
}
|
}
|
||||||
// TODO: framing bit??
|
// TODO: framing bit??
|
||||||
//fmt.println(vendor_name)
|
//fmt.println(vendor_name)
|
||||||
@@ -767,7 +776,7 @@ load_from_bytes :: proc(data: []byte, options := Options{}, allocator := context
|
|||||||
cuesheet := read_data(&r, CueSheet) or_return
|
cuesheet := read_data(&r, CueSheet) or_return
|
||||||
if cuesheet.num_tracks < 1 {
|
if cuesheet.num_tracks < 1 {
|
||||||
// TODO: should this be a warning instead of an error that halts the decoding?
|
// TODO: should this be a warning instead of an error that halts the decoding?
|
||||||
return .Missing_Lead_Out_Track
|
return flac, .Missing_Lead_Out_Track
|
||||||
}
|
}
|
||||||
//fmt.println(cuesheet)
|
//fmt.println(cuesheet)
|
||||||
for i in 0..<cuesheet.num_tracks {
|
for i in 0..<cuesheet.num_tracks {
|
||||||
@@ -779,28 +788,24 @@ load_from_bytes :: proc(data: []byte, options := Options{}, allocator := context
|
|||||||
//fmt.println(track)
|
//fmt.println(track)
|
||||||
}
|
}
|
||||||
case .PICTURE:
|
case .PICTURE:
|
||||||
// TODO: save the pic data into a struct
|
pic_type := PictureType(read_data(&r, u32be) or_return)
|
||||||
pic_type := read_data(&r, PictureType) or_return
|
|
||||||
mime_len := read_data(&r, u32be) or_return
|
mime_len := read_data(&r, u32be) or_return
|
||||||
mimetype := string(read_slice(&r, auto_cast mime_len) or_return)
|
mimetype := string(read_slice(&r, auto_cast mime_len) or_return)
|
||||||
desc_len := read_data(&r, u32be) or_return
|
desc_len := read_data(&r, u32be) or_return
|
||||||
desc := string(read_slice(&r, auto_cast desc_len) or_return)
|
desc := string(read_slice(&r, auto_cast desc_len) or_return)
|
||||||
metadata := read_data(&r, PictureMetadata) or_return
|
metadata := read_data(&r, PictureMetadata) or_return
|
||||||
width := metadata.width
|
data := read_slice(&r, auto_cast metadata.data_len) or_return
|
||||||
height := metadata.height
|
picture := Picture{
|
||||||
depth := metadata.depth
|
type = pic_type,
|
||||||
num_colors := metadata.num_colors
|
mimetype = mimetype,
|
||||||
data_len := metadata.data_len
|
description = desc,
|
||||||
data := read_slice(&r, auto_cast data_len) or_return
|
width = u32(metadata.width),
|
||||||
//fmt.println(pic_type)
|
height = u32(metadata.height),
|
||||||
//fmt.println(mimetype)
|
depth = u32(metadata.depth),
|
||||||
//fmt.println(desc)
|
num_colors = u32(metadata.num_colors),
|
||||||
//fmt.println(width)
|
data = data,
|
||||||
//fmt.println(height)
|
}
|
||||||
//fmt.println(depth)
|
append(&pictures, picture)
|
||||||
//fmt.println(num_colors)
|
|
||||||
//fmt.println(data_len)
|
|
||||||
//fmt.println(data)
|
|
||||||
case .INVALID:
|
case .INVALID:
|
||||||
fmt.eprintln("Invalid block type")
|
fmt.eprintln("Invalid block type")
|
||||||
bytes.reader_seek(&r, auto_cast metadata_block_header.length, .Current)
|
bytes.reader_seek(&r, auto_cast metadata_block_header.length, .Current)
|
||||||
@@ -811,31 +816,33 @@ load_from_bytes :: proc(data: []byte, options := Options{}, allocator := context
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Yucky
|
// Yucky
|
||||||
err = decode_frame(&r, u8(bits_per_sample_minus_one + 1), u32(sample_rate), u8(num_channel_minus_one + 1))
|
err = decode_frame(&r, flac)
|
||||||
for err == nil {
|
for err == nil {
|
||||||
err = decode_frame(&r, u8(bits_per_sample_minus_one + 1), u32(sample_rate), u8(num_channel_minus_one + 1))
|
err = decode_frame(&r, flac)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
flac.metadata.pictures = pictures[:]
|
||||||
|
|
||||||
if err != .EOF {
|
if err != .EOF {
|
||||||
return err
|
return flac, err
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Validate the decoded audio data's md5
|
// Validate the decoded audio data's md5
|
||||||
//
|
//
|
||||||
calculated_md5 := make([]byte, 16)
|
calculated_md5: [16]byte
|
||||||
md5.final(&md5_ctx, calculated_md5)
|
md5.final(&md5_ctx, calculated_md5[:])
|
||||||
|
|
||||||
if mem.compare(calculated_md5, header.streaminfo.md5[:]) != 0 {
|
flac.metadata.calculated_md5 = calculated_md5
|
||||||
fmt.printfln("Expected: %X", header.streaminfo.md5)
|
|
||||||
fmt.printfln("Got: %X", calculated_md5)
|
if mem.compare(calculated_md5[:], header.streaminfo.md5[:]) != 0 {
|
||||||
return .MD5_Mismatch
|
return flac, .MD5_Mismatch
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return flac, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
load_from_file :: proc(filename: string, options := Options{}, allocator := context.allocator) -> (err: Error) {
|
load_from_file :: proc(filename: string, options := Options{}, allocator := context.allocator) -> (flac: ^Flac, err: Error) {
|
||||||
context.allocator = allocator
|
context.allocator = allocator
|
||||||
|
|
||||||
data, ok := os.read_entire_file(filename)
|
data, ok := os.read_entire_file(filename)
|
||||||
@@ -844,6 +851,20 @@ load_from_file :: proc(filename: string, options := Options{}, allocator := cont
|
|||||||
if ok {
|
if ok {
|
||||||
return load_from_bytes(data)
|
return load_from_bytes(data)
|
||||||
} else {
|
} else {
|
||||||
return .Unable_To_Read_File
|
return nil, .Unable_To_Read_File
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
destroy :: proc(flac: ^Flac) {
|
||||||
|
// TODO: clean up the allocations
|
||||||
|
delete(flac.samples)
|
||||||
|
// TODO: I think this data gets deleted when the data from os.read_entire_file is deleted.
|
||||||
|
// Double check that and if it's true then make sure to copy this data.
|
||||||
|
// Copying small strings is fine but copying the image pixel data might be slow.
|
||||||
|
//for picture in flac.metadata.pictures {
|
||||||
|
// picture.mimetype
|
||||||
|
// picture.data
|
||||||
|
// picture.description
|
||||||
|
//}
|
||||||
|
delete(flac.metadata.pictures)
|
||||||
|
}
|
||||||
|
|||||||
@@ -154,12 +154,26 @@ ResidualCodingMethod :: enum {
|
|||||||
RICE2,
|
RICE2,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
bit_field u32be {
|
||||||
|
last_block: bool | 1,
|
||||||
|
type: BlockType | 7,
|
||||||
|
length: u32be | 24,
|
||||||
|
}
|
||||||
|
*/
|
||||||
MetadataBlockHeader :: struct {
|
MetadataBlockHeader :: struct {
|
||||||
type: BlockType,
|
type: BlockType,
|
||||||
last_block: bool,
|
last_block: bool,
|
||||||
length: u32,
|
length: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#assert(size_of(FlacHeader) == 0x2A)
|
||||||
|
FlacHeader :: struct #packed {
|
||||||
|
magic: u32be,
|
||||||
|
streaminfo_header: u32be,
|
||||||
|
streaminfo: StreamInfoBlock,
|
||||||
|
}
|
||||||
|
|
||||||
#assert(size_of(Seekpoint) == 18)
|
#assert(size_of(Seekpoint) == 18)
|
||||||
Seekpoint :: struct #packed {
|
Seekpoint :: struct #packed {
|
||||||
sample_num: u64be,
|
sample_num: u64be,
|
||||||
|
|||||||
+198
-79
@@ -8,529 +8,648 @@ import "shared:flac"
|
|||||||
@(test)
|
@(test)
|
||||||
test_blocksize_4096 :: proc(t: ^testing.T) {
|
test_blocksize_4096 :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/01 - blocksize 4096.flac")
|
data, err := flac.load_from_file("flac-test-files/subset/01 - blocksize 4096.flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("Blocksize 4096 Failed with error:", err))
|
testing.expect(t, err == nil, fmt.tprint("Blocksize 4096 Failed with error:", err))
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
test_blocksize_4608 :: proc(t: ^testing.T) {
|
test_blocksize_4608 :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/02 - blocksize 4608.flac")
|
data, err := flac.load_from_file("flac-test-files/subset/02 - blocksize 4608.flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("Blocksize 4608 Failed with error:", err))
|
testing.expect(t, err == nil, fmt.tprint("Blocksize 4608 Failed with error:", err))
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
test_blocksize_16 :: proc(t: ^testing.T) {
|
test_blocksize_16 :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/03 - blocksize 16.flac")
|
data, err := flac.load_from_file("flac-test-files/subset/03 - blocksize 16.flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("Blocksize 16 Failed with error:", err))
|
testing.expect(t, err == nil, fmt.tprint("Blocksize 16 Failed with error:", err))
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
test_blocksize_192 :: proc(t: ^testing.T) {
|
test_blocksize_192 :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/04 - blocksize 192.flac")
|
data, err := flac.load_from_file("flac-test-files/subset/04 - blocksize 192.flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("Blocksize 192 Failed with error:", err))
|
testing.expect(t, err == nil, fmt.tprint("Blocksize 192 Failed with error:", err))
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
test_blocksize_254 :: proc(t: ^testing.T) {
|
test_blocksize_254 :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/05 - blocksize 254.flac")
|
data, err := flac.load_from_file("flac-test-files/subset/05 - blocksize 254.flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("Blocksize 254 Failed with error:", err))
|
testing.expect(t, err == nil, fmt.tprint("Blocksize 254 Failed with error:", err))
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
test_blocksize_512 :: proc(t: ^testing.T) {
|
test_blocksize_512 :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/06 - blocksize 512.flac")
|
data, err := flac.load_from_file("flac-test-files/subset/06 - blocksize 512.flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("Blocksize 512 Failed with error:", err))
|
testing.expect(t, err == nil, fmt.tprint("Blocksize 512 Failed with error:", err))
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
test_blocksize_725 :: proc(t: ^testing.T) {
|
test_blocksize_725 :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/07 - blocksize 725.flac")
|
data, err := flac.load_from_file("flac-test-files/subset/07 - blocksize 725.flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("Blocksize 725 Failed with error:", err))
|
testing.expect(t, err == nil, fmt.tprint("Blocksize 725 Failed with error:", err))
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
test_blocksize_1000 :: proc(t: ^testing.T) {
|
test_blocksize_1000 :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/08 - blocksize 1000.flac")
|
data, err := flac.load_from_file("flac-test-files/subset/08 - blocksize 1000.flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("Blocksize 1000 Failed with error:", err))
|
testing.expect(t, err == nil, fmt.tprint("Blocksize 1000 Failed with error:", err))
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
test_blocksize_1937 :: proc(t: ^testing.T) {
|
test_blocksize_1937 :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/09 - blocksize 1937.flac")
|
data, err := flac.load_from_file("flac-test-files/subset/09 - blocksize 1937.flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("Blocksize 1937 Failed with error:", err))
|
testing.expect(t, err == nil, fmt.tprint("Blocksize 1937 Failed with error:", err))
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
test_blocksize_2304 :: proc(t: ^testing.T) {
|
test_blocksize_2304 :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/10 - blocksize 2304.flac")
|
data, err := flac.load_from_file("flac-test-files/subset/10 - blocksize 2304.flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("Blocksize 2304 Failed with error:", err))
|
testing.expect(t, err == nil, fmt.tprint("Blocksize 2304 Failed with error:", err))
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
test_partition_order_8 :: proc(t: ^testing.T) {
|
test_partition_order_8 :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/11 - partition order 8.flac")
|
data, err := flac.load_from_file("flac-test-files/subset/11 - partition order 8.flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("Partition order 8 Failed with error:", err))
|
testing.expect(t, err == nil, fmt.tprint("Partition order 8 Failed with error:", err))
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
test_qlp_precision_15_bit :: proc(t: ^testing.T) {
|
test_qlp_precision_15_bit :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/12 - qlp precision 15 bit.flac")
|
data, err := flac.load_from_file("flac-test-files/subset/12 - qlp precision 15 bit.flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("qlp precision 15 bit Failed with error:", err))
|
testing.expect(t, err == nil, fmt.tprint("qlp precision 15 bit Failed with error:", err))
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
test_qlp_precision_2_bit :: proc(t: ^testing.T) {
|
test_qlp_precision_2_bit :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/13 - qlp precision 2 bit.flac")
|
data, err := flac.load_from_file("flac-test-files/subset/13 - qlp precision 2 bit.flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("qlp precision 2 bit Failed with error:", err))
|
testing.expect(t, err == nil, fmt.tprint("qlp precision 2 bit Failed with error:", err))
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
wasted_bits :: proc(t: ^testing.T) {
|
wasted_bits :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/14 - wasted bits.flac")
|
data, err := flac.load_from_file("flac-test-files/subset/14 - wasted bits.flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("Wasted bits Failed with error:", err))
|
testing.expect(t, err == nil, fmt.tprint("Wasted bits Failed with error:", err))
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
only_verbatim_subframes :: proc(t: ^testing.T) {
|
only_verbatim_subframes :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/15 - only verbatim subframes.flac")
|
data, err := flac.load_from_file("flac-test-files/subset/15 - only verbatim subframes.flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("Only verbatim subframes Failed with error:", err))
|
testing.expect(t, err == nil, fmt.tprint("Only verbatim subframes Failed with error:", err))
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
partition_order_8_containing_escaped_partitions :: proc(t: ^testing.T) {
|
partition_order_8_containing_escaped_partitions :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/16 - partition order 8 containing escaped partitions.flac")
|
data, err := flac.load_from_file("flac-test-files/subset/16 - partition order 8 containing escaped partitions.flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("Partition order 8 containing escaped partitions Failed with error:", err))
|
testing.expect(
|
||||||
|
t,
|
||||||
|
err == nil,
|
||||||
|
fmt.tprint("Partition order 8 containing escaped partitions Failed with error:", err),
|
||||||
|
)
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
all_fixed_orders :: proc(t: ^testing.T) {
|
all_fixed_orders :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/17 - all fixed orders.flac")
|
data, err := flac.load_from_file("flac-test-files/subset/17 - all fixed orders.flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("All fixed orders Failed with error:", err))
|
testing.expect(t, err == nil, fmt.tprint("All fixed orders Failed with error:", err))
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
precision_search :: proc(t: ^testing.T) {
|
precision_search :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/18 - precision search.flac")
|
data, err := flac.load_from_file("flac-test-files/subset/18 - precision search.flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("Precision search Failed with error:", err))
|
testing.expect(t, err == nil, fmt.tprint("Precision search Failed with error:", err))
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
samplerate_35467Hz :: proc(t: ^testing.T) {
|
samplerate_35467Hz :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/19 - samplerate 35467Hz.flac")
|
data, err := flac.load_from_file("flac-test-files/subset/19 - samplerate 35467Hz.flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("Samplerate 35467Hz Failed with error:", err))
|
testing.expect(t, err == nil, fmt.tprint("Samplerate 35467Hz Failed with error:", err))
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
samplerate_39kHz :: proc(t: ^testing.T) {
|
samplerate_39kHz :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/20 - samplerate 39kHz.flac")
|
data, err := flac.load_from_file("flac-test-files/subset/20 - samplerate 39kHz.flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("Samplerate 39kHz Failed with error:", err))
|
testing.expect(t, err == nil, fmt.tprint("Samplerate 39kHz Failed with error:", err))
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
samplerate_22050Hz :: proc(t: ^testing.T) {
|
samplerate_22050Hz :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/21 - samplerate 22050Hz.flac")
|
data, err := flac.load_from_file("flac-test-files/subset/21 - samplerate 22050Hz.flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("Samplerate 22050Hz Failed with error:", err))
|
testing.expect(t, err == nil, fmt.tprint("Samplerate 22050Hz Failed with error:", err))
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
_12_bit_per_sample :: proc(t: ^testing.T) {
|
_12_bit_per_sample :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/22 - 12 bit per sample.flac")
|
data, err := flac.load_from_file("flac-test-files/subset/22 - 12 bit per sample.flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("12 bit per sample Failed with error:", err))
|
testing.expect(t, err == nil, fmt.tprint("12 bit per sample Failed with error:", err))
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
_8_bit_per_sample :: proc(t: ^testing.T) {
|
_8_bit_per_sample :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/23 - 8 bit per sample.flac")
|
data, err := flac.load_from_file("flac-test-files/subset/23 - 8 bit per sample.flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("8 bit per sample Failed with error:", err))
|
testing.expect(t, err == nil, fmt.tprint("8 bit per sample Failed with error:", err))
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
variable_blocksize_file_created_with_flake_revision_264 :: proc(t: ^testing.T) {
|
variable_blocksize_file_created_with_flake_revision_264 :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/24 - variable blocksize file created with flake revision 264.flac")
|
data, err := flac.load_from_file(
|
||||||
|
"flac-test-files/subset/24 - variable blocksize file created with flake revision 264.flac",
|
||||||
|
)
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("Variable blocksize file created with flake revision 264 Failed with error:", err))
|
testing.expect(
|
||||||
|
t,
|
||||||
|
err == nil,
|
||||||
|
fmt.tprint("Variable blocksize file created with flake revision 264 Failed with error:", err),
|
||||||
|
)
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
variable_blocksize_file_created_with_flake_revision_264_modified_to_create_smaller_blocks :: proc(t: ^testing.T) {
|
variable_blocksize_file_created_with_flake_revision_264_modified_to_create_smaller_blocks :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/25 - variable blocksize file created with flake revision 264, modified to create smaller blocks.flac")
|
data, err := flac.load_from_file(
|
||||||
|
"flac-test-files/subset/25 - variable blocksize file created with flake revision 264, modified to create smaller blocks.flac",
|
||||||
|
)
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("Variable blocksize file created with flake revision 264 modified to create smaller blocks Failed with error:", err))
|
testing.expect(
|
||||||
|
t,
|
||||||
|
err == nil,
|
||||||
|
fmt.tprint(
|
||||||
|
"Variable blocksize file created with flake revision 264 modified to create smaller blocks Failed with error:",
|
||||||
|
err,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
variable_blocksize_file_created_with_CUETools_Flake_2_1_6 :: proc(t: ^testing.T) {
|
variable_blocksize_file_created_with_CUETools_Flake_2_1_6 :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/26 - variable blocksize file created with CUETools.Flake 2.1.6.flac")
|
data, err := flac.load_from_file(
|
||||||
|
"flac-test-files/subset/26 - variable blocksize file created with CUETools.Flake 2.1.6.flac",
|
||||||
|
)
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("Variable blocksize file created with CUETools.Flake 2.1.6 Failed with error:", err))
|
testing.expect(
|
||||||
|
t,
|
||||||
|
err == nil,
|
||||||
|
fmt.tprint("Variable blocksize file created with CUETools.Flake 2.1.6 Failed with error:", err),
|
||||||
|
)
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
old_format_variable_blocksize_file_created_with_Flake_0_11 :: proc(t: ^testing.T) {
|
old_format_variable_blocksize_file_created_with_Flake_0_11 :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/27 - old format variable blocksize file created with Flake 0.11.flac")
|
data, err := flac.load_from_file(
|
||||||
|
"flac-test-files/subset/27 - old format variable blocksize file created with Flake 0.11.flac",
|
||||||
|
)
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("Old format variable blocksize file created with Flake 0.11 Failed with error:", err))
|
testing.expect(
|
||||||
|
t,
|
||||||
|
err == nil,
|
||||||
|
fmt.tprint("Old format variable blocksize file created with Flake 0.11 Failed with error:", err),
|
||||||
|
)
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
high_resolution_audio_default_settings :: proc(t: ^testing.T) {
|
high_resolution_audio_default_settings :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/28 - high resolution audio, default settings.flac")
|
data, err := flac.load_from_file("flac-test-files/subset/28 - high resolution audio, default settings.flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("High resolution audio, default settings Failed with error:", err))
|
testing.expect(t, err == nil, fmt.tprint("High resolution audio, default settings Failed with error:", err))
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
high_resolution_audio_blocksize_16384 :: proc(t: ^testing.T) {
|
high_resolution_audio_blocksize_16384 :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/29 - high resolution audio, blocksize 16384.flac")
|
data, err := flac.load_from_file("flac-test-files/subset/29 - high resolution audio, blocksize 16384.flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("High resolution audio, blocksize 16384 Failed with error:", err))
|
testing.expect(t, err == nil, fmt.tprint("High resolution audio, blocksize 16384 Failed with error:", err))
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
high_resolution_audio_blocksize_13456 :: proc(t: ^testing.T) {
|
high_resolution_audio_blocksize_13456 :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/30 - high resolution audio, blocksize 13456.flac")
|
data, err := flac.load_from_file("flac-test-files/subset/30 - high resolution audio, blocksize 13456.flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("High resolution audio, blocksize 13456 Failed with error:", err))
|
testing.expect(t, err == nil, fmt.tprint("High resolution audio, blocksize 13456 Failed with error:", err))
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
high_resolution_audio_using_only_32nd_order_predictors :: proc(t: ^testing.T) {
|
high_resolution_audio_using_only_32nd_order_predictors :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/31 - high resolution audio, using only 32nd order predictors.flac")
|
data, err := flac.load_from_file(
|
||||||
|
"flac-test-files/subset/31 - high resolution audio, using only 32nd order predictors.flac",
|
||||||
|
)
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("High resolution audio, using only 32nd order predictors Failed with error:", err))
|
testing.expect(
|
||||||
|
t,
|
||||||
|
err == nil,
|
||||||
|
fmt.tprint("High resolution audio, using only 32nd order predictors Failed with error:", err),
|
||||||
|
)
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
high_resolution_audio_partition_order_8_containing_escaped_partitions :: proc(t: ^testing.T) {
|
high_resolution_audio_partition_order_8_containing_escaped_partitions :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/32 - high resolution audio, partition order 8 containing escaped partitions.flac")
|
data, err := flac.load_from_file(
|
||||||
|
"flac-test-files/subset/32 - high resolution audio, partition order 8 containing escaped partitions.flac",
|
||||||
|
)
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("High resolution audio, partition order 8 containing escaped partitions Failed with error:", err))
|
testing.expect(
|
||||||
|
t,
|
||||||
|
err == nil,
|
||||||
|
fmt.tprint("High resolution audio, partition order 8 containing escaped partitions Failed with error:", err),
|
||||||
|
)
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
samplerate_192kHz :: proc(t: ^testing.T) {
|
samplerate_192kHz :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/33 - samplerate 192kHz.flac")
|
data, err := flac.load_from_file("flac-test-files/subset/33 - samplerate 192kHz.flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("Samplerate 192kHz Failed with error:", err))
|
testing.expect(t, err == nil, fmt.tprint("Samplerate 192kHz Failed with error:", err))
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
samplerate_192kHz_using_only_32nd_order_predictors :: proc(t: ^testing.T) {
|
samplerate_192kHz_using_only_32nd_order_predictors :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/34 - samplerate 192kHz, using only 32nd order predictors.flac")
|
data, err := flac.load_from_file("flac-test-files/subset/34 - samplerate 192kHz, using only 32nd order predictors.flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("Samplerate 192kHz, using only 32nd order predictors Failed with error:", err))
|
testing.expect(
|
||||||
|
t,
|
||||||
|
err == nil,
|
||||||
|
fmt.tprint("Samplerate 192kHz, using only 32nd order predictors Failed with error:", err),
|
||||||
|
)
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
samplerate_134560Hz :: proc(t: ^testing.T) {
|
samplerate_134560Hz :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/35 - samplerate 134560Hz.flac")
|
data, err := flac.load_from_file("flac-test-files/subset/35 - samplerate 134560Hz.flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("Samplerate 134560Hz Failed with error:", err))
|
testing.expect(t, err == nil, fmt.tprint("Samplerate 134560Hz Failed with error:", err))
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
samplerate_384kHz :: proc(t: ^testing.T) {
|
samplerate_384kHz :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/36 - samplerate 384kHz.flac")
|
data, err := flac.load_from_file("flac-test-files/subset/36 - samplerate 384kHz.flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("Samplerate 384kHz Failed with error:", err))
|
testing.expect(t, err == nil, fmt.tprint("Samplerate 384kHz Failed with error:", err))
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
_20_bit_per_sample :: proc(t: ^testing.T) {
|
_20_bit_per_sample :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/37 - 20 bit per sample.flac")
|
data, err := flac.load_from_file("flac-test-files/subset/37 - 20 bit per sample.flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("20 bit per sample Failed with error:", err))
|
testing.expect(t, err == nil, fmt.tprint("20 bit per sample Failed with error:", err))
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
_3_channels :: proc(t: ^testing.T) {
|
_3_channels :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/38 - 3 channels (3.0).flac")
|
data, err := flac.load_from_file("flac-test-files/subset/38 - 3 channels (3.0).flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("3 channels Failed with error:", err))
|
testing.expect(t, err == nil, fmt.tprint("3 channels Failed with error:", err))
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
_4_channels :: proc(t: ^testing.T) {
|
_4_channels :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/39 - 4 channels (4.0).flac")
|
data, err := flac.load_from_file("flac-test-files/subset/39 - 4 channels (4.0).flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("4 channels Failed with error:", err))
|
testing.expect(t, err == nil, fmt.tprint("4 channels Failed with error:", err))
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
_5_channels :: proc(t: ^testing.T) {
|
_5_channels :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/40 - 5 channels (5.0).flac")
|
data, err := flac.load_from_file("flac-test-files/subset/40 - 5 channels (5.0).flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("5 channels Failed with error:", err))
|
testing.expect(t, err == nil, fmt.tprint("5 channels Failed with error:", err))
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
_6_channels :: proc(t: ^testing.T) {
|
_6_channels :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/41 - 6 channels (5.1).flac")
|
data, err := flac.load_from_file("flac-test-files/subset/41 - 6 channels (5.1).flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("6 channels Failed with error:", err))
|
testing.expect(t, err == nil, fmt.tprint("6 channels Failed with error:", err))
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
_7_channels :: proc(t: ^testing.T) {
|
_7_channels :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/42 - 7 channels (6.1).flac")
|
data, err := flac.load_from_file("flac-test-files/subset/42 - 7 channels (6.1).flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("7 channels Failed with error:", err))
|
testing.expect(t, err == nil, fmt.tprint("7 channels Failed with error:", err))
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
_8_channels :: proc(t: ^testing.T) {
|
_8_channels :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/43 - 8 channels (7.1).flac")
|
data, err := flac.load_from_file("flac-test-files/subset/43 - 8 channels (7.1).flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("8 channels Failed with error:", err))
|
testing.expect(t, err == nil, fmt.tprint("8 channels Failed with error:", err))
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
_8_channel_surround_192kHz_24_bit_using_only_32nd_order_predictors :: proc(t: ^testing.T) {
|
_8_channel_surround_192kHz_24_bit_using_only_32nd_order_predictors :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/44 - 8-channel surround, 192kHz, 24 bit, using only 32nd order predictors.flac")
|
data, err := flac.load_from_file(
|
||||||
|
"flac-test-files/subset/44 - 8-channel surround, 192kHz, 24 bit, using only 32nd order predictors.flac",
|
||||||
|
)
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("8-channel surround 192kHz 24 bit using only 32nd order predictors Failed with error:", err))
|
testing.expect(
|
||||||
|
t,
|
||||||
|
err == nil,
|
||||||
|
fmt.tprint("8-channel surround 192kHz 24 bit using only 32nd order predictors Failed with error:", err),
|
||||||
|
)
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
no_total_number_of_samples :: proc(t: ^testing.T) {
|
no_total_number_of_samples :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/45 - no total number of samples set.flac")
|
data, err := flac.load_from_file("flac-test-files/subset/45 - no total number of samples set.flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("No total number of samples Failed with error:", err))
|
testing.expect(t, err == nil, fmt.tprint("No total number of samples Failed with error:", err))
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
no_min_max_framesize :: proc(t: ^testing.T) {
|
no_min_max_framesize :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/46 - no min-max framesize set.flac")
|
data, err := flac.load_from_file("flac-test-files/subset/46 - no min-max framesize set.flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("No min-max framesize Failed with error:", err))
|
testing.expect(t, err == nil, fmt.tprint("No min-max framesize Failed with error:", err))
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
only_streaminfo :: proc(t: ^testing.T) {
|
only_streaminfo :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/47 - only STREAMINFO.flac")
|
data, err := flac.load_from_file("flac-test-files/subset/47 - only STREAMINFO.flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("Only STREAMINFO Failed with error:", err))
|
testing.expect(t, err == nil, fmt.tprint("Only STREAMINFO Failed with error:", err))
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
extreme_large_seektable :: proc(t: ^testing.T) {
|
extreme_large_seektable :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/48 - Extremely large SEEKTABLE.flac")
|
data, err := flac.load_from_file("flac-test-files/subset/48 - Extremely large SEEKTABLE.flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("Extremely large SEEKTABLE Failed with error:", err))
|
testing.expect(t, err == nil, fmt.tprint("Extremely large SEEKTABLE Failed with error:", err))
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
extreme_large_padding :: proc(t: ^testing.T) {
|
extreme_large_padding :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/49 - Extremely large PADDING.flac")
|
data, err := flac.load_from_file("flac-test-files/subset/49 - Extremely large PADDING.flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("Extremely large PADDING Failed with error:", err))
|
testing.expect(t, err == nil, fmt.tprint("Extremely large PADDING Failed with error:", err))
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
extreme_large_picture :: proc(t: ^testing.T) {
|
extreme_large_picture :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/50 - Extremely large PICTURE.flac")
|
data, err := flac.load_from_file("flac-test-files/subset/50 - Extremely large PICTURE.flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("Extremely large PICTURE Failed with error:", err))
|
testing.expect(t, err == nil, fmt.tprint("Extremely large PICTURE Failed with error:", err))
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
extreme_large_vorbiscomment :: proc(t: ^testing.T) {
|
extreme_large_vorbiscomment :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/51 - Extremely large VORBISCOMMENT.flac")
|
data, err := flac.load_from_file("flac-test-files/subset/51 - Extremely large VORBISCOMMENT.flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("Extremely large VORBISCOMMENT Failed with error:", err))
|
testing.expect(t, err == nil, fmt.tprint("Extremely large VORBISCOMMENT Failed with error:", err))
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
extreme_large_application :: proc(t: ^testing.T) {
|
extreme_large_application :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/52 - Extremely large APPLICATION.flac")
|
data, err := flac.load_from_file("flac-test-files/subset/52 - Extremely large APPLICATION.flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("Extremely large APPLICATION Failed with error:", err))
|
testing.expect(t, err == nil, fmt.tprint("Extremely large APPLICATION Failed with error:", err))
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
cuesheet_with_very_many_indexes :: proc(t: ^testing.T) {
|
cuesheet_with_very_many_indexes :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/53 - CUESHEET with very many indexes.flac")
|
data, err := flac.load_from_file("flac-test-files/subset/53 - CUESHEET with very many indexes.flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("CUESHEET with very many indexes Failed with error:", err))
|
testing.expect(t, err == nil, fmt.tprint("CUESHEET with very many indexes Failed with error:", err))
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
_1000x_repeating_vorbiscomment :: proc(t: ^testing.T) {
|
_1000x_repeating_vorbiscomment :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/54 - 1000x repeating VORBISCOMMENT.flac")
|
data, err := flac.load_from_file("flac-test-files/subset/54 - 1000x repeating VORBISCOMMENT.flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("1000x repeating VORBSICOMMENT Failed with error:", err))
|
testing.expect(t, err == nil, fmt.tprint("1000x repeating VORBSICOMMENT Failed with error:", err))
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
file_48_53_combined :: proc(t: ^testing.T) {
|
file_48_53_combined :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/55 - file 48-53 combined.flac")
|
data, err := flac.load_from_file("flac-test-files/subset/55 - file 48-53 combined.flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("File 48-53 combined Failed with error:", err))
|
testing.expect(t, err == nil, fmt.tprint("File 48-53 combined Failed with error:", err))
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
jpg_picture :: proc(t: ^testing.T) {
|
jpg_picture :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/56 - JPG PICTURE.flac")
|
data, err := flac.load_from_file("flac-test-files/subset/56 - JPG PICTURE.flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("JPG PICTURE Failed with error:", err))
|
testing.expect(t, err == nil, fmt.tprint("JPG PICTURE Failed with error:", err))
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
png_picture :: proc(t: ^testing.T) {
|
png_picture :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/57 - PNG PICTURE.flac")
|
data, err := flac.load_from_file("flac-test-files/subset/57 - PNG PICTURE.flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("PNG PICTURE Failed with error:", err))
|
testing.expect(t, err == nil, fmt.tprint("PNG PICTURE Failed with error:", err))
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
gif_picture :: proc(t: ^testing.T) {
|
gif_picture :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/58 - GIF PICTURE.flac")
|
data, err := flac.load_from_file("flac-test-files/subset/58 - GIF PICTURE.flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("GIF PICTURE Failed with error:", err))
|
testing.expect(t, err == nil, fmt.tprint("GIF PICTURE Failed with error:", err))
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
avif_picture :: proc(t: ^testing.T) {
|
avif_picture :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/59 - AVIF PICTURE.flac")
|
data, err := flac.load_from_file("flac-test-files/subset/59 - AVIF PICTURE.flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("AVIF PICTURE Failed with error:", err))
|
testing.expect(t, err == nil, fmt.tprint("AVIF PICTURE Failed with error:", err))
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
mono_audio :: proc(t: ^testing.T) {
|
mono_audio :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/60 - mono audio.flac")
|
data, err := flac.load_from_file("flac-test-files/subset/60 - mono audio.flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("Mono audio Failed with error:", err))
|
testing.expect(t, err == nil, fmt.tprint("Mono audio Failed with error:", err))
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
predictor_overflow_check_16_bit :: proc(t: ^testing.T) {
|
predictor_overflow_check_16_bit :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/61 - predictor overflow check, 16-bit.flac")
|
data, err := flac.load_from_file("flac-test-files/subset/61 - predictor overflow check, 16-bit.flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("Predictor overflow check, 16-bit Failed with error:", err))
|
testing.expect(t, err == nil, fmt.tprint("Predictor overflow check, 16-bit Failed with error:", err))
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
predictor_overflow_check_20_bit :: proc(t: ^testing.T) {
|
predictor_overflow_check_20_bit :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/62 - predictor overflow check, 20-bit.flac")
|
data, err := flac.load_from_file("flac-test-files/subset/62 - predictor overflow check, 20-bit.flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("Predictor overflow check, 20-bit Failed with error:", err))
|
testing.expect(t, err == nil, fmt.tprint("Predictor overflow check, 20-bit Failed with error:", err))
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
predictor_overflow_check_24_bit :: proc(t: ^testing.T) {
|
predictor_overflow_check_24_bit :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/63 - predictor overflow check, 24-bit.flac")
|
data, err := flac.load_from_file("flac-test-files/subset/63 - predictor overflow check, 24-bit.flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("Predictor overflow check, 24-bit Failed with error:", err))
|
testing.expect(t, err == nil, fmt.tprint("Predictor overflow check, 24-bit Failed with error:", err))
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
rice_partitions_with_escape_code_zero :: proc(t: ^testing.T) {
|
rice_partitions_with_escape_code_zero :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/subset/64 - rice partitions with escape code zero.flac")
|
data, err := flac.load_from_file("flac-test-files/subset/64 - rice partitions with escape code zero.flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("Rice partitions with escape code zero Failed with error:", err))
|
testing.expect(t, err == nil, fmt.tprint("Rice partitions with escape code zero Failed with error:", err))
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
uncommon_32_bit_per_sample :: proc(t: ^testing.T) {
|
uncommon_32_bit_per_sample :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/uncommon/05 - 32bps audio.flac")
|
data, err := flac.load_from_file("flac-test-files/uncommon/05 - 32bps audio.flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("Uncommon 32bps audio Failed with error:", err))
|
testing.expect(t, err == nil, fmt.tprint("Uncommon 32bps audio Failed with error:", err))
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
@(test)
|
@(test)
|
||||||
uncommon_samplerate_768kHz :: proc(t: ^testing.T) {
|
uncommon_samplerate_768kHz :: proc(t: ^testing.T) {
|
||||||
os.stdout = -1
|
os.stdout = -1
|
||||||
err := flac.load_from_file("flac-test-files/uncommon/06 - samplerate 768kHz.flac")
|
data, err := flac.load_from_file("flac-test-files/uncommon/06 - samplerate 768kHz.flac")
|
||||||
|
|
||||||
testing.expect(t, err == nil, fmt.tprint("Uncommon samplerate 768kHz Failed with error:", err))
|
testing.expect(t, err == nil, fmt.tprint("Uncommon samplerate 768kHz Failed with error:", err))
|
||||||
|
flac.destroy(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO:
|
// TODO:
|
||||||
|
|||||||
Reference in New Issue
Block a user