]> Sergey Matveev's repositories - go-opus.git/commitdiff
Decoder.SetComplexity v2.0.0
authorSergey Matveev <stargrave@stargrave.org>
Thu, 11 Apr 2024 17:23:26 +0000 (20:23 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Mon, 15 Apr 2024 07:14:58 +0000 (10:14 +0300)
decoder.go

index da6ac81e05cf4b23c87cbef775f95bec8a74a8ef..176d5be80eee71fa2b28b6923e9e18ff0dba1968 100644 (file)
@@ -18,6 +18,12 @@ bridge_decoder_get_last_packet_duration(OpusDecoder *st, opus_int32 *samples)
 {
        return opus_decoder_ctl(st, OPUS_GET_LAST_PACKET_DURATION(samples));
 }
+
+int
+bridge_decoder_set_complexity(OpusDecoder *st, opus_int32 complexity)
+{
+       return opus_decoder_ctl(st, OPUS_SET_COMPLEXITY(complexity));
+}
 */
 import "C"
 
@@ -260,3 +266,12 @@ func (dec *Decoder) LastPacketDuration() (int, error) {
        }
        return int(samples), nil
 }
+
+// SetComplexity sets the decoder's computational complexity
+func (dec *Decoder) SetComplexity(complexity int) error {
+       res := C.bridge_decoder_set_complexity(dec.p, C.opus_int32(complexity))
+       if res != C.OPUS_OK {
+               return Error(res)
+       }
+       return nil
+}