Documentation ¶
Index ¶
- Constants
- Variables
- func RTSPServer()
- func RTSPServerClientHandle(conn net.Conn)
- func RTSPServerClientPlay(uuid string, channel string, conn net.Conn)
- func RTSPServerClientResponse(uuid string, channel string, conn net.Conn, status int, ...) error
- func RemoteAuthorization(proto string, stream string, channel string, token string, ip string) bool
- func StatusText(code int) string
- func StreamServerRunStream(streamID string, channelID string, opt *ChannelST) (int, error)
- func StreamServerRunStreamDo(streamID string, channelID string)
- func StreamServerRunStreamRTMP(streamID string, channelID string, opt *ChannelST) (int, error)
- type AuthorizationReq
- type AuthorizationRes
- type ChannelST
- type ClientST
- type EventRemoveList
- type EventUpdateList
- type Fragment
- type Media
- type MuxerHLS
- func (element *MuxerHLS) Close()
- func (element *MuxerHLS) GetFragment(segment int, fragment int) ([]*av.Packet, error)
- func (element *MuxerHLS) GetIndexM3u8(needMSN int, needPart int) (string, error)
- func (element *MuxerHLS) GetSegment(segment int) ([]*av.Packet, error)
- func (element *MuxerHLS) NewSegment() *Segment
- func (element *MuxerHLS) PlaylistUpdate()
- func (element *MuxerHLS) SetFPS(fps int)
- func (element *MuxerHLS) SortFragment(val map[int]*Fragment) []int
- func (element *MuxerHLS) SortSegments(val map[int]*Segment) []int
- func (element *MuxerHLS) UpdateIndexM3u8()
- func (element *MuxerHLS) WaitFragment(timeOut time.Duration, segment, fragment int) ([]*av.Packet, error)
- func (element *MuxerHLS) WaitIndex(timeOut time.Duration, segment, fragment int) (string, error)
- func (element *MuxerHLS) WritePacket(packet *av.Packet)
- type Segment
- func (element *Segment) Close()
- func (element *Segment) FragmentMS(fps int) int64
- func (element *Segment) GetDuration() time.Duration
- func (element *Segment) GetFragmentID() int
- func (element *Segment) NewFragment() *Fragment
- func (element *Segment) SetFPS(fps int)
- func (element *Segment) WritePacket(packet *av.Packet)
- type SegmentOld
- type ServerST
- type StorageST
- func (obj *StorageST) ClientAdd(streamID string, channelID string, mode int) (string, chan *av.Packet, chan *[]byte, error)
- func (obj *StorageST) ClientDelete(streamID string, cid string, channelID string)
- func (obj *StorageST) ClientHas(streamID string, channelID string) bool
- func (obj *StorageST) HLSMuxerClose(uuid string, channelID string)
- func (obj *StorageST) HLSMuxerFragment(uuid string, channelID string, segment, fragment int) ([]*av.Packet, error)
- func (obj *StorageST) HLSMuxerM3U8(uuid string, channelID string, msn, part int) (string, error)
- func (obj *StorageST) HLSMuxerSegment(uuid string, channelID string, segment int) ([]*av.Packet, error)
- func (obj *StorageST) HlsMuxerSetFPS(uuid string, channelID string, fps int)
- func (obj *StorageST) HlsMuxerWritePacket(uuid string, channelID string, packet *av.Packet)
- func (obj *StorageST) MarshalledStreamsList() (interface{}, error)
- func (obj *StorageST) NewHLSMuxer(uuid string, channelID string)
- func (obj *StorageST) SaveConfig() error
- func (obj *StorageST) ServerHTTPDebug() bool
- func (obj *StorageST) ServerHTTPDemo() bool
- func (obj *StorageST) ServerHTTPDir() string
- func (obj *StorageST) ServerHTTPLogin() string
- func (obj *StorageST) ServerHTTPPassword() string
- func (obj *StorageST) ServerHTTPPort() string
- func (obj *StorageST) ServerHTTPS() bool
- func (obj *StorageST) ServerHTTPSAutoTLSEnable() bool
- func (obj *StorageST) ServerHTTPSAutoTLSName() string
- func (obj *StorageST) ServerHTTPSCert() string
- func (obj *StorageST) ServerHTTPSKey() string
- func (obj *StorageST) ServerHTTPSPort() string
- func (obj *StorageST) ServerICECredential() string
- func (obj *StorageST) ServerICEServers() []string
- func (obj *StorageST) ServerICEUsername() string
- func (obj *StorageST) ServerRTSPPort() string
- func (obj *StorageST) ServerTokenBackend() string
- func (obj *StorageST) ServerTokenEnable() bool
- func (obj *StorageST) ServerWebRTCPortMax() uint16
- func (obj *StorageST) ServerWebRTCPortMin() uint16
- func (obj *StorageST) StopAll()
- func (obj *StorageST) StreamAdd(uuid string, val StreamST) error
- func (obj *StorageST) StreamChannelAdd(uuid string, channelID string, val ChannelST) error
- func (obj *StorageST) StreamChannelCast(key string, channelID string, val *av.Packet)
- func (obj *StorageST) StreamChannelCastProxy(key string, channelID string, val *[]byte)
- func (obj *StorageST) StreamChannelCodecs(streamID string, channelID string) ([]av.CodecData, error)
- func (obj *StorageST) StreamChannelCodecsUpdate(streamID string, channelID string, val []av.CodecData, sdp []byte)
- func (obj *StorageST) StreamChannelControl(key string, channelID string) (*ChannelST, error)
- func (obj *StorageST) StreamChannelDelete(uuid string, channelID string) error
- func (obj *StorageST) StreamChannelEdit(uuid string, channelID string, val ChannelST) error
- func (obj *StorageST) StreamChannelExist(streamID string, channelID string) bool
- func (obj *StorageST) StreamChannelInfo(uuid string, channelID string) (*ChannelST, error)
- func (obj *StorageST) StreamChannelMake(val ChannelST) ChannelST
- func (obj *StorageST) StreamChannelReload(uuid string, channelID string) error
- func (obj *StorageST) StreamChannelRun(streamID string, channelID string)
- func (obj *StorageST) StreamChannelRunAll()
- func (obj *StorageST) StreamChannelSDP(streamID string, channelID string) ([]byte, error)
- func (obj *StorageST) StreamChannelStatus(key string, channelID string, val int)
- func (obj *StorageST) StreamChannelUnlock(streamID string, channelID string)
- func (obj *StorageST) StreamDelete(uuid string) error
- func (obj *StorageST) StreamEdit(uuid string, val StreamST) error
- func (obj *StorageST) StreamHLSAdd(uuid string, channelID string, val []*av.Packet, dur time.Duration)
- func (obj *StorageST) StreamHLSFlush(uuid string, channelID string)
- func (obj *StorageST) StreamHLSTS(uuid string, channelID string, seq int) ([]*av.Packet, error)
- func (obj *StorageST) StreamHLSm3u8(uuid string, channelID string) (string, int, error)
- func (obj *StorageST) StreamInfo(uuid string) (*StreamST, error)
- func (obj *StorageST) StreamReload(uuid string) error
- type StreamST
- type Token
Constants ¶
const ( StatusContinue = 100 StatusOK = 200 StatusCreated = 201 StatusLowOnStorageSpace = 250 StatusMultipleChoices = 300 StatusMovedPermanently = 301 StatusMovedTemporarily = 302 StatusSeeOther = 303 StatusNotModified = 304 StatusUseProxy = 305 StatusBadRequest = 400 StatusPaymentRequired = 402 StatusForbidden = 403 StatusNotFound = 404 StatusMethodNotAllowed = 405 StatusNotAcceptable = 406 StatusProxyAuthenticationRequired = 407 StatusRequestTimeout = 408 StatusGone = 410 StatusLengthRequired = 411 StatusPreconditionFailed = 412 StatusRequestEntityTooLarge = 413 StatusRequestURITooLong = 414 StatusUnsupportedMediaType = 415 StatusInvalidparameter = 451 StatusIllegalConferenceIdentifier = 452 StatusNotEnoughBandwidth = 453 StatusSessionNotFound = 454 StatusMethodNotValidInThisState = 455 StatusHeaderFieldNotValid = 456 StatusInvalidRange = 457 StatusParameterIsReadOnly = 458 StatusAggregateOperationNotAllowed = 459 StatusOnlyAggregateOperationAllowed = 460 StatusUnsupportedTransport = 461 StatusDestinationUnreachable = 462 StatusInternalServerError = 500 StatusNotImplemented = 501 StatusBadGateway = 502 StatusGatewayTimeout = 504 StatusRTSPVersionNotSupported = 505 StatusOptionNotsupport = 551 )
RTSP response status codes
const ( MSE = iota WEBRTC RTSP )
Default stream type
const ( OFFLINE = iota ONLINE )
Default stream status type
const ( SignalStreamRestart = iota ///< Y Restart SignalStreamStop SignalStreamClient )
Default streams signals
Variables ¶
var ( Version = "RTSP/1.0" UserAgent = "Lavf58.29.100" Session = "000a959d6816" )
var ( OPTIONS = "OPTIONS" DESCRIBE = "DESCRIBE" SETUP = "SETUP" PLAY = "PLAY" TEARDOWN = "TEARDOWN" )
var ( ErrorStreamNotFound = apperr.ErrorWithCode("STREAM_NOT_FOUND", "stream not found", apperr.ErrNotFound) ErrorStreamAlreadyExists = apperr.ErrorWithCode("STREAM_ALREADY_EXISTS", "stream already exists", apperr.ErrInvalidRequest) ErrorStreamChannelAlreadyExists = apperr.ErrorWithCode("STREAM_CHANNEL_ALREADY_EXISTS", "stream channel already exists", apperr.ErrInvalidRequest) ErrorStreamNotHLSSegments = apperr.ErrorWithCode("STREAM_HLS_NOT_TS_SEQ_FOUND", "stream hls not ts seq found", apperr.ErrNotFound) ErrorStreamNoVideo = apperr.ErrorWithCode("STREAM_NO_VIDEO", "stream no video", apperr.ErrNotFound) ErrorStreamNoClients = apperr.ErrorWithCode("STREAM_NO_CLIENTS", "stream no clients", apperr.ErrNotFound) ErrorStreamRestart = apperr.ErrorWithCode("STREAM_RESTART", "stream restart", apperr.ErrInternal) ErrorStreamStopCoreSignal = apperr.ErrorWithCode("STREAM_STOP_CORE_SIGNAL", "stream stop core signal", apperr.ErrInternal) ErrorStreamStopRTSPSignal = apperr.ErrorWithCode("STREAM_STOP_RTSP_SIGNAL", "stream stop rtsp signal", apperr.ErrInternal) ErrorStreamChannelNotFound = apperr.ErrorWithCode("STREAM_CHANNEL_NOT_FOUND", "stream channel not found", apperr.ErrNotFound) ErrorStreamChannelCodecNotFound = apperr.ErrorWithCode("STREAM_CHANNEL_CODEC_NOT_READY,_POSSIBLE_STREAM_OFFLINE", "stream channel codec not ready, possible stream offline", apperr.ErrInternal) ErrorStreamsLen0 = apperr.ErrorWithCode("STREAMS_LEN_ZERO", "streams len zero", apperr.ErrInternal) )
Default stream errors
var (
//Default www static file dir
DefaultHTTPDir = "static_source/media"
)
var Storage = NewStreamCore()
Functions ¶
func RTSPServerClientHandle ¶
RTSPServerClientHandle func
func RTSPServerClientPlay ¶
handleRTSPServerPlay func
func RTSPServerClientResponse ¶
func RTSPServerClientResponse(uuid string, channel string, conn net.Conn, status int, headers map[string]string) error
handleRTSPServerPlay func
func RemoteAuthorization ¶
func StatusText ¶
func StreamServerRunStream ¶
StreamServerRunStream core stream
func StreamServerRunStreamDo ¶
StreamServerRunStreamDo stream run do mux
Types ¶
type AuthorizationReq ¶
type AuthorizationRes ¶
type AuthorizationRes struct {
Status string `json:"status,omitempty"`
}
type ChannelST ¶
type ChannelST struct { Name string `json:"name,omitempty" groups:"api,config"` URL string `json:"url,omitempty" groups:"api,config"` OnDemand bool `json:"on_demand,omitempty" groups:"api,config"` Debug bool `json:"debug,omitempty" groups:"api,config"` Status int `json:"status,omitempty" groups:"api"` InsecureSkipVerify bool `json:"insecure_skip_verify,omitempty" groups:"api,config"` Audio bool `json:"audio,omitempty" groups:"api,config"` // contains filtered or unexported fields }
type ClientST ¶
type ClientST struct {
// contains filtered or unexported fields
}
ClientST client storage section
type EventRemoveList ¶
type EventRemoveList struct {
Name string `json:"name"`
}
type EventUpdateList ¶
type Fragment ¶
type Fragment struct { Independent bool //Fragment have i-frame (key frame) Finish bool //Fragment Ready Duration time.Duration //Fragment Duration Packets []*av.Packet //Packet Slice }
Fragment struct
func (*Fragment) GetDuration ¶
GetDuration return fragment dur
func (*Fragment) WritePacket ¶
WritePacket to fragment func
type MuxerHLS ¶
type MuxerHLS struct { UUID string //Current UUID MSN int //Current MSN FPS int //Current FPS MediaSequence int //Current MediaSequence CurrentFragmentID int //Current fragment id CacheM3U8 string //Current index cache CurrentSegment *Segment //Current segment link Segments map[int]*Segment //Current segments group FragmentCtx context.Context //chan 1-N FragmentCancel context.CancelFunc //chan 1-N // contains filtered or unexported fields }
MuxerHLS struct
func (*MuxerHLS) GetFragment ¶
GetFragment func
func (*MuxerHLS) GetIndexM3u8 ¶
GetIndexM3u8 func
func (*MuxerHLS) GetSegment ¶
GetSegment func
func (*MuxerHLS) SortFragment ¶
SortFragment func
func (*MuxerHLS) SortSegments ¶
SortSegments fuc
func (*MuxerHLS) WaitFragment ¶
func (element *MuxerHLS) WaitFragment(timeOut time.Duration, segment, fragment int) ([]*av.Packet, error)
WaitFragment func
func (*MuxerHLS) WritePacket ¶
WritePacket func
type Segment ¶
type Segment struct { FPS int //Current fps CurrentFragment *Fragment //CurrentFragment link CurrentFragmentID int //CurrentFragment ID Finish bool //Segment Ready Duration time.Duration //Segment Duration Time time.Time //Realtime EXT-X-PROGRAM-DATE-TIME Fragment map[int]*Fragment //Fragment map }
Segment struct
func (*Segment) NewFragment ¶
NewFragment open new fragment
func (*Segment) WritePacket ¶
WritePacket func
type SegmentOld ¶
type SegmentOld struct {
// contains filtered or unexported fields
}
SegmentOld HLS cache section
type ServerST ¶
type ServerST struct { Debug bool `json:"debug" groups:"api,config"` //LogLevel logrus.Level `json:"log_level" groups:"api,config"` HTTPDemo bool `json:"http_demo" groups:"api,config"` HTTPDebug bool `json:"http_debug" groups:"api,config"` HTTPLogin string `json:"http_login" groups:"api,config"` HTTPPassword string `json:"http_password" groups:"api,config"` HTTPDir string `json:"http_dir" groups:"api,config"` HTTPPort string `json:"http_port" groups:"api,config"` RTSPPort string `json:"rtsp_port" groups:"api,config"` HTTPS bool `json:"https" groups:"api,config"` HTTPSPort string `json:"https_port" groups:"api,config"` HTTPSCert string `json:"https_cert" groups:"api,config"` HTTPSKey string `json:"https_key" groups:"api,config"` HTTPSAutoTLSEnable bool `json:"https_auto_tls" groups:"api,config"` HTTPSAutoTLSName string `json:"https_auto_tls_name" groups:"api,config"` ICEServers []string `json:"ice_servers" groups:"api,config"` ICEUsername string `json:"ice_username" groups:"api,config"` ICECredential string `json:"ice_credential" groups:"api,config"` Token Token `json:"token,omitempty" groups:"api,config"` WebRTCPortMin uint16 `json:"webrtc_port_min" groups:"api,config"` WebRTCPortMax uint16 `json:"webrtc_port_max" groups:"api,config"` }
ServerST server storage section
type StorageST ¶
type StorageST struct { Server ServerST `json:"server" groups:"api,config"` Streams map[string]StreamST `json:"streams,omitempty" groups:"api,config"` ChannelDefaults ChannelST `json:"channel_defaults,omitempty" groups:"api,config"` // contains filtered or unexported fields }
StorageST main storage struct
func (*StorageST) ClientAdd ¶
func (obj *StorageST) ClientAdd(streamID string, channelID string, mode int) (string, chan *av.Packet, chan *[]byte, error)
ClientAdd Add New Client to Translations
func (*StorageST) ClientDelete ¶
ClientDelete Delete Client
func (*StorageST) HLSMuxerClose ¶
HLSMuxerClose close muxer
func (*StorageST) HLSMuxerFragment ¶
func (obj *StorageST) HLSMuxerFragment(uuid string, channelID string, segment, fragment int) ([]*av.Packet, error)
HLSMuxerFragment get fragment
func (*StorageST) HLSMuxerM3U8 ¶
HLSMuxerM3U8 get m3u8 list
func (*StorageST) HLSMuxerSegment ¶
func (obj *StorageST) HLSMuxerSegment(uuid string, channelID string, segment int) ([]*av.Packet, error)
HLSMuxerSegment get segment
func (*StorageST) HlsMuxerSetFPS ¶
HlsMuxerSetFPS write packet
func (*StorageST) HlsMuxerWritePacket ¶
HlsMuxerWritePacket write packet
func (*StorageST) MarshalledStreamsList ¶
MarshalledStreamsList lists all streams and includes only fields which are safe to serialize.
func (*StorageST) NewHLSMuxer ¶
NewHLSMuxer new muxer init
func (*StorageST) ServerHTTPDebug ¶
ServerHTTPDebug read debug options
func (*StorageST) ServerHTTPDemo ¶
ServerHTTPDemo read demo options
func (*StorageST) ServerHTTPLogin ¶
ServerHTTPLogin read Login options
func (*StorageST) ServerHTTPPassword ¶
ServerHTTPPassword read Password options
func (*StorageST) ServerHTTPPort ¶
ServerHTTPPort read HTTP Port options
func (*StorageST) ServerHTTPS ¶
ServerHTTPS read HTTPS Port options
func (*StorageST) ServerHTTPSAutoTLSEnable ¶
ServerHTTPSAutoTLSEnable read HTTPS Port options
func (*StorageST) ServerHTTPSAutoTLSName ¶
ServerHTTPSAutoTLSName read HTTPS Port options
func (*StorageST) ServerHTTPSCert ¶
ServerHTTPSCert read HTTPS Cert options
func (*StorageST) ServerHTTPSKey ¶
ServerHTTPSKey read HTTPS Key options
func (*StorageST) ServerHTTPSPort ¶
ServerHTTPSPort read HTTPS Port options
func (*StorageST) ServerICECredential ¶
ServerICEServers read ICE credential
func (*StorageST) ServerICEServers ¶
ServerICEServers read ICE servers
func (*StorageST) ServerICEUsername ¶
ServerICEServers read ICE username
func (*StorageST) ServerRTSPPort ¶
ServerRTSPPort read HTTP Port options
func (*StorageST) ServerTokenBackend ¶
ServerTokenBackend read HTTPS Key options
func (*StorageST) ServerTokenEnable ¶
ServerTokenEnable read HTTPS Key options
func (*StorageST) ServerWebRTCPortMax ¶
ServerWebRTCPortMax read WebRTC Port Max
func (*StorageST) ServerWebRTCPortMin ¶
ServerWebRTCPortMin read WebRTC Port Min
func (*StorageST) StreamChannelAdd ¶
StreamChannelAdd add stream
func (*StorageST) StreamChannelCast ¶
StreamChannelCast broadcast stream
func (*StorageST) StreamChannelCastProxy ¶
StreamChannelCastProxy broadcast stream
func (*StorageST) StreamChannelCodecs ¶
func (obj *StorageST) StreamChannelCodecs(streamID string, channelID string) ([]av.CodecData, error)
StreamChannelCodecs get stream codec storage or wait
func (*StorageST) StreamChannelCodecsUpdate ¶
func (obj *StorageST) StreamChannelCodecsUpdate(streamID string, channelID string, val []av.CodecData, sdp []byte)
StreamChannelCodecsUpdate update stream codec storage
func (*StorageST) StreamChannelControl ¶
StreamChannelControl get stream
func (*StorageST) StreamChannelDelete ¶
StreamChannelDelete stream
func (*StorageST) StreamChannelEdit ¶
StreamEdit edit stream
func (*StorageST) StreamChannelExist ¶
StreamChannelExist check stream exist
func (*StorageST) StreamChannelInfo ¶
StreamInfo return stream info
func (*StorageST) StreamChannelMake ¶
StreamChannelMake check stream exist
func (*StorageST) StreamChannelReload ¶
StreamChannelReload reload stream
func (*StorageST) StreamChannelRun ¶
StreamChannelRun one stream and lock
func (*StorageST) StreamChannelRunAll ¶
func (obj *StorageST) StreamChannelRunAll()
StreamChannelRunAll run all stream go
func (*StorageST) StreamChannelSDP ¶
StreamChannelSDP codec storage or wait
func (*StorageST) StreamChannelStatus ¶
StreamChannelStatus change stream status
func (*StorageST) StreamChannelUnlock ¶
StreamChannelUnlock unlock status to no lock
func (*StorageST) StreamDelete ¶
StreamDelete stream
func (*StorageST) StreamEdit ¶
StreamEdit edit stream
func (*StorageST) StreamHLSAdd ¶
func (obj *StorageST) StreamHLSAdd(uuid string, channelID string, val []*av.Packet, dur time.Duration)
StreamHLSAdd add hls seq to buffer
func (*StorageST) StreamHLSFlush ¶
StreamHLSFlush delete hls cache
func (*StorageST) StreamHLSTS ¶
StreamHLSTS send hls segment buffer to clients
func (*StorageST) StreamHLSm3u8 ¶
StreamHLSm3u8 get hls m3u8 list
func (*StorageST) StreamInfo ¶
StreamInfo return stream info
func (*StorageST) StreamReload ¶
StreamReload reload stream