mirror of https://bitbucket.org/ausocean/av.git
Using my amfEncodeArray func - tested and working
This commit is contained in:
parent
56a7bede73
commit
7f6d377cb1
27
rtmp/rtmp.go
27
rtmp/rtmp.go
|
@ -1159,7 +1159,8 @@ func amfPropEncode(p *C.AMFObjectProperty, pBuffer *byte, pBufEnd *byte) *byte {
|
|||
pBuffer = amfEncodeEcmaArray(&p.p_vu.p_object, pBuffer, pBufEnd)
|
||||
//pBuffer = (*byte)(unsafe.Pointer(C.AMF_EncodeEcmaArray(&p.p_vu.p_object, (*C.char)(unsafe.Pointer(pBuffer)), (*C.char)(unsafe.Pointer(pBufEnd)))))
|
||||
case AMF_STRICT_ARRAY:
|
||||
pBuffer = (*byte)(unsafe.Pointer(C.AMF_EncodeArray(&p.p_vu.p_object, (*C.char)(unsafe.Pointer(pBuffer)), (*C.char)(unsafe.Pointer(pBufEnd)))))
|
||||
//pBuffer = (*byte)(unsafe.Pointer(C.AMF_EncodeArray(&p.p_vu.p_object, (*C.char)(unsafe.Pointer(pBuffer)), (*C.char)(unsafe.Pointer(pBufEnd)))))
|
||||
pBuffer = amfEncodeArray(&p.p_vu.p_object, pBuffer, pBufEnd)
|
||||
default:
|
||||
log.Println("amfPropEncode: invalid type!")
|
||||
pBuffer = nil
|
||||
|
@ -1225,6 +1226,30 @@ func amfEncodeEcmaArray(obj *C.AMFObject, pBuffer *byte, pBufEnd *byte) *byte {
|
|||
return pBuffer
|
||||
}
|
||||
|
||||
func amfEncodeArray(obj *C.AMFObject, pBuffer *byte, pBufEnd *byte) *byte {
|
||||
if int(uintptr(unsafe.Pointer(pBuffer)))+4 >= int(uintptr(unsafe.Pointer(pBufEnd))) {
|
||||
return nil
|
||||
}
|
||||
|
||||
*pBuffer = AMF_STRICT_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
|
||||
}
|
||||
}
|
||||
|
||||
return pBuffer
|
||||
}
|
||||
|
||||
func rtmpConnectStream(r *C.RTMP, seekTime int32) int {
|
||||
var packet C.RTMPPacket
|
||||
memset((*byte)(unsafe.Pointer(&packet)), 0, int(unsafe.Sizeof(packet)))
|
||||
|
|
Loading…
Reference in New Issue