func AvError(averr int) error { errlen := 1024 b := make([]byte, errlen) C.av_strerror(C.int(averr), (*C.char)(unsafe.Pointer(&b[0])), C.size_t(errlen)) return errors.New(string(b[:bytes.Index(b, []byte{0})])) }
func strError(code C.int) string { size := C.size_t(256) buf := (*C.char)(C.malloc(size)) defer C.free(unsafe.Pointer(buf)) C.memset(unsafe.Pointer(buf), 0, size) if C.av_strerror(code, buf, size-1) == 0 { return C.GoString(buf) } return "Unknown error" }