return opus_encoder_ctl(st, OPUS_GET_MAX_BANDWIDTH(max_bw));
}
-// Access the preprocessor from CGO
-const int CONST_BANDWIDTH_NARROWBAND = OPUS_BANDWIDTH_NARROWBAND;
-const int CONST_BANDWIDTH_MEDIUMBAND = OPUS_BANDWIDTH_MEDIUMBAND;
-const int CONST_BANDWIDTH_WIDEBAND = OPUS_BANDWIDTH_WIDEBAND;
-const int CONST_BANDWIDTH_SUPERWIDEBAND = OPUS_BANDWIDTH_SUPERWIDEBAND;
-const int CONST_BANDWIDTH_FULLBAND = OPUS_BANDWIDTH_FULLBAND;
-
-const int CONST_BITRATE_AUTO = OPUS_AUTO;
-const int CONST_BITRATE_MAX = OPUS_BITRATE_MAX;
-
*/
import "C"
type Bandwidth int
-var (
+const (
// 4 kHz passband
Narrowband = Bandwidth(C.OPUS_BANDWIDTH_NARROWBAND)
// 6 kHz passband
// SetBitrateToAuto will allow the encoder to automatically set the bitrate
func (enc *Encoder) SetBitrateToAuto() error {
- res := C.bridge_encoder_set_bitrate(enc.p, C.opus_int32(C.CONST_BITRATE_AUTO))
+ res := C.bridge_encoder_set_bitrate(enc.p, C.opus_int32(C.OPUS_AUTO))
if res != C.OPUS_OK {
return Error(res)
}
// SetBitrateToMax causes the encoder to use as much rate as it can. This can be
// useful for controlling the rate by adjusting the output buffer size.
func (enc *Encoder) SetBitrateToMax() error {
- res := C.bridge_encoder_set_bitrate(enc.p, C.opus_int32(C.CONST_BITRATE_MAX))
+ res := C.bridge_encoder_set_bitrate(enc.p, C.opus_int32(C.OPUS_BITRATE_MAX))
if res != C.OPUS_OK {
return Error(res)
}
// Link opus using pkg-config.
#cgo pkg-config: opus
#include <opus.h>
-
-// Access the preprocessor from CGO
-const int CONST_APPLICATION_VOIP = OPUS_APPLICATION_VOIP;
-const int CONST_APPLICATION_AUDIO = OPUS_APPLICATION_AUDIO;
-const int CONST_APPLICATION_RESTRICTED_LOWDELAY = OPUS_APPLICATION_RESTRICTED_LOWDELAY;
*/
import "C"
type Application int
-// These variables should be constants, but for interoperability with CGO
-// they're var. Don't change them, though!
-var (
+const (
// Optimize encoding for VoIP
- AppVoIP = Application(C.CONST_APPLICATION_VOIP)
+ AppVoIP = Application(C.OPUS_APPLICATION_VOIP)
// Optimize encoding for non-voice signals like music
- AppAudio = Application(C.CONST_APPLICATION_AUDIO)
+ AppAudio = Application(C.OPUS_APPLICATION_AUDIO)
// Optimize encoding for low latency applications
- AppRestrictedLowdelay = Application(C.CONST_APPLICATION_RESTRICTED_LOWDELAY)
+ AppRestrictedLowdelay = Application(C.OPUS_APPLICATION_RESTRICTED_LOWDELAY)
)
const (