pubsub

package
v0.0.0-...-3db39ed Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 11, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Packege pubsub implements publisher-subscribers model used in multi-channel streaming.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Queue

type Queue struct {
	// contains filtered or unexported fields
}

One publisher and multiple subscribers thread-safe packet buffer queue.

func NewQueue

func NewQueue() *Queue

func (*Queue) Close

func (self *Queue) Close() (err error)

After Close() called, all QueueCursor's ReadPacket will return io.EOF.

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 (self *Queue) SetMaxGopCount(n int)

func (*Queue) WriteHeader

func (self *Queue) WriteHeader(streams []av.CodecData) error

func (*Queue) WritePacket

func (self *Queue) WritePacket(pkt av.Packet) (err error)

Put packet into buffer, old packets will be discared.

func (*Queue) WriteTrailer

func (self *Queue) WriteTrailer() error

type QueueCursor

type QueueCursor struct {
	// contains filtered or unexported fields
}

func (*QueueCursor) ReadPacket

func (self *QueueCursor) ReadPacket() (pkt av.Packet, err error)

ReadPacket will not consume packets in Queue, it's just a cursor.

func (*QueueCursor) Streams

func (self *QueueCursor) Streams() (streams []av.CodecData, err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL