mirror of https://bitbucket.org/ausocean/av.git
rtmp: make C_AMF_DecodeArray take a []byte
This is unused.
This commit is contained in:
parent
7f2385b8a2
commit
d88f0601bb
31
rtmp/amf.go
31
rtmp/amf.go
|
@ -559,35 +559,22 @@ func C_AMF_EncodeArray(obj *C_AMFObject, dst []byte) []byte {
|
|||
|
||||
// int AMF_DecodeArray(AMFObject *obj, const char *pBuffer, int nSize, int nArrayLen, int bDecodeName);
|
||||
// amf.c +993
|
||||
func C_AMF_DecodeArray(obj *C_AMFObject, pBuffer *byte, nSize, nArrayLen, bDecodeName int32) int32 {
|
||||
nOriginalSize := nSize
|
||||
var bError int32 = 0
|
||||
func C_AMF_DecodeArray(obj *C_AMFObject, data []byte, nArrayLen, bDecodeName int32) int32 {
|
||||
nOriginalSize := len(data)
|
||||
|
||||
obj.o_props = obj.o_props[:0]
|
||||
for nArrayLen > 0 {
|
||||
for ; nArrayLen > 0 && len(data) != 0; nArrayLen-- {
|
||||
|
||||
var prop C_AMFObjectProperty
|
||||
var nRes int32
|
||||
nArrayLen--
|
||||
|
||||
if nSize <= 0 {
|
||||
bError = 1
|
||||
break
|
||||
}
|
||||
nRes = C_AMFProp_Decode(&prop, pl2b(pBuffer, int(nSize)), bDecodeName)
|
||||
nRes := C_AMFProp_Decode(&prop, data, bDecodeName)
|
||||
if nRes == -1 {
|
||||
bError = 1
|
||||
break
|
||||
} else {
|
||||
nSize -= nRes
|
||||
pBuffer = (*byte)(incBytePtr(unsafe.Pointer(pBuffer), int(nRes)))
|
||||
obj.o_props = append(obj.o_props, prop)
|
||||
return -1
|
||||
}
|
||||
}
|
||||
if bError != 0 {
|
||||
return -1
|
||||
data = data[nRes:]
|
||||
obj.o_props = append(obj.o_props, prop)
|
||||
}
|
||||
|
||||
return nOriginalSize - nSize
|
||||
return int32(nOriginalSize - len(data))
|
||||
}
|
||||
|
||||
// int AMF_Decode(AMFObject *obj, const char* pBuffer, int nSize, int bDecodeName);
|
||||
|
|
Loading…
Reference in New Issue