rtmp: finished reordering amf.go such that it resembles the C amf.c file more closely - also readded C_AV_Queue, which I must have deleted somehow

This commit is contained in:
saxon 2018-08-24 22:30:40 +09:30
parent d23ab3b1a0
commit ecb3f3f4c2
2 changed files with 570 additions and 546 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1304,6 +1304,29 @@ func C_AV_erase(vals *C_RTMP_METHOD, num *int32, i, freeit int32) {
int(unsafe.Sizeof(*vals))))).num = 0
}
// void AV_queue(RTMP_METHOD** vals, int* num, C_AVal* av, int txn);
// rtmp.c +2414
func C_AV_queue(vals **C_RTMP_METHOD, num *int32, av *C_AVal, txn int32) {
if (*num & 0x0f) == 0 {
//*vals = (*C_RTMP_METHOD)(realloc(unsafe.Pointer(*vals), uint32((*num+16)*
//int32(unsafe.Sizeof(*(*vals))))))
*vals = (*C_RTMP_METHOD)(C.realloc(unsafe.Pointer(*vals), C.size_t((*num+16)*
int32(unsafe.Sizeof(*(*vals))))))
}
tmp := malloc(uintptr(av.av_len + 1))
//tmp := allocate(uintptr(av.av_len + 1))
memmove(tmp, unsafe.Pointer(av.av_val), uintptr(av.av_len))
*indxBytePtr(tmp, int(av.av_len)) = '\000'
(*(*C_RTMP_METHOD)(incPtr(unsafe.Pointer(*vals), int(*num),
int(unsafe.Sizeof(*(*vals)))))).num = int32(txn)
(*(*C_RTMP_METHOD)(incPtr(unsafe.Pointer(*vals), int(*num),
int(unsafe.Sizeof(*(*vals)))))).name.av_len = av.av_len
(*(*C_RTMP_METHOD)(incPtr(unsafe.Pointer(*vals), int(*num),
int(unsafe.Sizeof(*(*vals)))))).name.av_val = (*byte)(tmp)
(*num)++
}
// int HandleInvoke(RTMP* r, const char* body, unsigned int nBodySize);
// rtmp.c +2912
func C_HandleInvoke(r *C_RTMP, body *byte, nBodySize uint32) int32 {