Using my amfDecodeString but need to fix amfDecodeInt16 - tested and working

This commit is contained in:
saxon 2018-07-29 10:36:55 +09:30
parent 6978e73aee
commit 084f7ce52b
1 changed files with 5 additions and 3 deletions

View File

@ -1391,6 +1391,7 @@ func rtmpSendPacket(r *C.RTMP, packet *C.RTMPPacket, queue int) int {
} }
if nSize > 8 { if nSize > 8 {
// TODO: port this
hptr = incBytePtr(hptr, int(C.EncodeInt32LE((*C.char)(hptr), hptr = incBytePtr(hptr, int(C.EncodeInt32LE((*C.char)(hptr),
C.int(packet.m_nInfoField2)))) C.int(packet.m_nInfoField2))))
} }
@ -1482,8 +1483,8 @@ func rtmpSendPacket(r *C.RTMP, packet *C.RTMPPacket, queue int) int {
var method C.AVal var method C.AVal
var ptr unsafe.Pointer var ptr unsafe.Pointer
ptr = incBytePtr(unsafe.Pointer(packet.m_body), 1) ptr = incBytePtr(unsafe.Pointer(packet.m_body), 1)
C.AMF_DecodeString((*C.char)(ptr), &method) //C.AMF_DecodeString((*C.char)(ptr), &method)
//amfDecodeString((*byte)(ptr), &method) amfDecodeString((*byte)(ptr), &method)
if debugMode { if debugMode {
log.Printf("Invoking %v", method.av_val) log.Printf("Invoking %v", method.av_val)
@ -1660,7 +1661,8 @@ func amfEncodeNamedString(output *byte, outend *byte, strName *C.AVal, strValue
// amfDecodeString decodes data into a string inside a AVal // amfDecodeString decodes data into a string inside a AVal
func amfDecodeString(data *byte, bv *C.AVal) { func amfDecodeString(data *byte, bv *C.AVal) {
dataPtr := unsafe.Pointer(data) dataPtr := unsafe.Pointer(data)
bv.av_len = C.int(amfDecodeInt16((*byte)(dataPtr))) bv.av_len = C.int(C.AMF_DecodeInt16((*C.char)(dataPtr)))
//bv.av_len = C.int(amfDecodeInt16((*byte)(dataPtr)))
if bv.av_len > 0 { if bv.av_len > 0 {
bv.av_val = (*C.char)(incBytePtr(dataPtr, 2)) bv.av_val = (*C.char)(incBytePtr(dataPtr, 2))
} else { } else {