mirror of https://bitbucket.org/ausocean/av.git
rtmp: port C_SendFCUnpublish
This commit is contained in:
parent
b7c148fd93
commit
8674b23b28
54
rtmp/rtmp.go
54
rtmp/rtmp.go
|
@ -114,6 +114,7 @@ var (
|
|||
av_playlist_ready = AVC("playlist_ready")
|
||||
av_set_playlist = AVC("set_playlist")
|
||||
av_FCPublish = AVC("FCPublish")
|
||||
av_FCUnpublish = AVC("FCUnpublish")
|
||||
av_live = AVC("live")
|
||||
)
|
||||
|
||||
|
@ -954,37 +955,36 @@ func C_SendFCPublish(r *C_RTMP) int32 {
|
|||
// int SendFCUnpublish(RTMP *r);
|
||||
// rtmp.c +1875
|
||||
func C_SendFCUnpublish(r *C_RTMP) int32 {
|
||||
// TODO finish porting
|
||||
/*
|
||||
var packet C_RTMPPacket
|
||||
var pbuf [1024]byte
|
||||
var pend []byte = pbuf[1024:]
|
||||
var enc []byte
|
||||
var packet C_RTMPPacket
|
||||
var pbuf [1024]byte
|
||||
var pend *byte = (*byte)(unsafe.Pointer(uintptr(unsafe.Pointer(&pbuf[0])) +
|
||||
unsafe.Sizeof(pbuf)))
|
||||
var enc *byte
|
||||
|
||||
packet.m_nChannel = 0x03
|
||||
packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM
|
||||
packet.m_packetType = RTMP_PACKET_TYPE_INVOKE
|
||||
packet.m_nTimeStamp = 0
|
||||
packet.m_nInfoField2 = 0
|
||||
packet.m_hasAbsTimestamp = 0
|
||||
packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE
|
||||
packet.m_nChannel = 0x03 /* control channel (invoke) */
|
||||
packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM
|
||||
packet.m_packetType = RTMP_PACKET_TYPE_INVOKE
|
||||
packet.m_nTimeStamp = 0
|
||||
packet.m_nInfoField2 = 0
|
||||
packet.m_hasAbsTimestamp = 0
|
||||
packet.m_body = &pbuf[RTMP_MAX_HEADER_SIZE]
|
||||
|
||||
// NOTE use of unsafe pointer will be remove here when packet.m_nBody becomes []byte
|
||||
enc = []byte(unsafe.Pointer(packet.m_nBody))
|
||||
enc = C_AMF_EncodeString((*byte)(unsafe.Pointer(&enc[0])),
|
||||
(*byte)(unsafe.Pointer(&pend[0])), &av_FCUnpublish)
|
||||
r.m_numInvokes++
|
||||
enc = C_AMF_EncodeNumber(enc, pend, r->m_numInvokes);
|
||||
*enc++ = AMF_NULL;
|
||||
enc = AMF_EncodeString(enc, pend, &r->Link.playpath);
|
||||
if (!enc)
|
||||
return FALSE;
|
||||
enc = (*byte)(unsafe.Pointer(packet.m_body))
|
||||
enc = C_AMF_EncodeString(enc, pend, &av_FCUnpublish)
|
||||
r.m_numInvokes++
|
||||
enc = C_AMF_EncodeNumber(enc, pend, float64(r.m_numInvokes))
|
||||
*enc = AMF_NULL
|
||||
enc = (*byte)(incBytePtr(unsafe.Pointer(enc), 1))
|
||||
enc = C_AMF_EncodeString(enc, pend, &r.Link.playpath)
|
||||
|
||||
packet.m_nBodySize = enc - packet.m_body;
|
||||
if enc == nil {
|
||||
return 0
|
||||
}
|
||||
|
||||
return RTMP_SendPacket(r, &packet, FALSE);
|
||||
*/
|
||||
return 0
|
||||
packet.m_nBodySize = uint32(uintptr(unsafe.Pointer(enc)) - uintptr(
|
||||
unsafe.Pointer(packet.m_body)))
|
||||
|
||||
return int32(C_RTMP_SendPacket(r, &packet, 0))
|
||||
}
|
||||
|
||||
// int SendPublish(RTMP* r);
|
||||
|
|
Loading…
Reference in New Issue