mirror of https://bitbucket.org/ausocean/av.git
Started commenting functions to indicate name and location of C versions
This commit is contained in:
parent
16c769a411
commit
e4cd61b663
40
rtmp/rtmp.go
40
rtmp/rtmp.go
|
@ -423,6 +423,8 @@ func (s *session) Write(data []byte) (int, error) {
|
||||||
return len(data), nil
|
return len(data), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// int RTMP_IsConnected(RTMP *r);
|
||||||
|
// rtmp.c +363
|
||||||
func C_RTMP_IsConnected(r *C.RTMP) int32 {
|
func C_RTMP_IsConnected(r *C.RTMP) int32 {
|
||||||
if r.m_sb.sb_socket != -1 {
|
if r.m_sb.sb_socket != -1 {
|
||||||
return 1
|
return 1
|
||||||
|
@ -437,7 +439,7 @@ func startSession(rtmp *C.RTMP, u string, timeout uint32) (*C.RTMP, error) {
|
||||||
C_RTMP_Init(rtmp)
|
C_RTMP_Init(rtmp)
|
||||||
//C.RTMP_Init(rtmp)
|
//C.RTMP_Init(rtmp)
|
||||||
rtmp.Link.timeout = connect_timeout
|
rtmp.Link.timeout = connect_timeout
|
||||||
if C_RTMP_SetupUrl(rtmp, u) == 0 {
|
if C_RTMP_SetupURL(rtmp, u) == 0 {
|
||||||
// if C.RTMP_SetupURL(rtmp, C.CString(u)) == 0 {
|
// if C.RTMP_SetupURL(rtmp, C.CString(u)) == 0 {
|
||||||
//C.RTMP_Close(rtmp)
|
//C.RTMP_Close(rtmp)
|
||||||
//C.RTMP_Free(rtmp)
|
//C.RTMP_Free(rtmp)
|
||||||
|
@ -465,12 +467,17 @@ func startSession(rtmp *C.RTMP, u string, timeout uint32) (*C.RTMP, error) {
|
||||||
|
|
||||||
return rtmp, nil
|
return rtmp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RTMP* RTMP_IsConnected();
|
||||||
|
// rtmp.c +317
|
||||||
func C_RTMP_Alloc() *C.RTMP {
|
func C_RTMP_Alloc() *C.RTMP {
|
||||||
var r C.RTMP
|
var r C.RTMP
|
||||||
//return (*C.RTMP)(C.malloc(C.size_t(unsafe.Sizeof(r))))
|
//return (*C.RTMP)(C.malloc(C.size_t(unsafe.Sizeof(r))))
|
||||||
return (*C.RTMP)(allocate(unsafe.Sizeof(r)))
|
return (*C.RTMP)(allocate(unsafe.Sizeof(r)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// void RTMP_Init(RTMP *r);
|
||||||
|
// rtmp.c +329
|
||||||
func C_RTMP_Init(r *C.RTMP) {
|
func C_RTMP_Init(r *C.RTMP) {
|
||||||
r.m_sb.sb_socket = -1
|
r.m_sb.sb_socket = -1
|
||||||
r.m_inChunkSize = RTMP_DEFAULT_CHUNKSIZE
|
r.m_inChunkSize = RTMP_DEFAULT_CHUNKSIZE
|
||||||
|
@ -485,7 +492,9 @@ func C_RTMP_Init(r *C.RTMP) {
|
||||||
r.Link.swfAge = 30
|
r.Link.swfAge = 30
|
||||||
}
|
}
|
||||||
|
|
||||||
func C_RTMP_SetupUrl(r *C.RTMP, u string) int32 {
|
// int RTMP_SetupURL(RTMP *r, char* url);
|
||||||
|
// rtmp.c +757
|
||||||
|
func C_RTMP_SetupURL(r *C.RTMP, u string) int32 {
|
||||||
url := goStrToCStr(u)
|
url := goStrToCStr(u)
|
||||||
|
|
||||||
var ret, len int32
|
var ret, len int32
|
||||||
|
@ -554,6 +563,8 @@ func C_RTMP_SetupUrl(r *C.RTMP, u string) int32 {
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// void SocksSetup(RTMP *r, AVal* sockshost);
|
||||||
|
// rtmp.c +410
|
||||||
func C_SocksSetup(r *C.RTMP, sockshost *C.AVal) {
|
func C_SocksSetup(r *C.RTMP, sockshost *C.AVal) {
|
||||||
if sockshost.av_len != 0 {
|
if sockshost.av_len != 0 {
|
||||||
socksport := strchr((*byte)(unsafe.Pointer(sockshost.av_val)), ':')
|
socksport := strchr((*byte)(unsafe.Pointer(sockshost.av_val)), ':')
|
||||||
|
@ -664,14 +675,20 @@ func closeInternal(r *C.RTMP, reconnect int32) {
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// void RTMP_EnableWrite(RTMP *r);
|
||||||
|
// rtmp.c +351
|
||||||
func C_RTMP_EnableWrite(r *C.RTMP) {
|
func C_RTMP_EnableWrite(r *C.RTMP) {
|
||||||
r.Link.protocol |= RTMP_FEATURE_WRITE
|
r.Link.protocol |= RTMP_FEATURE_WRITE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// void RTMP_SetBufferMS(RTMP *r, int size);
|
||||||
|
// rtmp.c +381
|
||||||
func C_RTMP_SetBufferMS(r *C.RTMP, size int32) {
|
func C_RTMP_SetBufferMS(r *C.RTMP, size int32) {
|
||||||
r.m_nBufferMS = C.int(size)
|
r.m_nBufferMS = C.int(size)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// int RTMP_Connect(RTMP *r, RTMPPacket* cp);
|
||||||
|
// rtmp.c +1032
|
||||||
func C_RTMP_Connect(r *C.RTMP, cp *C.RTMPPacket) int {
|
func C_RTMP_Connect(r *C.RTMP, cp *C.RTMPPacket) int {
|
||||||
// TODO: port this
|
// TODO: port this
|
||||||
var service C.sockaddr_in
|
var service C.sockaddr_in
|
||||||
|
@ -708,7 +725,8 @@ func C_RTMP_Connect(r *C.RTMP, cp *C.RTMPPacket) int {
|
||||||
//return int(C.RTMP_Connect1(r, cp))
|
//return int(C.RTMP_Connect1(r, cp))
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
// int RTMP_Connect0(RTMP *r, struct sockaddr* service);
|
||||||
|
// rtmp.c +906
|
||||||
func C_RTMP_Connect0(r *C.RTMP, service *C.sockaddr) int {
|
func C_RTMP_Connect0(r *C.RTMP, service *C.sockaddr) int {
|
||||||
on := 1
|
on := 1
|
||||||
r.m_sb.sb_timedout = 0
|
r.m_sb.sb_timedout = 0
|
||||||
|
@ -752,6 +770,8 @@ func C_RTMP_Connect0(r *C.RTMP, service *C.sockaddr) int {
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// int RTMP_Connect1(RTMP* r, RTMPPacket* cp);
|
||||||
|
// rtmp.c +978
|
||||||
func C_RTMP_Connect1(r *C.RTMP, cp *C.RTMPPacket) int {
|
func C_RTMP_Connect1(r *C.RTMP, cp *C.RTMPPacket) int {
|
||||||
if debugMode {
|
if debugMode {
|
||||||
log.Println("... connected, handshaking...")
|
log.Println("... connected, handshaking...")
|
||||||
|
@ -772,6 +792,8 @@ func C_RTMP_Connect1(r *C.RTMP, cp *C.RTMPPacket) int {
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// int HandShake(RTMP* r, int FP9HandShake);
|
||||||
|
// rtmp.c +3744
|
||||||
func C_HandShake(r *C.RTMP, FP9HandShake int32) int {
|
func C_HandShake(r *C.RTMP, FP9HandShake int32) int {
|
||||||
var bMatch int
|
var bMatch int
|
||||||
//uptime := uint32(0)
|
//uptime := uint32(0)
|
||||||
|
@ -845,6 +867,8 @@ func C_HandShake(r *C.RTMP, FP9HandShake int32) int {
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// int ReadN(RTMP* r, char* buffer, int n);
|
||||||
|
// rtmp.c +1390
|
||||||
func C_ReadN(r *C.RTMP, buffer *byte, n int) int {
|
func C_ReadN(r *C.RTMP, buffer *byte, n int) int {
|
||||||
nOriginalSize := n
|
nOriginalSize := n
|
||||||
var avail int
|
var avail int
|
||||||
|
@ -860,7 +884,7 @@ func C_ReadN(r *C.RTMP, buffer *byte, n int) int {
|
||||||
|
|
||||||
avail = int(r.m_sb.sb_size)
|
avail = int(r.m_sb.sb_size)
|
||||||
if avail == 0 {
|
if avail == 0 {
|
||||||
if C_RTMP_SockBuffFill(&r.m_sb) < 1 {
|
if C_RTMPSockBuf_Fill(&r.m_sb) < 1 {
|
||||||
// if C.RTMPSockBuf_Fill(&r.m_sb) < 1 {
|
// if C.RTMPSockBuf_Fill(&r.m_sb) < 1 {
|
||||||
if r.m_sb.sb_timedout == 0 {
|
if r.m_sb.sb_timedout == 0 {
|
||||||
return 0
|
return 0
|
||||||
|
@ -904,7 +928,9 @@ func C_ReadN(r *C.RTMP, buffer *byte, n int) int {
|
||||||
return nOriginalSize - n
|
return nOriginalSize - n
|
||||||
}
|
}
|
||||||
|
|
||||||
func C_RTMP_SockBuffFill(sb *C.RTMPSockBuf) int {
|
// int RTMPSockBuf_Fill(RTMPSockBuf* sb);
|
||||||
|
// rtmp.c +4253
|
||||||
|
func C_RTMPSockBuf_Fill(sb *C.RTMPSockBuf) int {
|
||||||
var nBytes int
|
var nBytes int
|
||||||
|
|
||||||
if sb.sb_size == 0 {
|
if sb.sb_size == 0 {
|
||||||
|
@ -923,13 +949,15 @@ func C_RTMP_SockBuffFill(sb *C.RTMPSockBuf) int {
|
||||||
if nBytes != -1 {
|
if nBytes != -1 {
|
||||||
sb.sb_size += C.int(nBytes)
|
sb.sb_size += C.int(nBytes)
|
||||||
} else {
|
} else {
|
||||||
log.Println("C_RTMP_SockBuffFill: recv error!")
|
log.Println("C_RTMPSockBuf_Fill: recv error!")
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
return nBytes
|
return nBytes
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// int SendBytesReceived(RTMP* r);
|
||||||
|
// rtmp.c +2080
|
||||||
func C_SendBytesReceived(r *C.RTMP) int {
|
func C_SendBytesReceived(r *C.RTMP) int {
|
||||||
var packet C.RTMPPacket
|
var packet C.RTMPPacket
|
||||||
var pbuf [256]byte
|
var pbuf [256]byte
|
||||||
|
|
Loading…
Reference in New Issue