Documentation
¶
Overview ¶
Package protocol provides URL-based protocol detection and media stream utilities.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsPushListen ¶
IsPushListen returns true when the URL signals that the server should accept incoming encoder connections (push mode) for a stream.
Two forms are recognised:
publish:// — the preferred, protocol-agnostic form. Encoders may push via RTMP or SRT; the stream code is the only routing key needed.
Legacy wildcard-host form — rtmp://0.0.0.0:port/... or srt://0.0.0.0:port/... Still recognised for backward compatibility.
Examples:
publish:// → true (preferred) rtmp://0.0.0.0:1935 → true (legacy) srt://0.0.0.0:9999 → true (legacy) rtmp://server.com → false (remote pull source)
func SplitTSPackets ¶
SplitTSPackets splits a raw byte slice into 188-byte MPEG-TS packets. Incomplete trailing bytes are discarded.
Types ¶
type Kind ¶
type Kind string
Kind classifies a stream URL into a transport category used internally by the ingestor to choose the right reader implementation.
const ( KindUDP Kind = "udp" // raw MPEG-TS over UDP (unicast or multicast) KindHLS Kind = "hls" // HLS playlist pull over HTTP/HTTPS KindFile Kind = "file" // local filesystem path KindRTMP Kind = "rtmp" // RTMP / RTMPS (pull or push-listen) KindRTSP Kind = "rtsp" // RTSP pull KindSRT Kind = "srt" // SRT (pull caller or push listener) KindPublish Kind = "publish" // accept any push protocol; stream code is the routing key KindUnknown Kind = "unknown" )
Kind constants classify ingest URLs; see Detect.
func Detect ¶
Detect returns the protocol Kind for the given URL. All classification is done purely from the scheme and URL structure — the caller never needs to specify the protocol manually.
rtmp://... → KindRTMP rtmps://... → KindRTMP srt://... → KindSRT udp://... → KindUDP rtsp:// or rtsps://... → KindRTSP http(s)://...*.m3u8 → KindHLS file:// or /absolute/path → KindFile publish:// → KindPublish (push-listen, any protocol)