mirror of https://bitbucket.org/ausocean/av.git
Ported amfEncodeEcmaArray - need to test
This commit is contained in:
parent
f4ce5dff9d
commit
a1a8289a7f
32
rtmp/rtmp.go
32
rtmp/rtmp.go
|
@ -1171,7 +1171,7 @@ func amfEncode(obj *C.AMFObject, pBuffer *byte, pBufEnd *byte) *byte {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
*(*byte)(unsafe.Pointer(pBuffer)) = AMF_OBJECT
|
*pBuffer = AMF_OBJECT
|
||||||
pBuffer = (*byte)(incBytePtr(unsafe.Pointer(pBuffer), 1))
|
pBuffer = (*byte)(incBytePtr(unsafe.Pointer(pBuffer), 1))
|
||||||
|
|
||||||
for i := 0; i < int(obj.o_num); i++ {
|
for i := 0; i < int(obj.o_num); i++ {
|
||||||
|
@ -1194,6 +1194,36 @@ func amfEncode(obj *C.AMFObject, pBuffer *byte, pBufEnd *byte) *byte {
|
||||||
return pBuffer
|
return pBuffer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func amfEncodeEcmaArray(obj *AMFObject, pBuffer *byte, pBufEnd *byte) *byte {
|
||||||
|
if int(uintptr(unsafe.Pointer(pBuffer)))+4 >= int(uintptr(unsafe.Pointer(pBufEnd))) {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
*pBuffer = AMF_ECMA_ARRAY
|
||||||
|
pBuffer = (*byte)(incBytePtr(unsafe.Pointer(pBuffer), 1))
|
||||||
|
|
||||||
|
pBuffer = amfEncodeInt32(pBuffer, pBufEnd, int32(obj.o_num))
|
||||||
|
|
||||||
|
for i := 0; i < int(obj.o_num); i++ {
|
||||||
|
res := amfPropEncode((*C.AMFObjectProperty)(incPtr(unsafe.Pointer(
|
||||||
|
obj.o_props), i, int(unsafe.Sizeof(*obj.o_props)))), pBuffer, pBufEnd)
|
||||||
|
if res == nil {
|
||||||
|
log.Println("amfEncodeEcmaArray: failed to encode property!")
|
||||||
|
break
|
||||||
|
} else {
|
||||||
|
pBuffer = res
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if int(uintptr(unsafe.Pointer(pBuffer)))+3 >= int(uintptr(unsafe.Pointer(pBufEnd))) {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
pBuffer = amfEncodeInt24(pBuffer, pBufEnd, AMF_OBJECT_END)
|
||||||
|
|
||||||
|
return pBuffer
|
||||||
|
}
|
||||||
|
|
||||||
func rtmpConnectStream(r *C.RTMP, seekTime int32) int {
|
func rtmpConnectStream(r *C.RTMP, seekTime int32) int {
|
||||||
var packet C.RTMPPacket
|
var packet C.RTMPPacket
|
||||||
memset((*byte)(unsafe.Pointer(&packet)), 0, int(unsafe.Sizeof(packet)))
|
memset((*byte)(unsafe.Pointer(&packet)), 0, int(unsafe.Sizeof(packet)))
|
||||||
|
|
Loading…
Reference in New Issue