代码拉取完成,页面将自动刷新
package sip
import (
"bytes"
"encoding/xml"
"gitee.com/slh1992/plugin-sip/utils"
"golang.org/x/net/html/charset"
)
type LiveType int
type ExecType int
const (
LIVE_STREAM_PUSH LiveType = iota
LIVE_CDN_PUSH
ExecStop ExecType = iota
ExecPlay
)
func (l LiveType) String() string {
switch l {
case LIVE_STREAM_PUSH:
return "LIVE_STREAM_PUSH"
case LIVE_CDN_PUSH:
return "LIVE_CDN_PUSH"
}
return "LIVE_UNKNOWN"
}
func (e ExecType) String() string {
switch e {
case ExecStop:
return "ExecStop"
case ExecPlay:
return "ExecPlay"
}
return "ExecUnknown"
}
type CmdCdnLiver struct {
XMLName xml.Name `xml:"Control"`
CmdType string
DeviceID string
SN string
LiveType LiveType //直播类型: 0:流媒体推流 1:CDN推流
ExecCmd ExecType // 执行类型: 0:stop 1:start
Endtimes uint64 //结束时间
StreamId string //流ID
}
type CmdCdnLiveResult struct {
XMLName xml.Name `xml:"Reponse"`
CmdType string
DeviceID string
SN string
Result string
Extends string //扩展数据
}
func (c *CmdCdnLiver) String() string {
xmlStr, err := XmlMashal(c)
if err != nil {
return ""
}
return xmlStr
}
func (c *CmdCdnLiver) Decode(data string) error {
decoder := xml.NewDecoder(bytes.NewReader([]byte(data)))
decoder.CharsetReader = charset.NewReaderLabel
err := decoder.Decode(c)
if err != nil {
err = utils.DecodeGbk(c, []byte(data))
if err != nil {
return err
}
}
return nil
}
func (r *CmdCdnLiveResult) String() string {
xmlStr, err := XmlMashal(r)
if err != nil {
return ""
}
return xmlStr
}
func (r *CmdCdnLiveResult) Decode(data string) error {
decoder := xml.NewDecoder(bytes.NewReader([]byte(data)))
decoder.CharsetReader = charset.NewReaderLabel
err := decoder.Decode(r)
if err != nil {
err = utils.DecodeGbk(r, []byte(data))
if err != nil {
return err
}
}
return nil
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。