go-pus/opus.go

37 lines
901 B
Go
Raw Permalink Normal View History

2020-07-09 16:22:12 +00:00
// Copyright © Go Opus Authors (see AUTHORS file)
2015-03-09 12:31:24 +00:00
//
// License for use of this code is detailed in the LICENSE file
2015-02-19 12:38:49 +00:00
2015-02-18 23:50:17 +00:00
package opus
/*
2016-08-22 14:34:16 +00:00
// Link opus using pkg-config.
#cgo pkg-config: opus
#include <opus.h>
2015-02-18 23:50:17 +00:00
*/
import "C"
type Application int
const (
2016-12-29 12:05:22 +00:00
// Optimize encoding for VoIP
AppVoIP = Application(C.OPUS_APPLICATION_VOIP)
2016-12-29 12:05:22 +00:00
// Optimize encoding for non-voice signals like music
AppAudio = Application(C.OPUS_APPLICATION_AUDIO)
2016-12-29 12:05:22 +00:00
// Optimize encoding for low latency applications
AppRestrictedLowdelay = Application(C.OPUS_APPLICATION_RESTRICTED_LOWDELAY)
2016-12-29 12:05:22 +00:00
)
2015-06-13 15:01:45 +00:00
const (
xMAX_BITRATE = 48000
xMAX_FRAME_SIZE_MS = 60
xMAX_FRAME_SIZE = xMAX_BITRATE * xMAX_FRAME_SIZE_MS / 1000
// Maximum size of an encoded frame. I actually have no idea, but this
// looks like it's big enough.
maxEncodedFrameSize = 10000
2015-06-13 15:01:45 +00:00
)
func Version() string {
return C.GoString(C.opus_get_version_string())
}