Using my afmEncodeNamedString - tested and working

This commit is contained in:
saxon 2018-07-29 10:17:53 +09:30
parent 0ae81ef52a
commit a3ceff1a0a
1 changed files with 16 additions and 16 deletions

View File

@ -971,16 +971,16 @@ func sendConnectPacket(r *C.RTMP, cp *C.RTMPPacket) int {
enc = (*byte)(unsafe.Pointer(incBytePtr(unsafe.Pointer(enc), 1))) enc = (*byte)(unsafe.Pointer(incBytePtr(unsafe.Pointer(enc), 1)))
enc = (*byte)(unsafe.Pointer(C.AMF_EncodeNamedString((*C.char)( //enc = (*byte)(unsafe.Pointer(C.AMF_EncodeNamedString((*C.char)(
unsafe.Pointer(enc)), (*C.char)(unsafe.Pointer(pend)), &av_app, &r.Link.app))) //unsafe.Pointer(enc)), (*C.char)(unsafe.Pointer(pend)), &av_app, &r.Link.app)))
// enc = amfEncodeNamedString(enc, pend, &av_app, &r.Link.app) enc = amfEncodeNamedString(enc, pend, &av_app, &r.Link.app)
if enc == nil { if enc == nil {
return 0 return 0
} }
if r.Link.protocol&RTMP_FEATURE_WRITE != 0 { if r.Link.protocol&RTMP_FEATURE_WRITE != 0 {
enc = (*byte)(unsafe.Pointer(C.AMF_EncodeNamedString((*C.char)( //enc = (*byte)(unsafe.Pointer(C.AMF_EncodeNamedString((*C.char)(
unsafe.Pointer(enc)), (*C.char)(unsafe.Pointer(pend)), &av_type, &av_nonprivate))) //unsafe.Pointer(enc)), (*C.char)(unsafe.Pointer(pend)), &av_type, &av_nonprivate)))
//enc = amfEncodeNamedString(enc, pend, &av_type, &av_nonprivate) enc = amfEncodeNamedString(enc, pend, &av_type, &av_nonprivate)
if enc == nil { if enc == nil {
return 0 return 0
@ -988,26 +988,26 @@ func sendConnectPacket(r *C.RTMP, cp *C.RTMPPacket) int {
} }
if r.Link.flashVer.av_len != 0 { if r.Link.flashVer.av_len != 0 {
enc = (*byte)(unsafe.Pointer(C.AMF_EncodeNamedString((*C.char)( //enc = (*byte)(unsafe.Pointer(C.AMF_EncodeNamedString((*C.char)(
unsafe.Pointer(enc)), (*C.char)(unsafe.Pointer(pend)), &av_flashVer, &r.Link.flashVer))) //unsafe.Pointer(enc)), (*C.char)(unsafe.Pointer(pend)), &av_flashVer, &r.Link.flashVer)))
//enc = amfEncodeNamedString(enc, pend, &av_flashVer, &r.Link.flashVer) enc = amfEncodeNamedString(enc, pend, &av_flashVer, &r.Link.flashVer)
if enc == nil { if enc == nil {
return 0 return 0
} }
} }
if r.Link.swfUrl.av_len != 0 { if r.Link.swfUrl.av_len != 0 {
enc = (*byte)(unsafe.Pointer(C.AMF_EncodeNamedString((*C.char)( //enc = (*byte)(unsafe.Pointer(C.AMF_EncodeNamedString((*C.char)(
unsafe.Pointer(enc)), (*C.char)(unsafe.Pointer(pend)), &av_swfUrl, &r.Link.swfUrl))) // unsafe.Pointer(enc)), (*C.char)(unsafe.Pointer(pend)), &av_swfUrl, &r.Link.swfUrl)))
//enc = amfEncodeNamedString(enc, pend, &av_swfUrl, &r.Link.swfUrl) enc = amfEncodeNamedString(enc, pend, &av_swfUrl, &r.Link.swfUrl)
if enc == nil { if enc == nil {
return 0 return 0
} }
} }
if r.Link.tcUrl.av_len != 0 { if r.Link.tcUrl.av_len != 0 {
enc = (*byte)(unsafe.Pointer(C.AMF_EncodeNamedString((*C.char)( //enc = (*byte)(unsafe.Pointer(C.AMF_EncodeNamedString((*C.char)(
unsafe.Pointer(enc)), (*C.char)(unsafe.Pointer(pend)), &av_tcUrl, &r.Link.tcUrl))) //unsafe.Pointer(enc)), (*C.char)(unsafe.Pointer(pend)), &av_tcUrl, &r.Link.tcUrl)))
// enc = amfEncodeNamedString(enc, pend, &av_tcUrl, &r.Link.tcUrl) enc = amfEncodeNamedString(enc, pend, &av_tcUrl, &r.Link.tcUrl)
if enc == nil { if enc == nil {
return 0 return 0
} }
@ -1651,7 +1651,7 @@ func amfEncodeNamedString(output *byte, outend *byte, strName *C.AVal, strValue
return nil return nil
} }
output = amfEncodeInt16(output, outend, int16(strName.av_len)) output = amfEncodeInt16(output, outend, int16(strName.av_len))
memmove(unsafe.Pointer(output), unsafe.Pointer(outend), uintptr(strName.av_len)) memmove(unsafe.Pointer(output), unsafe.Pointer(strName.av_val), uintptr(strName.av_len))
output = (*byte)(incBytePtr(unsafe.Pointer(output), int(strName.av_len))) output = (*byte)(incBytePtr(unsafe.Pointer(output), int(strName.av_len)))
return amfEncodeString(output, outend, strValue) return amfEncodeString(output, outend, strValue)
} }