Skip to content

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
xlab committed Sep 26, 2016
0 parents commit e9a7fbe
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Makefile
@@ -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
33 changes: 33 additions & 0 deletions README.md
@@ -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
```
45 changes: 45 additions & 0 deletions opus.yml
@@ -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}

0 comments on commit e9a7fbe

Please sign in to comment.