mirror of https://bitbucket.org/ausocean/av.git
Creating wrapper for unsafe.Pointer conversion
This commit is contained in:
parent
de4e673e94
commit
a0fa9106d6
17
rtmp/rtmp.go
17
rtmp/rtmp.go
|
@ -428,10 +428,10 @@ func rtmpSetupUrl(r *C.RTMP, u string) int32 {
|
|||
r.Link.playpath = r.Link.playpath0
|
||||
|
||||
if r.Link.tcUrl.av_len == 0 {
|
||||
r.Link.tcUrl.av_val = url
|
||||
r.Link.tcUrl.av_val = (*C.char)(unsafe.Pointer(url))
|
||||
if r.Link.app.av_len != 0 {
|
||||
if int(uintptr(unsafe.Pointer(r.Link.app.av_val))) <
|
||||
int(uintptr(incBytePtr(url, len))) {
|
||||
int(uintptr(incBytePtr(unsafe.Pointer(url), len))) {
|
||||
|
||||
r.Link.tcUrl.av_len = r.Link.app.av_len +
|
||||
int(uintptr(decBytePtr(r.Link.app.av_val, int(uintptr(unsafe.Pointer(url))))))
|
||||
|
@ -478,7 +478,8 @@ func rtmpSetupUrl(r *C.RTMP, u string) int32 {
|
|||
|
||||
func socksSetup(r *RTMP, sockshost *AVal) {
|
||||
if sockshost.av_len != 0 {
|
||||
socksport := strchr((*byte)(sockshost.av_val), ':')
|
||||
socksport := strchr((*byte)(unsafe.Pointer(sockshost.av_val)), ':')
|
||||
hostname := strdup((*byte)(sockshost.av_val))
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1057,6 +1058,16 @@ func avQueue(vals **C.RTMP_METHOD, num *int, av *C.AVal, txn int) {
|
|||
int(unsafe.Sizeof(rtmpMethodPtr))))).name.av_val = (*C.char)(tmp)
|
||||
}
|
||||
|
||||
// wrapper for converting byte pointer to unsafe.Pointer
|
||||
func uBP(b *byte) unsafe.Pointer {
|
||||
return unsafe.Pointer(b)
|
||||
}
|
||||
|
||||
// wrapper for converting slice to unsafe.pointer
|
||||
func uBSP(b []byte) unsafe.Pointer {
|
||||
return unsafe.Pointer(&b[0])
|
||||
}
|
||||
|
||||
func goStrToCStr(str string) *byte {
|
||||
l := len(str)
|
||||
slice := make([]byte, l+1)
|
||||
|
|
Loading…
Reference in New Issue