diff --git a/rtmp/rtmp.go b/rtmp/rtmp.go index 0b06139b..9d9d949e 100644 --- a/rtmp/rtmp.go +++ b/rtmp/rtmp.go @@ -132,6 +132,7 @@ func (s *session) Write(data []byte) (int, error) { func rtmpWrite(r *C.RTMP, data []byte) int { buf := sliceToPtr(data) + // TODO: port RTMPPacket var pkt = &r.m_write var pend, enc unsafe.Pointer size := len(data) @@ -157,8 +158,10 @@ func rtmpWrite(r *C.RTMP, data []byte) int { pkt.m_packetType = C.uchar(*(*byte)(buf)) buf = incPtr(buf,1) + // TODO: port this pkt.m_nBodySize = C.AMF_DecodeInt24((*C.char)(buf)) buf = incPtr(buf,3) + // TODO: replace with ported version pkt.m_nTimeStamp = C.AMF_DecodeInt24((*C.char)(buf)) buf = incPtr(buf,3) pkt.m_nTimeStamp |= C.uint(*((*byte)(buf))) << 24 @@ -177,7 +180,7 @@ func rtmpWrite(r *C.RTMP, data []byte) int { } else { pkt.m_headerType = RTMP_PACKET_SIZE_MEDIUM } - + // TODO: Port this if int(C.RTMPPacket_Alloc(pkt, pkt.m_nBodySize)) == 0 { log.Println("Failed to allocate packet") return 0 @@ -187,6 +190,7 @@ func rtmpWrite(r *C.RTMP, data []byte) int { pend = incPtr(enc,int(pkt.m_nBodySize)) if pkt.m_packetType == RTMP_PACKET_TYPE_INFO { + // TODO: Port this enc = unsafe.Pointer(C.AMF_EncodeString((*C.char)(enc), (*C.char)(pend), &setDataFrame)) pkt.m_nBytesRead = C.uint(math.Abs(float64(uintptr(enc) - uintptr(unsafe.Pointer(pkt.m_body))))) @@ -204,7 +208,9 @@ func rtmpWrite(r *C.RTMP, data []byte) int { s2 -= num buf = incPtr(buf,num) if pkt.m_nBytesRead == pkt.m_nBodySize { + // TODO: Port this ret = int(C.RTMP_SendPacket(r, pkt, 0)) + // TODO: Port this C.RTMPPacket_Free(pkt) pkt.m_nBytesRead = 0 if ret == 0 {