Removed pointer on ChannelLayout + now cloning channel layouts in getters

This commit is contained in:
Quentin Renard
2023-09-28 15:21:32 +02:00
parent 63a083bcad
commit 7048b09f25
6 changed files with 32 additions and 21 deletions

View File

@@ -28,11 +28,12 @@ func (cp *CodecParameters) BitRate() int64 {
return int64(cp.c.bit_rate)
}
func (cp *CodecParameters) ChannelLayout() *ChannelLayout {
return newChannelLayoutFromC(&cp.c.ch_layout)
func (cp *CodecParameters) ChannelLayout() ChannelLayout {
l, _ := newChannelLayoutFromC(&cp.c.ch_layout).clone()
return l
}
func (cp *CodecParameters) SetChannelLayout(l *ChannelLayout) {
func (cp *CodecParameters) SetChannelLayout(l ChannelLayout) {
l.copy(&cp.c.ch_layout) //nolint: errcheck
}