mirror of https://bitbucket.org/ausocean/av.git
Using my sendConnectPacket func - tested and working
This commit is contained in:
parent
fadac283e5
commit
8285941eec
72
rtmp/rtmp.go
72
rtmp/rtmp.go
|
@ -957,22 +957,29 @@ func sendConnectPacket(r *C.RTMP, cp *C.RTMPPacket) int {
|
||||||
RTMP_MAX_HEADER_SIZE))
|
RTMP_MAX_HEADER_SIZE))
|
||||||
|
|
||||||
enc = (*byte)(unsafe.Pointer(packet.m_body))
|
enc = (*byte)(unsafe.Pointer(packet.m_body))
|
||||||
enc = (*C.char)(unsafe.Pointer(C.AMF_EncodeString(enc, (*C.char)(unsafe.Pointer(pend)), &av_connect)))
|
|
||||||
|
enc = (*byte)(unsafe.Pointer(C.AMF_EncodeString((*C.char)(unsafe.Pointer(enc)),
|
||||||
|
(*C.char)(unsafe.Pointer(pend)), &av_connect)))
|
||||||
// enc = amfEncodeString(enc, pend, &av_connect)
|
// enc = amfEncodeString(enc, pend, &av_connect)
|
||||||
r.m_numInvokes += 1
|
r.m_numInvokes += 1
|
||||||
enc = (*byte)(unsafe.Pointer(C.AMF_EncodeNumber((*C.char))))
|
enc = (*byte)(unsafe.Pointer(C.AMF_EncodeNumber((*C.char)(unsafe.Pointer(enc)),
|
||||||
|
(*C.char)(unsafe.Pointer(pend)), C.double(r.m_numInvokes))))
|
||||||
//enc = amfEncodeNumber(enc, pend, float64(r.m_numInvokes))
|
//enc = amfEncodeNumber(enc, pend, float64(r.m_numInvokes))
|
||||||
// TODO: port this const
|
|
||||||
*indxBytePtr(unsafe.Pointer(enc), 0) = C.AMF_OBJECT
|
|
||||||
|
|
||||||
enc = (*C.char)(unsafe.Pointer(C.AMF_EncodeNamedString((*C.char)(
|
*indxBytePtr(unsafe.Pointer(enc), 0) = AMF_OBJECT
|
||||||
|
|
||||||
|
enc = (*byte)(unsafe.Pointer(incBytePtr(unsafe.Pointer(enc), 1)))
|
||||||
|
|
||||||
|
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 = amfEncodeNamedString(enc, pend, &av_type, &av_nonprivate)
|
enc = (*byte)(unsafe.Pointer(C.AMF_EncodeNamedString((*C.char)(
|
||||||
|
unsafe.Pointer(enc)), (*C.char)(unsafe.Pointer(pend)), &av_type, &av_nonprivate)))
|
||||||
|
//enc = amfEncodeNamedString(enc, pend, &av_type, &av_nonprivate)
|
||||||
|
|
||||||
if enc == nil {
|
if enc == nil {
|
||||||
return 0
|
return 0
|
||||||
|
@ -980,49 +987,66 @@ func sendConnectPacket(r *C.RTMP, cp *C.RTMPPacket) int {
|
||||||
}
|
}
|
||||||
|
|
||||||
if r.Link.flashVer.av_len != 0 {
|
if r.Link.flashVer.av_len != 0 {
|
||||||
enc = amfEncodeNamedString(enc, pend, &av_flashVer, &r.Link.flashVer)
|
enc = (*byte)(unsafe.Pointer(C.AMF_EncodeNamedString((*C.char)(
|
||||||
|
unsafe.Pointer(enc)), (*C.char)(unsafe.Pointer(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 = amfEncodeNamedString(enc, pend, &av_swfUrl, &r.Link.swfUrl)
|
enc = (*byte)(unsafe.Pointer(C.AMF_EncodeNamedString((*C.char)(
|
||||||
|
unsafe.Pointer(enc)), (*C.char)(unsafe.Pointer(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 = amfEncodeNamedString(enc, pend, &av_tcUrl, &r.Link.tcUrl)
|
enc = (*byte)(unsafe.Pointer(C.AMF_EncodeNamedString((*C.char)(
|
||||||
|
unsafe.Pointer(enc)), (*C.char)(unsafe.Pointer(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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if r.Link.protocol&RTMP_FEATURE_WRITE == 0 {
|
if r.Link.protocol&RTMP_FEATURE_WRITE == 0 {
|
||||||
// TODO: port this
|
enc = (*byte)(unsafe.Pointer(C.AMF_EncodeNamedBoolean((*C.char)(
|
||||||
enc = amfEncodeNamedBoolean(enc, pend, &av_fpad, 0)
|
unsafe.Pointer(enc)), (*C.char)(unsafe.Pointer(pend)), &av_fpad, 0)))
|
||||||
|
// enc = amfEncodeNamedBoolean(enc, pend, &av_fpad, 0)
|
||||||
if enc == nil {
|
if enc == nil {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
enc = amfEncodeNamedNumber(enc, pend, &av_capabilities, 15.0)
|
enc = (*byte)(unsafe.Pointer(C.AMF_EncodeNamedNumber((*C.char)(
|
||||||
|
unsafe.Pointer(enc)), (*C.char)(unsafe.Pointer(pend)), &av_capabilities, 15.0)))
|
||||||
|
//enc = amfEncodeNamedNumber(enc, pend, &av_capabilities, 15.0)
|
||||||
if enc == nil {
|
if enc == nil {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
enc = amfEncodeNamedNumber(enc, pend, &av_audioCodecs, float64(r.m_fAudioCodecs))
|
enc = (*byte)(unsafe.Pointer(C.AMF_EncodeNamedNumber((*C.char)(
|
||||||
|
unsafe.Pointer(enc)), (*C.char)(unsafe.Pointer(pend)), &av_audioCodecs, r.m_fAudioCodecs)))
|
||||||
|
//enc = amfEncodeNamedNumber(enc, pend, &av_audioCodecs, float64(r.m_fAudioCodecs))
|
||||||
if enc == nil {
|
if enc == nil {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
enc = amfEncodeNamedNumber(enc, pend, &av_videoCodecs, float64(r.m_fVideoCodecs))
|
enc = (*byte)(unsafe.Pointer(C.AMF_EncodeNamedNumber((*C.char)(
|
||||||
|
unsafe.Pointer(enc)), (*C.char)(unsafe.Pointer(pend)), &av_videoCodecs, r.m_fVideoCodecs)))
|
||||||
|
//enc = amfEncodeNamedNumber(enc, pend, &av_videoCodecs, float64(r.m_fVideoCodecs))
|
||||||
if enc == nil {
|
if enc == nil {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
enc = amfEncodeNamedNumber(enc, pend, &av_videoFunction, 1.0)
|
enc = (*byte)(unsafe.Pointer(C.AMF_EncodeNamedNumber((*C.char)(
|
||||||
|
unsafe.Pointer(enc)), (*C.char)(unsafe.Pointer(pend)), &av_videoFunction, 1.0)))
|
||||||
|
//enc = amfEncodeNamedNumber(enc, pend, &av_videoFunction, 1.0)
|
||||||
if enc == nil {
|
if enc == nil {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
if r.Link.pageUrl.av_len != 0 {
|
if r.Link.pageUrl.av_len != 0 {
|
||||||
enc = amfEncodeNamedString(enc, pend, &av_pageUrl, &r.Link.pageUrl)
|
enc = (*byte)(unsafe.Pointer(C.AMF_EncodeNamedString((*C.char)(
|
||||||
|
unsafe.Pointer(enc)), (*C.char)(unsafe.Pointer(pend)), &av_pageUrl, &r.Link.pageUrl)))
|
||||||
|
//enc = amfEncodeNamedString(enc, pend, &av_pageUrl, &r.Link.pageUrl)
|
||||||
if enc == nil {
|
if enc == nil {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
@ -1030,7 +1054,9 @@ func sendConnectPacket(r *C.RTMP, cp *C.RTMPPacket) int {
|
||||||
}
|
}
|
||||||
|
|
||||||
if r.m_fEncoding != 0.0 || r.m_bSendEncoding != 0 {
|
if r.m_fEncoding != 0.0 || r.m_bSendEncoding != 0 {
|
||||||
enc = amfEncodeNamedNumber(enc, pend, &av_objectEncoding, float64(r.m_fEncoding))
|
enc = (*byte)(unsafe.Pointer(C.AMF_EncodeNamedNumber((*C.char)(
|
||||||
|
unsafe.Pointer(enc)), (*C.char)(unsafe.Pointer(pend)), &av_objectEncoding, r.m_fEncoding)))
|
||||||
|
//enc = amfEncodeNamedNumber(enc, pend, &av_objectEncoding, float64(r.m_fEncoding))
|
||||||
if enc == nil {
|
if enc == nil {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
@ -1050,12 +1076,15 @@ func sendConnectPacket(r *C.RTMP, cp *C.RTMPPacket) int {
|
||||||
|
|
||||||
/* add auth string */
|
/* add auth string */
|
||||||
if r.Link.auth.av_len != 0 {
|
if r.Link.auth.av_len != 0 {
|
||||||
// TODO: port this
|
enc = (*byte)(unsafe.Pointer(C.AMF_EncodeBoolean((*C.char)(
|
||||||
enc = amfEncodeBoolean(enc, pend, int(r.Link.lFlags&RTMP_LF_AUTH))
|
unsafe.Pointer(enc)), (*C.char)(unsafe.Pointer(pend)), r.Link.lFlags&RTMP_LF_AUTH)))
|
||||||
|
//enc = amfEncodeBoolean(enc, pend, int(r.Link.lFlags&RTMP_LF_AUTH))
|
||||||
if enc == nil {
|
if enc == nil {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
enc = amfEncodeString(enc, (*byte)(pend), &r.Link.auth)
|
enc = (*byte)(unsafe.Pointer(C.AMF_EncodeString((*C.char)(unsafe.Pointer(enc)),
|
||||||
|
(*C.char)(unsafe.Pointer(pend)), &r.Link.auth)))
|
||||||
|
//enc = amfEncodeString(enc, (*byte)(pend), &r.Link.auth)
|
||||||
if enc == nil {
|
if enc == nil {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
@ -1077,7 +1106,8 @@ func sendConnectPacket(r *C.RTMP, cp *C.RTMPPacket) int {
|
||||||
packet.m_nBodySize = C.uint32_t(int(uintptr(decBytePtr(unsafe.Pointer(enc),
|
packet.m_nBodySize = C.uint32_t(int(uintptr(decBytePtr(unsafe.Pointer(enc),
|
||||||
int(uintptr(unsafe.Pointer(packet.m_body)))))))
|
int(uintptr(unsafe.Pointer(packet.m_body)))))))
|
||||||
|
|
||||||
return rtmpSendPacket(r, &packet, 1)
|
return int(C.RTMP_SendPacket(r, &packet, 1))
|
||||||
|
// return rtmpSendPacket(r, &packet, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
func rtmpConnectStream(r *C.RTMP, seekTime int32) int {
|
func rtmpConnectStream(r *C.RTMP, seekTime int32) int {
|
||||||
|
|
Loading…
Reference in New Issue