mirror of
https://github.com/Danile71/go-rtsp.git
synced 2025-10-05 16:16:54 +08:00
feat: add functional options
fix: use timeout optionaly
This commit is contained in:
@@ -8,16 +8,17 @@ package rtsp
|
||||
*/
|
||||
import "C"
|
||||
import (
|
||||
"bytes"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// CErr2Str convert C error code to Go string
|
||||
func CErr2Str(code C.int) string {
|
||||
buf := make([]byte, 64)
|
||||
buf := make([]byte, 1024)
|
||||
|
||||
C.av_strerror(code, (*C.char)(unsafe.Pointer(&buf[0])), C.ulong(len(buf)))
|
||||
C.av_strerror(code, (*C.char)(unsafe.Pointer(&buf[0])), C.size_t(len(buf)))
|
||||
|
||||
return string(buf)
|
||||
return string(buf[:bytes.Index(buf, []byte{0})])
|
||||
}
|
||||
|
||||
func swrAllocSetOpts(layout uint64, sampleRate C.int, sampleFmt int32) *C.SwrContext {
|
||||
|
Reference in New Issue
Block a user