aboutsummaryrefslogtreecommitdiff
path: root/track/codec_test.go
diff options
context:
space:
mode:
authorOnur Gündüz <ogunduz@gmail.com>2026-06-30 15:35:01 +0200
committerOnur Gündüz <ogunduz@gmail.com>2026-06-30 15:35:01 +0200
commit0f5c3761970cdf122da63a2454dfcce545ab357c (patch)
tree3f050071c6b41c900dfba3e346c8216fc1b14593 /track/codec_test.go
parent3535c58b2104bc9efe377aadadf6ee8577137c0b (diff)
downloadmp4-0f5c3761970cdf122da63a2454dfcce545ab357c.tar.gz
mp4-0f5c3761970cdf122da63a2454dfcce545ab357c.zip
track: add AV1 support, edit list parsing, and sync flag packing
Diffstat (limited to 'track/codec_test.go')
-rw-r--r--track/codec_test.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/track/codec_test.go b/track/codec_test.go
new file mode 100644
index 0000000..182c445
--- /dev/null
+++ b/track/codec_test.go
@@ -0,0 +1,27 @@
+package track
+
+import "testing"
+
+func TestAppendAv1CProfile(t *testing.T) {
+ tests := []struct {
+ name string
+ rec []byte
+ want string
+ }{
+ // rec[1] = seq_profile<<5 | seq_level_idx
+ // rec[2] = seq_tier<<7 | high_bitdepth<<6 | twelve_bit<<5
+ {"main 8-bit level 8", []byte{0x81, 0x08, 0x00, 0x00}, "av01.0.08M.08"},
+ {"main 8-bit level 12", []byte{0x81, 0x0c, 0x00, 0x00}, "av01.0.12M.08"},
+ {"high tier 10-bit", []byte{0x81, 0x0c, 0xc0, 0x00}, "av01.0.12H.10"},
+ {"profile 2 12-bit", []byte{0x81, 0x48, 0x60, 0x00}, "av01.2.08M.12"},
+ }
+ for _, tt := range tests {
+ tr := &Track{}
+ tr.setCodec("av01")
+ tr.appendAv1CProfile(tt.rec)
+ got := string(tr.raw.codecBuf[:tr.raw.codecLen])
+ if got != tt.want {
+ t.Errorf("%s: got %q, want %q", tt.name, got, tt.want)
+ }
+ }
+}