Ported AMF_AddProp - tested and working

This commit is contained in:
saxon 2018-08-15 04:47:43 +09:30
parent a2931934a6
commit 6113174e3d
1 changed files with 14 additions and 2 deletions

View File

@ -2774,8 +2774,7 @@ func C_AMF_Decode(obj *C.AMFObject, pBuffer *byte, nSize int32, bDecodeName int3
break
}
pBuffer = (*byte)(incBytePtr(unsafe.Pointer(pBuffer), int(nRes)))
// TODO port
C.AMF_AddProp(obj, &prop)
C_AMF_AddProp(obj, &prop)
}
}
@ -2786,6 +2785,19 @@ func C_AMF_Decode(obj *C.AMFObject, pBuffer *byte, nSize int32, bDecodeName int3
return nOriginalSize - nSize
}
// void AMF_AddProp(AMFObject* obj, const AMFObjectProperty* prop);
// amf.c + 1234
func C_AMF_AddProp(obj *C.AMFObject, prop *C.AMFObjectProperty) {
if (obj.o_num & 0x0f) == 0 {
obj.o_props = (*C.AMFObjectProperty)(C.realloc(unsafe.Pointer(obj.o_props),
C.size_t(int(obj.o_num+16)*int(unsafe.Sizeof(*obj.o_props)))))
}
memmove(unsafe.Pointer(&(*(*C.AMFObjectProperty)(incPtr(
unsafe.Pointer(obj.o_props), int(obj.o_num), int(unsafe.Sizeof(*obj.o_props)))))),
unsafe.Pointer(prop), unsafe.Sizeof(*obj.o_props))
obj.o_num++
}
// static int DecodeInt32LE(const char* data);
// rtmp.c +3527
func C_DecodeInt32LE(data *byte) int32 {