Changed name of rtmpConnect to C_RTMP_Connect

This commit is contained in:
saxon 2018-08-07 12:12:11 +09:30
parent 2a26a0d625
commit 2e6baaf732
1 changed files with 15 additions and 15 deletions

View File

@ -430,7 +430,7 @@ func startSession(rtmp *C.RTMP, u string, timeout uint32) (*C.RTMP, error) {
//C.RTMP_EnableWrite(rtmp)
C_RTMP_SetBufferMS(rtmp, 3600*1000)
//C.RTMP_SetBufferMS(rtmp, 3600*1000)
if rtmpConnect(rtmp, nil) == 0 {
if C_RTMP_Connect(rtmp, nil) == 0 {
//if C.RTMP_Connect(rtmp, nil) == 0 {
//C.RTMP_Close(rtmp)
//C.RTMP_Free(rtmp)
@ -438,7 +438,7 @@ func startSession(rtmp *C.RTMP, u string, timeout uint32) (*C.RTMP, error) {
}
// TODO: port this
// if rtmpConnectStream(rtmp, 0) == 0 {
// if C_RTMP_ConnectStream(rtmp, 0) == 0 {
if C.RTMP_ConnectStream(rtmp, 0) == 0 {
//C.RTMP_Close(rtmp)
//C.RTMP_Free(rtmp)
@ -654,7 +654,7 @@ func C_RTMP_SetBufferMS(r *C.RTMP, size int32) {
r.m_nBufferMS = C.int(size)
}
func rtmpConnect(r *C.RTMP, cp *C.RTMPPacket) int {
func C_RTMP_Connect(r *C.RTMP, cp *C.RTMPPacket) int {
// TODO: port this
var service C.sockaddr_in
@ -680,17 +680,17 @@ func rtmpConnect(r *C.RTMP, cp *C.RTMPPacket) int {
}
}
//if C.RTMP_Connect0(r, (*C.sockaddr)(unsafe.Pointer(&service))) == 0 {
if rtmpConnect0(r, (*C.sockaddr)(unsafe.Pointer(&service))) == 0 {
if C_RTMP_Connect0(r, (*C.sockaddr)(unsafe.Pointer(&service))) == 0 {
return 0
}
r.m_bSendCounter = 1
return int(rtmpConnect1(r, cp))
return int(C_RTMP_Connect1(r, cp))
//return int(C.RTMP_Connect1(r, cp))
}
func rtmpConnect0(r *C.RTMP, service *C.sockaddr) int {
func C_RTMP_Connect0(r *C.RTMP, service *C.sockaddr) int {
on := 1
r.m_sb.sb_timedout = 0
r.m_pausing = 0
@ -700,21 +700,21 @@ func rtmpConnect0(r *C.RTMP, service *C.sockaddr) int {
if r.m_sb.sb_socket != -1 {
if C.connect(r.m_sb.sb_socket, service, C.socklen_t(unsafe.Sizeof(*service))) < 0 {
log.Println("rtmpConnect0, failed to connect socket.")
log.Println("C_RTMP_Connect0, failed to connect socket.")
}
if r.Link.socksport != 0 {
if debugMode {
log.Println("rtmpConnect0: socks negotiation.")
log.Println("C_RTMP_Connect0: socks negotiation.")
}
if C.SocksNegotiate(r) == 0 {
log.Println("rtmpConnect0: SOCKS negotiation failed.")
log.Println("C_RTMP_Connect0: SOCKS negotiation failed.")
return 0
}
}
} else {
log.Println("rtmpConnect0: failed to create socket.")
log.Println("C_RTMP_Connect0: failed to create socket.")
return 0
}
@ -723,7 +723,7 @@ func rtmpConnect0(r *C.RTMP, service *C.sockaddr) int {
if C.setsockopt(r.m_sb.sb_socket, C.SOL_SOCKET, C.SO_RCVTIMEO,
unsafe.Pointer(&tv), C.socklen_t(unsafe.Sizeof(tv))) != 0 {
log.Println("rtmpConnect0: Setting socket timeout failed")
log.Println("C_RTMP_Connect0: Setting socket timeout failed")
}
}
@ -733,13 +733,13 @@ func rtmpConnect0(r *C.RTMP, service *C.sockaddr) int {
return 1
}
func rtmpConnect1(r *C.RTMP, cp *C.RTMPPacket) int {
func C_RTMP_Connect1(r *C.RTMP, cp *C.RTMPPacket) int {
if debugMode {
log.Println("... connected, handshaking...")
}
//if C.HandShake(r, 1) == 0 {
if handShake(r, 1) == 0 {
log.Println("rtmpConnect1: handshake failed!")
log.Println("C_RTMP_Connect1: handshake failed!")
return 0
}
if debugMode {
@ -1252,7 +1252,7 @@ func amfEncodeArray(obj *C.AMFObject, pBuffer *byte, pBufEnd *byte) *byte {
return pBuffer
}
func rtmpConnectStream(r *C.RTMP, seekTime int32) int {
func C_RTMP_ConnectStream(r *C.RTMP, seekTime int32) int {
var packet C.RTMPPacket
memset((*byte)(unsafe.Pointer(&packet)), 0, int(unsafe.Sizeof(packet)))
@ -1275,7 +1275,7 @@ func rtmpConnectStream(r *C.RTMP, seekTime int32) int {
if packet.m_packetType == RTMP_PACKET_TYPE_AUDIO ||
packet.m_packetType == RTMP_PACKET_TYPE_VIDEO ||
packet.m_packetType == RTMP_PACKET_TYPE_INFO {
log.Println("rtmpConnectStream: got packet before play()! Ignoring.")
log.Println("C_RTMP_ConnectStream: got packet before play()! Ignoring.")
C.RTMPPacket_Free(&packet)
continue
}