mirror of https://bitbucket.org/ausocean/av.git
rtmp: Implement afmDecodeInt16
This commit is contained in:
parent
cc616b12d4
commit
6903276a18
|
@ -794,7 +794,7 @@ func sendPacket(r *C.RTMP, packet *C.RTMPPacket, queue int) int {
|
|||
// afmDecodeString decodes data into a string inside a AVal
|
||||
func afmDecodeString(data *byte, bv *C.AVal) {
|
||||
dataPtr := unsafe.Pointer(data)
|
||||
bv.av_len = C.int(C.AMF_DecodeInt16((*C.char)(dataPtr)))
|
||||
bv.av_len = C.int(afmDecodeInt16((*byte)(dataPtr)))
|
||||
|
||||
if bv.av_len > 0 {
|
||||
bv.av_val = (*C.char)(incBytePtr(dataPtr, 2))
|
||||
|
@ -803,6 +803,12 @@ func afmDecodeString(data *byte, bv *C.AVal) {
|
|||
}
|
||||
}
|
||||
|
||||
// afmDecodeInt16 decodes data into a 16 bit number
|
||||
func afmDecodeInt16(data *byte) uint16 {
|
||||
c := unsafe.Pointer(data)
|
||||
return (uint16(*(*uint8)(c)) << 8) | *(*uint16)(incBytePtr(c, 1))
|
||||
}
|
||||
|
||||
func writeN(r *C.RTMP, buffer unsafe.Pointer, n int) int {
|
||||
ptr := buffer
|
||||
for n > 0 {
|
||||
|
|
Loading…
Reference in New Issue