]> Sergey Matveev's repositories - go-opus.git/blob - opus.go
Build libopus statically
[go-opus.git] / opus.go
1 // Copyright © Go Opus Authors (see AUTHORS file)
2 //
3 // License for use of this code is detailed in the LICENSE file
4
5 package opus
6
7 /*
8 // Link opus using pkg-config.
9 #cgo pkg-config: --static opus
10 #cgo LDFLAGS: -static
11 #include <opus.h>
12 */
13 import "C"
14
15 type Application int
16
17 const (
18         // Optimize encoding for VoIP
19         AppVoIP = Application(C.OPUS_APPLICATION_VOIP)
20         // Optimize encoding for non-voice signals like music
21         AppAudio = Application(C.OPUS_APPLICATION_AUDIO)
22         // Optimize encoding for low latency applications
23         AppRestrictedLowdelay = Application(C.OPUS_APPLICATION_RESTRICTED_LOWDELAY)
24 )
25
26 const (
27         xMAX_BITRATE       = 48000
28         xMAX_FRAME_SIZE_MS = 60
29         xMAX_FRAME_SIZE    = xMAX_BITRATE * xMAX_FRAME_SIZE_MS / 1000
30         // Maximum size of an encoded frame. I actually have no idea, but this
31         // looks like it's big enough.
32         maxEncodedFrameSize = 10000
33 )
34
35 func Version() string {
36         return C.GoString(C.opus_get_version_string())
37 }