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

@@ -53,11 +53,12 @@ func (cc *CodecContext) SetChannels(channels int) {
cc.c.channels = C.int(channels)
}
func (cc *CodecContext) ChannelLayout() *ChannelLayout {
return newChannelLayoutFromC(&cc.c.ch_layout)
func (cc *CodecContext) ChannelLayout() ChannelLayout {
l, _ := newChannelLayoutFromC(&cc.c.ch_layout).clone()
return l
}
func (cc *CodecContext) SetChannelLayout(l *ChannelLayout) {
func (cc *CodecContext) SetChannelLayout(l ChannelLayout) {
l.copy(&cc.c.ch_layout) //nolint: errcheck
}