Documentation
¶
Overview ¶
Package gohlslib is a HLS client and muxer library for the Go programming language.
Examples are available at https://github.com/bluenviron/gohlslib/tree/main/examples
Index ¶
- type Client
- type LogFunc
- type LogLevel
- type Muxer
- func (m *Muxer) Close()
- func (m *Muxer) File(name string, msn string, part string, skip string) *MuxerFileResponse
- func (m *Muxer) Start() error
- func (m *Muxer) WriteAudio(ntp time.Time, pts time.Duration, au []byte) error
- func (m *Muxer) WriteH26x(ntp time.Time, pts time.Duration, au [][]byte) error
- type MuxerFileResponse
- type MuxerVariant
- type Track
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
//
// Parameters (all optional except URI)
//
// URI of the playlist.
URI string
// if the playlist certificate is self-signed
// or invalid, you can provide the fingerprint of the certificate in order to
// validate it anyway. It can be obtained by running:
// openssl s_client -connect source_ip:source_port </dev/null 2>/dev/null | sed -n '/BEGIN/,/END/p' > server.crt
// openssl x509 -in server.crt -noout -fingerprint -sha256 | cut -d "=" -f2 | tr -d ':'
Fingerprint string
// function that receives log messages.
// It defaults to log.Printf.
Log LogFunc
// contains filtered or unexported fields
}
Client is a HLS client.
type Muxer ¶
type Muxer struct {
//
// parameters (all optional except VideoTrack or AudioTrack).
//
// video track.
VideoTrack *Track
// audio track.
AudioTrack *Track
// Variant to use.
// It defaults to MuxerVariantLowLatency
Variant MuxerVariant
// Number of HLS segments to keep on the server.
// Segments allow to seek through the stream.
// Their number doesn't influence latency.
// It defaults to 7.
SegmentCount int
// Minimum duration of each segment.
// A player usually puts 3 segments in a buffer before reproducing the stream.
// The final segment duration is also influenced by the interval between IDR frames,
// since the server changes the duration in order to include at least one IDR frame
// in each segment.
// It defaults to 1sec.
SegmentDuration time.Duration
// Minimum duration of each part.
// Parts are used in Low-Latency HLS in place of segments.
// A player usually puts 3 parts in a buffer before reproducing the stream.
// Part duration is influenced by the distance between video/audio samples
// and is adjusted in order to produce segments with a similar duration.
// It defaults to 200ms.
PartDuration time.Duration
// Maximum size of each segment.
// This prevents RAM exhaustion.
// It defaults to 50MB.
SegmentMaxSize uint64
// Directory in which to save segments.
// This decreases performance, since saving segments on disk is less performant
// than saving them on RAM, but allows to preserve RAM.
Directory string
// contains filtered or unexported fields
}
Muxer is a HLS muxer.
func (*Muxer) WriteAudio ¶
WriteAudio writes an audio access unit.
type MuxerFileResponse ¶
type MuxerFileResponse struct {
Status int
Header map[string]string
Body io.ReadCloser
}
MuxerFileResponse is a response of the Muxer's File() func. Body must always be closed.
type MuxerVariant ¶
type MuxerVariant int
MuxerVariant is a muxer variant.
const ( MuxerVariantMPEGTS MuxerVariant = iota + 1 MuxerVariantFMP4 MuxerVariantLowLatency )
supported variants.
Source Files
¶
- client.go
- client_downloader_primary.go
- client_downloader_stream.go
- client_processor_fmp4.go
- client_processor_fmp4_track.go
- client_processor_mpegts.go
- client_processor_mpegts_track.go
- client_routine_pool.go
- client_segment_queue.go
- client_timesync_fmp4.go
- client_timesync_mpegts.go
- muxer.go
- muxer_media_playlist.go
- muxer_part.go
- muxer_segment.go
- muxer_segment_fmp4.go
- muxer_segment_mpegts.go
- muxer_segmenter.go
- muxer_segmenter_fmp4.go
- muxer_segmenter_mpegts.go
- track.go
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
client
command
|
|
|
playlist-parser
command
|
|
|
pkg
|
|
|
codecparams
Package codecparams contains utilities to deal with codec parameters.
|
Package codecparams contains utilities to deal with codec parameters. |
|
codecs
Package codecs contains codec definitions.
|
Package codecs contains codec definitions. |
|
fmp4
Package fmp4 contains a fMP4 reader and writer.
|
Package fmp4 contains a fMP4 reader and writer. |
|
playlist
Package playlist contains a M3U8 playlist decoder and encoder.
|
Package playlist contains a M3U8 playlist decoder and encoder. |
|
playlist/primitives
Package primitives contains playlist primitives.
|
Package primitives contains playlist primitives. |
|
storage
Package storage contains the storage mechanism of segments and parts.
|
Package storage contains the storage mechanism of segments and parts. |
Click to show internal directories.
Click to hide internal directories.