Now it builds using go1.9

This commit is contained in:
saxon 2018-07-17 01:08:31 +09:30
parent 41746a8844
commit 1c8146c8f3
1 changed files with 13 additions and 12 deletions

View File

@ -167,7 +167,7 @@ func rtmpWrite(r *C.RTMP, data []byte) int {
var ret, num int
pkt.m_nChannel = 0x04
pkt.m_nInfoField2 = r.m_stream_id
pkt.m_nInfoField2 = C.int32_t(r.m_stream_id)
for s2 != 0 {
if pkt.m_nBytesRead == 0 {
if size < minDataSize {
@ -181,15 +181,15 @@ func rtmpWrite(r *C.RTMP, data []byte) int {
s2 -= 13
}
pkt.m_packetType = C.uchar(*indxBytePtr(buf,0))
pkt.m_packetType = C.uint8_t(*indxBytePtr(buf,0))
buf = incBytePtr(buf, 1)
// TODO: port this
pkt.m_nBodySize = C.AMF_DecodeInt24((*C.char)(buf))
pkt.m_nBodySize = C.uint32_t(C.AMF_DecodeInt24((*C.char)(buf)))
buf = incBytePtr(buf, 3)
// TODO: replace with ported version
pkt.m_nTimeStamp = C.AMF_DecodeInt24((*C.char)(buf))
pkt.m_nTimeStamp = C.uint32_t(C.AMF_DecodeInt24((*C.char)(buf)))
buf = incBytePtr(buf, 3)
pkt.m_nTimeStamp |= C.uint(*indxBytePtr(buf,0)) << 24
pkt.m_nTimeStamp |= C.uint32_t(*indxBytePtr(buf,0)) << 24
buf = incBytePtr(buf, 4)
s2 -= 11
@ -217,7 +217,7 @@ func rtmpWrite(r *C.RTMP, data []byte) int {
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) -
pkt.m_nBytesRead = C.uint32_t(math.Abs(float64(uintptr(enc) -
uintptr(unsafe.Pointer(pkt.m_body)))))
}
@ -231,7 +231,7 @@ func rtmpWrite(r *C.RTMP, data []byte) int {
memmove(enc,buf,uintptr(num))
//copy(ptrToSlice(enc, num), ptrToSlice(buf, num))
pkt.m_nBytesRead += C.uint(num)
pkt.m_nBytesRead += C.uint32_t(num)
s2 -= num
buf = incBytePtr(buf, num)
if pkt.m_nBytesRead == pkt.m_nBodySize {
@ -268,7 +268,7 @@ func sendPacket(r *C.RTMP, packet *C.RTMPPacket, queue int) int {
n := int(packet.m_nChannel+10)
var tmp *C.RTMPPacket
packets := C.realloc(unsafe.Pointer(r.m_vecChannelsOut),
C.ulong(unsafe.Sizeof(tmp) * uintptr(n)))
C.size_t(unsafe.Sizeof(tmp) * uintptr(n)))
if uintptr(packets) == uintptr(0) {
C.free(unsafe.Pointer(r.m_vecChannelsOut))
@ -278,7 +278,7 @@ func sendPacket(r *C.RTMP, packet *C.RTMPPacket, queue int) int {
}
r.m_vecChannelsOut = (**C.RTMPPacket)(packets)
C.memset(incPtr(unsafe.Pointer(r.m_vecChannelsOut), int(r.m_channelsAllocatedOut),
int(unsafe.Sizeof(tmp))), 0, C.ulong(unsafe.Sizeof(tmp) *
int(unsafe.Sizeof(tmp))), 0, C.size_t(unsafe.Sizeof(tmp) *
uintptr(n-int(r.m_channelsAllocatedOut))))
r.m_channelsAllocatedOut = C.int(n)
}
@ -382,7 +382,8 @@ func sendPacket(r *C.RTMP, packet *C.RTMPPacket, queue int) int {
}
if nSize > 8 {
hptr = incBytePtr(hptr, int(C.EncodeInt32LE((*C.char)(hptr), packet.m_nInfoField2)))
hptr = incBytePtr(hptr, int(C.EncodeInt32LE((*C.char)(hptr),
C.int(packet.m_nInfoField2))))
}
if t >= 0xffffff {
@ -404,7 +405,7 @@ func sendPacket(r *C.RTMP, packet *C.RTMPPacket, queue int) int {
if chunks > 1 {
tlen = chunks *(cSize+1) +nSize +hSize
// TODO: figure out how to do this in go
tbuf = C.malloc(C.ulong(tlen))
tbuf = C.malloc(C.size_t(tlen))
if tbuf == nil {
return 0
@ -511,7 +512,7 @@ func sendPacket(r *C.RTMP, packet *C.RTMPPacket, queue int) int {
if unsafe.Pointer((*C.RTMPPacket)(incPtr(unsafe.Pointer(r.m_vecChannelsOut),
int(packet.m_nChannel), int(unsafe.Sizeof(packet))))) == nil {
r.m_vecChannelsOut = (**C.RTMPPacket)(C.malloc(C.ulong(unsafe.Sizeof(packet))))
r.m_vecChannelsOut = (**C.RTMPPacket)(C.malloc(C.size_t(unsafe.Sizeof(packet))))
}
memmove(incPtr(unsafe.Pointer(r.m_vecChannelsOut),int(packet.m_nChannel),