hls

package
v0.0.0-...-7a1402c Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2022 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

Package hls contains a HLS muxer and client implementation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is a HLS client.

func NewClient

func NewClient(
	playlistURLStr string,
	fingerprint string,
	onTracks func(*gortsplib.TrackH264, *gortsplib.TrackMPEG4Audio) error,
	onVideoData func(time.Duration, [][]byte),
	onAudioData func(time.Duration, []byte),
	logger ClientLogger,
) (*Client, error)

NewClient allocates a Client.

func (*Client) Close

func (c *Client) Close()

Close closes all the Client resources.

func (*Client) Wait

func (c *Client) Wait() chan error

Wait waits for any error of the Client.

type ClientLogger

type ClientLogger interface {
	Log(level logger.Level, format string, args ...interface{})
}

ClientLogger allows to receive log lines.

type Muxer

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

Muxer is a HLS muxer.

func NewMuxer

func NewMuxer(
	variant MuxerVariant,
	segmentCount int,
	segmentDuration time.Duration,
	partDuration time.Duration,
	segmentMaxSize uint64,
	videoTrack *gortsplib.TrackH264,
	audioTrack *gortsplib.TrackMPEG4Audio,
) (*Muxer, error)

NewMuxer allocates a Muxer.

func (*Muxer) Close

func (m *Muxer) Close()

Close closes a Muxer.

func (*Muxer) File

func (m *Muxer) File(name string, msn string, part string, skip string) *MuxerFileResponse

File returns a file reader.

func (*Muxer) WriteAAC

func (m *Muxer) WriteAAC(ntp time.Time, pts time.Duration, au []byte) error

WriteAAC writes AAC AUs, grouped by timestamp.

func (*Muxer) WriteH264

func (m *Muxer) WriteH264(ntp time.Time, pts time.Duration, nalus [][]byte) error

WriteH264 writes H264 NALUs, grouped by timestamp.

type MuxerFileResponse

type MuxerFileResponse struct {
	Status int
	Header map[string]string
	Body   io.Reader
}

MuxerFileResponse is a response of the Muxer's File() func.

type MuxerVariant

type MuxerVariant int

MuxerVariant is a muxer variant.

const (
	MuxerVariantMPEGTS MuxerVariant = iota
	MuxerVariantFMP4
	MuxerVariantLowLatency
)

supported variants.

Directories

Path Synopsis
Package fmp4 contains a fMP4 reader and writer.
Package fmp4 contains a fMP4 reader and writer.
Package m3u8 contains a M3U8 parser.
Package m3u8 contains a M3U8 parser.
Package mpegts contains a MPEG-TS reader and writer.
Package mpegts contains a MPEG-TS reader and writer.
Package mpegtstimedec contains a MPEG-TS timestamp decoder.
Package mpegtstimedec contains a MPEG-TS timestamp decoder.

Jump to

Keyboard shortcuts

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