-
Notifications
You must be signed in to change notification settings - Fork 31
/
box_types_opus.go
54 lines (42 loc) · 1.36 KB
/
box_types_opus.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package mp4
/*************************** Opus ****************************/
// https://opus-codec.org/docs/opus_in_isobmff.html
func BoxTypeOpus() BoxType { return StrToBoxType("Opus") }
func init() {
AddAnyTypeBoxDef(&AudioSampleEntry{}, BoxTypeOpus())
}
/*************************** dOps ****************************/
// https://opus-codec.org/docs/opus_in_isobmff.html
func BoxTypeDOps() BoxType { return StrToBoxType("dOps") }
func init() {
AddBoxDef(&DOps{})
}
type DOps struct {
Box
Version uint8 `mp4:"0,size=8"`
OutputChannelCount uint8 `mp4:"1,size=8"`
PreSkip uint16 `mp4:"2,size=16"`
InputSampleRate uint32 `mp4:"3,size=32"`
OutputGain int16 `mp4:"4,size=16"`
ChannelMappingFamily uint8 `mp4:"5,size=8"`
StreamCount uint8 `mp4:"6,opt=dynamic,size=8"`
CoupledCount uint8 `mp4:"7,opt=dynamic,size=8"`
ChannelMapping []uint8 `mp4:"8,opt=dynamic,size=8,len=dynamic"`
}
func (DOps) GetType() BoxType {
return BoxTypeDOps()
}
func (dops DOps) IsOptFieldEnabled(name string, ctx Context) bool {
switch name {
case "StreamCount", "CoupledCount", "ChannelMapping":
return dops.ChannelMappingFamily != 0
}
return false
}
func (ops DOps) GetFieldLength(name string, ctx Context) uint {
switch name {
case "ChannelMapping":
return uint(ops.OutputChannelCount)
}
return 0
}