stream-server/rtmp/connect.go

37 lines
846 B
Go

package rtmp
import "fmt"
func NegotiateConnect(chnk_wrp_ptr *ChunkWrapper) (bool) {
if err := chnk_wrp_ptr.ReadPeerChunkSize(); err != nil {
return false
}
if err := chnk_wrp_ptr.ReadConnectCommand(); err != nil {
return false
}
if err := chnk_wrp_ptr.WriteWindowAckSize(); err != nil {
return false
}
if err := chnk_wrp_ptr.WritePeerBandwidth(); err != nil {
return false
}
if err := chnk_wrp_ptr.WriteChunkSize(); err != nil {
return false
}
if err := chnk_wrp_ptr.WriteConnectResponse(); err != nil {
return false
}
return true
}
func CreateStream(chnk_wrp_ptr *ChunkWrapper) (bool) {
if _, err := chnk_wrp_ptr.ReadChunk(); err != nil {
return false
}
if _, err := chnk_wrp_ptr.ReadChunk(); err != nil {
return false
}
full_msg_ptr, _ := chnk_wrp_ptr.ReadChunk()
fmt.Println(full_msg_ptr)
return true
}