Documentation
¶
Index ¶
- Constants
- Variables
- func Count() (sc, cc int)
- func Regist(s *Stream)
- func RegistPullStreamFactory(f PullStreamFactory)
- func Unregist(s *Stream)
- func UnregistAll()
- type CID
- type Consumer
- type ConsumptionInfo
- type Hlsable
- type Multicastable
- type Option
- type Pack
- type PacketType
- type PullStreamFactory
- type Stream
- func (s *Stream) Attr(key string) string
- func (s *Stream) Close() error
- func (s *Stream) ConsumerCount() int
- func (s *Stream) FlvTypeFlags() byte
- func (s *Stream) GetConsumption(cid CID) (ConsumptionInfo, bool)
- func (s *Stream) Hlsable() Hlsable
- func (s *Stream) Info(includeCS bool) *StreamInfo
- func (s *Stream) Multicastable() Multicastable
- func (s *Stream) Path() string
- func (s *Stream) Sdp() string
- func (s *Stream) StartConsume(consumer Consumer, packetType PacketType, extra string) CID
- func (s *Stream) StartConsumeNoGopCache(consumer Consumer, packetType PacketType, extra string) CID
- func (s *Stream) StopConsume(cid CID)
- func (s *Stream) WriteFlvTag(tag *flv.Tag) error
- func (s *Stream) WriteFrame(frame *codec.Frame) error
- func (s *Stream) WriteRtpPacket(packet *rtp.Packet) error
- type StreamInfo
Constants ¶
View Source
const ( StreamOK int32 = iota StreamClosed // 源关闭 StreamReplaced // 流被替换 StreamNoConsumer )
流状态
Variables ¶
View Source
var ( // ErrStreamClosed 流被关闭 ErrStreamClosed = errors.New("stream is closed") // ErrStreamReplaced 流被替换 ErrStreamReplaced = errors.New("stream is replaced") )
错误定义
Functions ¶
func RegistPullStreamFactory ¶
func RegistPullStreamFactory(f PullStreamFactory)
RegistPullStreamFactory 注册拉流工厂
Types ¶
type ConsumptionInfo ¶
type ConsumptionInfo struct { ID uint32 `json:"id"` StartOn string `json:"start_on"` PacketType string `json:"packet_type"` Extra string `json:"extra"` Flow stats.FlowSample `json:"flow"` // 转换成 K }
ConsumptionInfo 消费者信息
type Hlsable ¶
type Hlsable interface { M3u8(token string) ([]byte, error) Segment(seq int) (io.Reader, int, error) LastAccessTime() time.Time }
Hlsable 支持Hls访问
type Multicastable ¶
type Multicastable interface { AddMember(io.Closer) ReleaseMember(io.Closer) MulticastIP() string Port(index int) int TTL() int SourceIP() string }
Multicastable 支持组播模式的源
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option 配置 Stream 的选项接口
type PacketType ¶
type PacketType uint32
PacketType 消费媒体包类型
const ( RTPPacket PacketType = iota // 根据 RTP 协议打包的媒体 FLVPacket )
预定义消费媒体包类型
type PullStreamFactory ¶
type PullStreamFactory interface { Can(remoteURL string) bool Create(localPath, remoteURL string) (*Stream, error) }
PullStreamFactory 拉流工程流
type Stream ¶
type Stream struct { Video codec.VideoMeta Audio codec.AudioMeta // contains filtered or unexported fields }
Stream 媒体流
func (*Stream) GetConsumption ¶
func (s *Stream) GetConsumption(cid CID) (ConsumptionInfo, bool)
GetConsumption 获取指定消费信息
func (*Stream) Multicastable ¶
func (s *Stream) Multicastable() Multicastable
Multicastable 返回组播支持能力,不支持返回nil
func (*Stream) StartConsume ¶
func (s *Stream) StartConsume(consumer Consumer, packetType PacketType, extra string) CID
StartConsume 开始消费
func (*Stream) StartConsumeNoGopCache ¶
func (s *Stream) StartConsumeNoGopCache(consumer Consumer, packetType PacketType, extra string) CID
StartConsumeNoGopCache 开始消费,不使用GopCahce
type StreamInfo ¶
type StreamInfo struct { StartOn string `json:"start_on"` Path string `json:"path"` Addr string `json:"addr"` Size int `json:"size"` Video *codec.VideoMeta `json:"video,omitempty"` Audio *codec.AudioMeta `json:"audio,omitempty"` ConsumptionCount int `json:"cc"` Consumptions []ConsumptionInfo `json:"cs,omitempty"` }
StreamInfo 流信息
Source Files
¶
Click to show internal directories.
Click to hide internal directories.