pubsub

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2024 License: MIT Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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