mirror of https://bitbucket.org/ausocean/av.git
rtmp: removed unused C_AMF3Read{Integer,String}
This commit is contained in:
parent
6b2ddd3deb
commit
7077165e63
68
rtmp/amf.go
68
rtmp/amf.go
|
@ -339,74 +339,6 @@ func C_AMF_PropEncode(p *C_AMFObjectProperty, dst []byte) []byte {
|
|||
return dst
|
||||
}
|
||||
|
||||
// int AMF3ReadInteger(const char *data, int32_t *valp);
|
||||
// amf.c +426
|
||||
// TODO test
|
||||
func C_AMF3ReadInteger(data []byte, valp *int32) int32 {
|
||||
var i int
|
||||
var val int32
|
||||
|
||||
for i <= 2 {
|
||||
/* handle first 3 bytes */
|
||||
if data[i]&0x80 != 0 {
|
||||
/* byte used */
|
||||
val <<= 7 /* shift up */
|
||||
val |= int32(data[i] & 0x7f) /* add bits */
|
||||
i++
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if i > 2 {
|
||||
/* use 4th byte, all 8bits */
|
||||
val <<= 8
|
||||
val |= int32(data[3])
|
||||
|
||||
/* range check */
|
||||
if val > AMF3_INTEGER_MAX {
|
||||
val -= (1 << 29)
|
||||
}
|
||||
} else {
|
||||
/* use 7bits of last unparsed byte (0xxxxxxx) */
|
||||
val <<= 7
|
||||
val |= int32(data[i])
|
||||
}
|
||||
|
||||
*valp = val
|
||||
|
||||
if i > 2 {
|
||||
return 4
|
||||
}
|
||||
return int32(i + 1)
|
||||
}
|
||||
|
||||
// int AMF3ReadString(const char *data, AVal *str);
|
||||
// amf.c +466
|
||||
func C_AMF3ReadString(data []byte, str *string) int32 {
|
||||
var ref int32
|
||||
// assert elided - we will get a panic if it's nil.
|
||||
|
||||
len := C_AMF3ReadInteger(data, &ref)
|
||||
data = data[len:]
|
||||
|
||||
if ref&0x1 == 0 {
|
||||
/* reference: 0xxx */
|
||||
// TODO(kortschak) Logging.
|
||||
// refIndex := (ref >> 1)
|
||||
// RTMP_Log(RTMP_LOGDEBUG,
|
||||
// "%s, string reference, index: %d, not supported, ignoring!",
|
||||
// __FUNCTION__, refIndex);
|
||||
*str = ""
|
||||
return len
|
||||
} else {
|
||||
nSize := (ref >> 1)
|
||||
*str = string(data[:nSize])
|
||||
return len + nSize
|
||||
}
|
||||
return len
|
||||
}
|
||||
|
||||
// int AMFProp_Decode(C_AMFObjectProperty* prop, const char* pBuffer, int nSize, int bDecodeName);
|
||||
// amf.c +619
|
||||
func C_AMFProp_Decode(prop *C_AMFObjectProperty, pBuffer *byte, nSize, bDecodeName int32) int32 {
|
||||
|
|
Loading…
Reference in New Issue