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.
|
2016-11-02 16:06:30 +00:00
|
|
|
#cgo pkg-config: opus
|
2017-02-28 00:56:11 +00:00
|
|
|
#include <opus.h>
|
2015-02-18 23:50:17 +00:00
|
|
|
*/
|
|
|
|
import "C"
|
|
|
|
|
|
|
|
type Application int
|
|
|
|
|
2018-03-11 18:37:16 +00:00
|
|
|
const (
|
2016-12-29 12:05:22 +00:00
|
|
|
// Optimize encoding for VoIP
|
2018-03-11 18:37:16 +00:00
|
|
|
AppVoIP = Application(C.OPUS_APPLICATION_VOIP)
|
2016-12-29 12:05:22 +00:00
|
|
|
// Optimize encoding for non-voice signals like music
|
2018-03-11 18:37:16 +00:00
|
|
|
AppAudio = Application(C.OPUS_APPLICATION_AUDIO)
|
2016-12-29 12:05:22 +00:00
|
|
|
// Optimize encoding for low latency applications
|
2018-03-11 18:37:16 +00:00
|
|
|
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
|
2015-07-05 19:28:08 +00:00
|
|
|
// 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
|
|
|
)
|
2015-02-19 00:51:09 +00:00
|
|
|
|
|
|
|
func Version() string {
|
|
|
|
return C.GoString(C.opus_get_version_string())
|
|
|
|
}
|