Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit e9a7fbe
Showing
3 changed files
with
88 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
all: | ||
cgogen opus.yml | ||
|
||
clean: | ||
rm -f opus/cgo_helpers.go opus/cgo_helpers.h opus/cgo_helpers.c | ||
rm -f opus/doc.go opus/types.go opus/const.go | ||
rm -f opus/opus.go | ||
|
||
test: | ||
cd opus && go build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
opus-go ![opus](https://xiph.org/images/logos/fish_xiph_org.png) | ||
======= | ||
|
||
Package opus provides Go bindings for Opus encoder/decoder reference implementation from [Xiph.org](https://www.xiph.org).<br /> | ||
All the binding code has automatically been generated with rules defined in [opus.yml](/opus.yml). | ||
|
||
### Usage | ||
|
||
``` | ||
$ brew install opus | ||
$ go get github.com/xlab/opus-go/opus | ||
$ go get github.com/xlab/opus-go/decoder | ||
(optionally if you need a quickstart in decoding) | ||
``` | ||
|
||
Examples of usage: an implemented [Opus decoder](/decoder) for Go programming language. | ||
|
||
### Demo | ||
|
||
``` | ||
// webm | ||
``` | ||
|
||
### Rebuilding the package | ||
|
||
You will need to get the [cgogen](https://git.io/cgogen) tool installed first. | ||
|
||
``` | ||
$ git clone https://github.com/xlab/opus-go && cd opus-go | ||
$ make clean | ||
$ make | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--- | ||
GENERATOR: | ||
PackageName: opus | ||
PackageDescription: "Package opus provides Go bindings for Opus implementation by the Xiph.Org Foundation" | ||
PackageLicense: "THE AUTOGENERATED LICENSE. ALL THE RIGHTS ARE RESERVED BY ROBOTS." | ||
PkgConfigOpts: [opus] | ||
Includes: ["opus/opus.h"] | ||
|
||
PARSER: | ||
IncludePaths: ["/usr/include"] | ||
SourcesPaths: ["opus/opus.h"] | ||
|
||
TRANSLATOR: | ||
ConstRules: | ||
defines: expand | ||
TypeTips: | ||
function: | ||
- {target: "^opus_", self: plain, tips: [plain,plain,plain,plain,plain]} | ||
PtrTips: | ||
function: | ||
- {target: "_encoder_create$", tips: [0,0,0,ref]} | ||
- {target: "_decoder_create$", tips: [0,0,ref]} | ||
- {target: "_multistream_packet_unpad$", tips: [0,size,0]} | ||
- {target: "_multistream_packet_pad$", tips: [0,size,size,0]} | ||
- {target: "_packet_unpad$", tips: [0,size]} | ||
- {target: "_packet_pad$", tips: [0,size,size]} | ||
- {target: "_pcm_soft_clip$", tips: [arr,0,0,arr]} | ||
- {target: ^opus_, tips: [ref]} | ||
Rules: | ||
global: | ||
- {transform: lower} | ||
- {action: accept, from: "(?i)^opus"} | ||
- {action: replace, from: "(?i)^opus"} | ||
- {transform: export} | ||
function: | ||
- {action: ignore, from: "_encoder_ctl"} # variadic | ||
- {action: ignore, from: "_decoder_ctl"} # variadic | ||
- {action: ignore, from: "_packet_parse"} # internal | ||
type: | ||
- {action: replace, from: "_t$"} | ||
private: | ||
- {transform: unexport} | ||
post-global: | ||
- {action: replace, from: _$} | ||
- {load: snakecase} |