From c205e3874ad4a0f18db1ab5a8eaa23881e7e7014 Mon Sep 17 00:00:00 2001 From: saxon Date: Sun, 29 Jul 2018 10:24:27 +0930 Subject: [PATCH] Using my amfEncodeNamedNumber and amfEncodeNumber - tested and working --- rtmp/rtmp.go | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/rtmp/rtmp.go b/rtmp/rtmp.go index f30759ec..4aa8e9ef 100644 --- a/rtmp/rtmp.go +++ b/rtmp/rtmp.go @@ -1020,27 +1020,27 @@ func sendConnectPacket(r *C.RTMP, cp *C.RTMPPacket) int { if enc == nil { return 0 } - enc = (*byte)(unsafe.Pointer(C.AMF_EncodeNamedNumber((*C.char)( - unsafe.Pointer(enc)), (*C.char)(unsafe.Pointer(pend)), &av_capabilities, 15.0))) - //enc = amfEncodeNamedNumber(enc, pend, &av_capabilities, 15.0) + //enc = (*byte)(unsafe.Pointer(C.AMF_EncodeNamedNumber((*C.char)( + //unsafe.Pointer(enc)), (*C.char)(unsafe.Pointer(pend)), &av_capabilities, 15.0))) + enc = amfEncodeNamedNumber(enc, pend, &av_capabilities, 15.0) if enc == nil { return 0 } - enc = (*byte)(unsafe.Pointer(C.AMF_EncodeNamedNumber((*C.char)( - unsafe.Pointer(enc)), (*C.char)(unsafe.Pointer(pend)), &av_audioCodecs, r.m_fAudioCodecs))) - //enc = amfEncodeNamedNumber(enc, pend, &av_audioCodecs, float64(r.m_fAudioCodecs)) + //enc = (*byte)(unsafe.Pointer(C.AMF_EncodeNamedNumber((*C.char)( + // unsafe.Pointer(enc)), (*C.char)(unsafe.Pointer(pend)), &av_audioCodecs, r.m_fAudioCodecs))) + enc = amfEncodeNamedNumber(enc, pend, &av_audioCodecs, float64(r.m_fAudioCodecs)) if enc == nil { return 0 } - enc = (*byte)(unsafe.Pointer(C.AMF_EncodeNamedNumber((*C.char)( - unsafe.Pointer(enc)), (*C.char)(unsafe.Pointer(pend)), &av_videoCodecs, r.m_fVideoCodecs))) - //enc = amfEncodeNamedNumber(enc, pend, &av_videoCodecs, float64(r.m_fVideoCodecs)) + //enc = (*byte)(unsafe.Pointer(C.AMF_EncodeNamedNumber((*C.char)( + //unsafe.Pointer(enc)), (*C.char)(unsafe.Pointer(pend)), &av_videoCodecs, r.m_fVideoCodecs))) + enc = amfEncodeNamedNumber(enc, pend, &av_videoCodecs, float64(r.m_fVideoCodecs)) if enc == nil { return 0 } - enc = (*byte)(unsafe.Pointer(C.AMF_EncodeNamedNumber((*C.char)( - unsafe.Pointer(enc)), (*C.char)(unsafe.Pointer(pend)), &av_videoFunction, 1.0))) - //enc = amfEncodeNamedNumber(enc, pend, &av_videoFunction, 1.0) + //enc = (*byte)(unsafe.Pointer(C.AMF_EncodeNamedNumber((*C.char)( + // unsafe.Pointer(enc)), (*C.char)(unsafe.Pointer(pend)), &av_videoFunction, 1.0))) + enc = amfEncodeNamedNumber(enc, pend, &av_videoFunction, 1.0) if enc == nil { return 0 } @@ -1588,7 +1588,7 @@ func amfEncodeNamedNumber(output *byte, outend *byte, strName *C.AVal, dVal floa return nil } output = amfEncodeInt16(output, outend, int16(strName.av_len)) - memmove(unsafe.Pointer(output), unsafe.Pointer(outend), uintptr(strName.av_len)) + memmove(unsafe.Pointer(output), unsafe.Pointer(strName.av_val), uintptr(strName.av_len)) output = (*byte)(incBytePtr(unsafe.Pointer(output), int(strName.av_len))) return amfEncodeNumber(output, outend, dVal) }