-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmultistream_decoder_controls.go
More file actions
55 lines (47 loc) · 1.52 KB
/
multistream_decoder_controls.go
File metadata and controls
55 lines (47 loc) · 1.52 KB
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
55
package gopus
// Reset clears the decoder state for a new stream.
// Call this when starting to decode a new audio stream.
func (d *MultistreamDecoder) Reset() {
d.dec.Reset()
d.lastFrameSize = 960
}
// Channels returns the number of audio channels.
func (d *MultistreamDecoder) Channels() int {
return d.channels
}
// SampleRate returns the sample rate in Hz.
func (d *MultistreamDecoder) SampleRate() int {
return d.sampleRate
}
// Streams returns the total number of elementary streams.
func (d *MultistreamDecoder) Streams() int {
return d.dec.Streams()
}
// CoupledStreams returns the number of coupled (stereo) streams.
func (d *MultistreamDecoder) CoupledStreams() int {
return d.dec.CoupledStreams()
}
// SetIgnoreExtensions toggles whether unknown packet extensions should be ignored.
func (d *MultistreamDecoder) SetIgnoreExtensions(ignore bool) {
d.ignoreExtensions = ignore
if d.dec != nil {
d.dec.SetIgnoreExtensions(ignore)
}
}
// IgnoreExtensions reports whether unknown packet extensions are ignored.
func (d *MultistreamDecoder) IgnoreExtensions() bool {
return d.ignoreExtensions
}
// SetDNNBlob loads the optional libopus USE_WEIGHTS_FILE decoder model blob.
//
// The loaded blob is validated using libopus-style weights-record framing and
// retained across Reset(), matching libopus USE_WEIGHTS_FILE control lifetime.
func (d *MultistreamDecoder) SetDNNBlob(data []byte) error {
blob, err := cloneDecoderDNNBlobForControl(data)
if err != nil {
return err
}
d.dnnBlob = blob
d.dec.SetDNNBlob(blob)
return nil
}