mirror of https://bitbucket.org/ausocean/av.git
Everything is building now, time to test with youtube
This commit is contained in:
parent
1c8146c8f3
commit
825a5f6f29
25
rtmp/rtmp.go
25
rtmp/rtmp.go
|
@ -76,6 +76,10 @@ const (
|
||||||
RTMP_PACKET_TYPE_VIDEO = 0x09
|
RTMP_PACKET_TYPE_VIDEO = 0x09
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// memmove copies n bytes from "from" to "to".
|
||||||
|
//go:linkname memmove runtime.memmove
|
||||||
|
//func memmove(to, from unsafe.Pointer, n uintptr)
|
||||||
|
|
||||||
// C.AVal is in amf.h
|
// C.AVal is in amf.h
|
||||||
// See #define AVC(str) {str, sizeof(str)-1} in amf.h
|
// See #define AVC(str) {str, sizeof(str)-1} in amf.h
|
||||||
func AVC(str string) C.AVal {
|
func AVC(str string) C.AVal {
|
||||||
|
@ -229,8 +233,8 @@ func rtmpWrite(r *C.RTMP, data []byte) int {
|
||||||
num = s2
|
num = s2
|
||||||
}
|
}
|
||||||
|
|
||||||
memmove(enc,buf,uintptr(num))
|
//memmove(enc,buf,uintptr(num))
|
||||||
//copy(ptrToSlice(enc, num), ptrToSlice(buf, num))
|
copy(ptrToSlice(enc, num), ptrToSlice(buf, num))
|
||||||
pkt.m_nBytesRead += C.uint32_t(num)
|
pkt.m_nBytesRead += C.uint32_t(num)
|
||||||
s2 -= num
|
s2 -= num
|
||||||
buf = incBytePtr(buf, num)
|
buf = incBytePtr(buf, num)
|
||||||
|
@ -425,7 +429,9 @@ func sendPacket(r *C.RTMP, packet *C.RTMPPacket, queue int) int {
|
||||||
// RTMP_LogHexString(RTMP_LOGDEBUG2, (uint8_t *)buffer, nChunkSize);
|
// RTMP_LogHexString(RTMP_LOGDEBUG2, (uint8_t *)buffer, nChunkSize);
|
||||||
|
|
||||||
if tbuf != nil {
|
if tbuf != nil {
|
||||||
memmove(toff, header, uintptr(nChunkSize + hSize))
|
//memmove(toff, header, uintptr(nChunkSize + hSize))
|
||||||
|
copy(ptrToSlice(toff, int(nChunkSize+hSize)), ptrToSlice(header,
|
||||||
|
int(nChunkSize+hSize)))
|
||||||
toff = incBytePtr(toff, nChunkSize + hSize)
|
toff = incBytePtr(toff, nChunkSize + hSize)
|
||||||
} else {
|
} else {
|
||||||
// TODO: port this
|
// TODO: port this
|
||||||
|
@ -515,9 +521,12 @@ func sendPacket(r *C.RTMP, packet *C.RTMPPacket, queue int) int {
|
||||||
r.m_vecChannelsOut = (**C.RTMPPacket)(C.malloc(C.size_t(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),
|
//memmove(incPtr(unsafe.Pointer(r.m_vecChannelsOut),int(packet.m_nChannel),
|
||||||
int(unsafe.Sizeof(packet))),unsafe.Pointer(packet), unsafe.Sizeof(packet))
|
//int(unsafe.Sizeof(packet))),unsafe.Pointer(packet), unsafe.Sizeof(packet))
|
||||||
|
dest := ptrToSlice(incPtr(unsafe.Pointer(r.m_vecChannelsOut),int(packet.m_nChannel),
|
||||||
|
int(unsafe.Sizeof(packet))),int(unsafe.Sizeof(packet)))
|
||||||
|
src := ptrToSlice(unsafe.Pointer(packet),int(unsafe.Sizeof(packet)))
|
||||||
|
copy(dest,src)
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -579,9 +588,7 @@ func avQueue(vals **C.RTMP_METHOD, num *int, av *AVal, txn int ) {
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// memmove copies n bytes from "from" to "to".
|
|
||||||
//go:linkname memmove runtime.memmove
|
|
||||||
func memmove(to, from unsafe.Pointer, n uintptr)
|
|
||||||
|
|
||||||
// indxBytePtr returns a byte at the indx inc give a ptr
|
// indxBytePtr returns a byte at the indx inc give a ptr
|
||||||
func indxBytePtr(ptr unsafe.Pointer, inc int) *byte {
|
func indxBytePtr(ptr unsafe.Pointer, inc int) *byte {
|
||||||
|
|
Loading…
Reference in New Issue