Documentation ¶
Overview ¶
Packege pubsub implements publisher-subscribers model used in multi-channel streaming.
Index ¶
- type Buf
- type BufPos
- type Packet
- type Queue
- func (self *Queue) Close() (err error)
- func (self *Queue) DelayedGopCount(n int) *QueueCursor
- func (self *Queue) DelayedTime(dur time.Duration) *QueueCursor
- func (self *Queue) GetSize() int
- func (self *Queue) Latest() *QueueCursor
- func (self *Queue) Oldest() *QueueCursor
- func (self *Queue) SetMaxGopCount(n int)
- func (self *Queue) WriteHeader(streams []Stream) error
- func (self *Queue) WritePacket(pkt Packet) (err error)
- func (self *Queue) WriteTrailer() error
- type QueueCursor
- type Stream
- type Timeline
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Buf ¶
func (*Buf) IsValidPos ¶
type Packet ¶
type Packet struct { Packet *rtp.Packet IsAudio bool // packet is audio IsVideo bool // packet is video IsKeyFrame bool // video packet is key frame Idx int8 // stream index in container format Codec string // codec name CompositionTime time.Duration // packet presentation time minus decode time for H264 B-Frame Time time.Duration // packet decode time Data []byte // packet data }
Packet represents an RTP Packet
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
One publisher and multiple subscribers thread-safe packet buffer queue.
func (*Queue) DelayedGopCount ¶
func (self *Queue) DelayedGopCount(n int) *QueueCursor
Create cursor position at specific delayed GOP count in buffered packets.
func (*Queue) DelayedTime ¶
func (self *Queue) DelayedTime(dur time.Duration) *QueueCursor
Create cursor position at specific time in buffered packets.
func (*Queue) Latest ¶
func (self *Queue) Latest() *QueueCursor
Create cursor position at latest packet.
func (*Queue) Oldest ¶
func (self *Queue) Oldest() *QueueCursor
Create cursor position at oldest buffered packet.
func (*Queue) SetMaxGopCount ¶
func (*Queue) WriteHeader ¶
func (*Queue) WritePacket ¶
Put packet into buffer, old packets will be discared.
func (*Queue) WriteTrailer ¶
type QueueCursor ¶
type QueueCursor struct {
// contains filtered or unexported fields
}
func (*QueueCursor) ReadPacket ¶
func (self *QueueCursor) ReadPacket() (pkt Packet, err error)
ReadPacket will not consume packets in Queue, it's just a cursor.
func (*QueueCursor) Streams ¶
func (self *QueueCursor) Streams() (streams []Stream, err error)
type Stream ¶
type Stream struct { // The name of the stream. Name string // The URL of the stream. URL string // Is the stream a video stream. IsVideo bool // Is the stream a audio stream. IsAudio bool // The width of the stream. Width int // The height of the stream. Height int // Num is the numerator of the framerate. Num int // Denum is the denominator of the framerate. Denum int // FPS is the framerate of the stream. FPS float64 // For H264, this is the sps. SPS []byte // For H264, this is the pps. PPS []byte // For H265, this is the vps. VPS []byte // IsBackChannel is true if this stream is a back channel. IsBackChannel bool }
Click to show internal directories.
Click to hide internal directories.