Ported AV_queue - tested and working

This commit is contained in:
saxon 2018-07-18 11:41:44 +09:30
parent 894a62716c
commit 97cae6ff20
1 changed files with 12 additions and 11 deletions

View File

@ -581,22 +581,23 @@ func writeN(r *C.RTMP, buffer unsafe.Pointer, n int) int {
} }
/*
// TODO: port RTMP_METHOD // TODO: port RTMP_METHOD
func avQueue(vals **C.RTMP_METHOD, num *int, av *AVal, txn int ) { func avQueue(vals **C.RTMP_METHOD, num *int, av *C.AVal, txn int ) {
var tmp unsafe.Pointer var rtmpMethodPtr *C.RTMP_METHOD
if (*num & 0x0f) == 0 { if (*num & 0x0f) == 0 {
// TODO: work out what to do with the realloc // TODO: work out what to do with the realloc
*vals = C.realloc(*vals, (*num+16) * C.int(int(unsafe.sizeof(RTMP_METHOD)))) *vals = (*C.RTMP_METHOD)(C.realloc(unsafe.Pointer(*vals), C.size_t((*num+16) * int(unsafe.Sizeof(*(*vals))))))
} }
tmp := unsafe.Pointer(C.malloc(C.size_t(av.av_len + 1)))
tmp := C.malloc(av.av_len + 1 ) C.memcpy(tmp, unsafe.Pointer(av.av_val), C.size_t(av.av_len))
memmove(tmp, unsafe.Pointer(av.av_val), int(av.av_len)) *indxBytePtr(tmp,int(av.av_len)) = *(*byte)(unsafe.Pointer(C.CString("")))
indxPtr(tmp,av.av_len) = byte(nullChar) (*(*C.RTMP_METHOD)(incPtr(unsafe.Pointer(*vals),*num,
int(unsafe.Sizeof(rtmpMethodPtr))))).num = C.int(txn)
(*(*C.RTMP_METHOD)(incPtr(unsafe.Pointer(*vals),*num,
int(unsafe.Sizeof(rtmpMethodPtr))))).name.av_len = av.av_len
(*(*C.RTMP_METHOD)(incPtr(unsafe.Pointer(*vals),*num,
int(unsafe.Sizeof(rtmpMethodPtr))))).name.av_val = (*C.char)(tmp)
} }
*/
// indxBytePtr returns a byte at the indx inc give a ptr // indxBytePtr returns a byte at the indx inc give a ptr