-
Notifications
You must be signed in to change notification settings - Fork 0
/
encoder.go
29 lines (23 loc) · 867 Bytes
/
encoder.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package ogg
import (
"unsafe"
"github.com/pteich/gobass"
"github.com/pteich/gobass/enc"
)
/*
#include "bassenc_ogg.h"
#include "stdlib.h"
*/
import "C"
func NewEncoder(channel bass.Channel, options string, flags enc.EncodeStartFlags, callback *C.ENCODEPROC, userdata unsafe.Pointer) (enc.Encoder, error) {
coptions := C.CString(options)
defer C.free(unsafe.Pointer(coptions))
return enc.Encoder(C.BASS_Encode_OGG_Start(C.DWORD(channel), coptions, C.DWORD(flags), callback, userdata)).ToError()
}
func NewEncoderFile(channel bass.Channel, options string, flags bass.Flags, file string) (enc.Encoder, error) {
coptions := C.CString(options)
defer C.free(unsafe.Pointer(coptions))
cfile := C.CString(file)
defer C.free(unsafe.Pointer(cfile))
return enc.Encoder(C.BASS_Encode_OGG_StartFile(C.DWORD(channel), coptions, C.DWORD(flags), cfile)).ToError()
}