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 ¶
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
// HTTP client.
// It defaults to http.DefaultClient.
HTTPClient *http.Client
// 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) Handle ¶ added in v0.2.0
func (m *Muxer) Handle(w http.ResponseWriter, r *http.Request)
Handle handles a HTTP request.
func (*Muxer) WriteAudio ¶
WriteAudio writes an audio access unit.
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_part.go
- muxer_segment.go
- muxer_segment_fmp4.go
- muxer_segment_mpegts.go
- muxer_segmenter.go
- muxer_segmenter_fmp4.go
- muxer_segmenter_mpegts.go
- muxer_server.go
- track.go
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
client
command
|
|
|
muxer
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.