Commit graph

29 commits

Author SHA1 Message Date
DataHoarder d0c3e3e655
Add Channels and Info methods on decoder 2022-07-21 15:06:17 +02:00
DataHoarder c9b07c6bec Added +build comment
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-30 01:33:20 +01:00
DataHoarder dcd55d6b5c Added Decoder.ReadStereo() / Decoder.ReadStereoFloat32() using stereo decoding API
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-27 17:26:36 +01:00
DataHoarder 88633d8444 Updated go build options on files
All checks were successful
continuous-integration/drone/push Build is passing
2022-01-27 17:21:09 +01:00
Randy Reddig 25a249fbd5 feat: build without libopusfile using go build tag
This patch introduces a new build tag `nolibopusfile` that conditionally
compiles out the code that imports `libopusfile`. This enables a static
binary build on Alpine Linux, which doesn’t have a static `libopusfile`.

Tests still work:

```sh
go test -tags nolibopusfile ./...
go test ./...
```

We could also have moved all libopusfile related code (i.e. Stream) into
a separate sub-package, but that would break backwards compatibility.
This feature is too unpopular to justify introducing a new major
version.

See also: https://github.com/hraban/opus/pull/24
2020-07-10 13:54:23 +01:00
Hraban Luyat f10c96b8f4 refactor: remove unnecessary callback passing
Since we now have a full function wrapper for libopusfile init anyway we
can directly pass the callback struct pointer from there, instead of
making it go through Go first.
2020-07-10 09:44:22 +01:00
Hraban Luyat 2a2b57e79d fix: wrap libopusfile init call for go test -race
Since go 1.14 the race checker includes an overzealous pointer checker.
It marks all conversions from uintptr to unsafe.Pointer as an error, but
in reality that's allowed as long as you never dereference the pointer
or do any arithmetic on it. The C compiler doesn't complain about this,
so we pass the uintptr value to C and convert it there, in a small
wrapper function.

See https://groups.google.com/g/golang-nuts/c/995uZyRPKlU for more
details.

Fixes hraban/opus#28
2020-07-10 09:40:35 +01:00
Hraban Luyat f08db0e111 docs: Update copyright notice 2020-07-09 17:23:21 +01:00
Hraban Luyat d19039546f Update copyright year to 2015-2017. 🎆 2017-01-01 23:36:24 +00:00
Hraban Luyat d941087903 Export error type, CamelCase error names 2016-12-29 11:58:57 +00:00
Hraban Luyat 0e63cf1b6c Change copyright headers to refer to AUTHORS file 2016-10-10 15:24:24 +01:00
Hraban Luyat 772ca78d5d Fix pkg-config name for opusfile related source
Stream.go is the wrapper around libopusfile, not libopus.
2016-10-10 15:16:49 +01:00
Hraban Luyat 27d2e7c395 Elaborate on stream comment 2016-09-02 11:38:03 +01:00
Hraban Luyat d831d898cb Godoc for stream functions 2016-09-02 11:32:35 +01:00
Hraban Luyat 223a3b298c Move callbacks struct to C allocator, to be safe
I'm not sure if the Go pointer proposal has already been implemented,
but under the proposed restrictions allocating the callback struct in Go
and passing that pointer to a C function which keeps it after returning
is not allowed.

This patch allocates the struct in C and passes the pointer from Go to
C, which is fine.
2016-08-22 15:11:13 +01:00
Hraban Luyat 3bccc0a781 Copyright notice in all files 2016-08-14 23:33:23 +01:00
Hraban Luyat 3ae552961f Use pkg-config to link opus 2016-08-14 14:44:41 +01:00
Hraban Luyat 4b96e6fc50 Fix go pointers to CGo (go 1.6) 2016-08-14 14:43:45 +01:00
Hraban Luyat ea0b415d37 Simplify CGO callback chain 2015-07-13 22:56:08 +01:00
Hraban Luyat d7e886a76b Refactoring the tests, wip (but passing) 2015-07-12 10:22:25 +00:00
Hraban Luyat 22ae9de258 Flush last good bytes before returning EOF 2015-07-11 05:59:28 +00:00
Hraban Luyat 4b7e292ab1 Elaborate docs for Read functions 2015-07-09 13:34:52 +00:00
Hraban Luyat b5907a342c Merge remote-tracking branch 'origin/master' 2015-07-09 12:29:03 +00:00
Hraban Luyat 28902b9d11 Close readers if they implement io.Closer 2015-07-09 12:28:38 +00:00
Hraban Luyat c9ae20a887 Set the callback buffer before it is invoked 2015-07-09 13:27:32 +01:00
Hraban Luyat 6b3d9bb2da float routines for stream reader 2015-07-05 21:07:29 +01:00
Hraban Luyat c5395ca98a Change stream reader API to look like io.Reader 2015-07-05 21:03:21 +01:00
Hraban Luyat 673f160c38 Close routine for opus stream 2015-07-05 20:33:27 +01:00
Hraban Luyat b568024252 (untested) libopusfile simple decoder API 2015-07-05 20:28:08 +01:00