pubsub

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package 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
}

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

func NewQueue

func NewQueue() *Queue

NewQueue func

func (*Queue) Close

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

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

func (*Queue) DelayedGopCount

func (instance *Queue) DelayedGopCount(n int) *QueueCursor

DelayedGopCount Create cursor position at specific delayed GOP count in buffered packets.

func (*Queue) DelayedTime

func (instance *Queue) DelayedTime(dur time.Duration) *QueueCursor

DelayedTime Create cursor position at specific time in buffered packets.

func (*Queue) Latest

func (instance *Queue) Latest() *QueueCursor

Latest Create cursor position at latest packet.

func (*Queue) Oldest

func (instance *Queue) Oldest() *QueueCursor

Oldest Create cursor position at oldest buffered packet.

func (*Queue) SetMaxGopCount

func (instance *Queue) SetMaxGopCount(n int)

SetMaxGopCount func

func (*Queue) WriteHeader

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

WriteHeader func

func (*Queue) WritePacket

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

WritePacket Put packet into buffer, old packets will be discared.

func (*Queue) WriteTrailer

func (instance *Queue) WriteTrailer() error

WriteTrailer func

type QueueCursor

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

QueueCursor struct

func (*QueueCursor) ReadPacket

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

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

func (*QueueCursor) Streams

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

Streams func

Jump to

Keyboard shortcuts

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