sub

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsMoqMINamespace added in v0.8.0

func IsMoqMINamespace(ns []string) bool

IsMoqMINamespace reports whether the given namespace tuple identifies a moq-mi (MoQ Media Interop) namespace, by convention on the first segment.

Types

type CENC

type CENC struct {
	Key         []byte
	DecryptInfo map[string]mp4.DecryptInfo // keyed by track name
}

CENC holds decryption state for encrypted tracks.

type CmafMux

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

CmafMux multiplexes video and audio CMAF tracks into a single output.

func NewCmafMux

func NewCmafMux(w io.Writer) *CmafMux

NewCmafMux creates a new CMAF multiplexer writing to w.

func (*CmafMux) AddInit

func (m *CmafMux) AddInit(initData string, contentType string) error

AddInit adds an init segment for the given content type (video or audio).

func (*CmafMux) MuxSample

func (m *CmafMux) MuxSample(sample []byte, mediaType string) error

MuxSample muxes a CMAF media segment into the output.

type Handler

type Handler struct {
	Namespace    []string
	Outs         map[string]io.Writer
	Logfh        io.Writer
	VideoName    string
	AudioName    string
	SubsName     string
	UseFetch     bool
	AcceptAny    bool   // Accept any announced namespace
	Discover     bool   // Discovery mode: list namespaces and exit
	CatalogTrack string // Catalog track name (default "catalog")
	// contains filtered or unexported fields
}

Handler handles MoQ subscriber sessions. It subscribes to a catalog, selects tracks, and reads media data.

func (*Handler) RunWithConn

func (h *Handler) RunWithConn(ctx context.Context, conn moqtransport.Connection) error

RunWithConn sets up the mux (if Outs["mux"] is set) and runs the subscriber session on the given connection.

type LOCAACWriter added in v0.8.0

type LOCAACWriter struct {
	W             io.Writer
	SampleRate    int  // from catalog samplerate field
	ChannelConfig byte // from catalog channelConfig field
	ObjectType    byte // from codec string "mp4a.40.N" -> N (must be 2 / AAC-LC)
}

LOCAACWriter converts LOC AAC objects (raw AAC frames) to ADTS-framed AAC. The resulting output is playable with: ffplay file.aac

Only AAC-LC (mp4a.40.2) is supported — ADTS header construction via mp4ff/aac rejects other object types.

func NewLOCAACWriter added in v0.8.0

func NewLOCAACWriter(w io.Writer, codec string, sampleRate int, channelConfig string) (*LOCAACWriter, error)

NewLOCAACWriter creates a LOCAACWriter from catalog track fields. codec is e.g. "mp4a.40.2", sampleRate e.g. 44100, channelConfig e.g. "2". Returns an error if the codec is not AAC-LC.

func (*LOCAACWriter) Write added in v0.8.0

func (lw *LOCAACWriter) Write(payload []byte) error

Write prepends a 7-byte ADTS header to the raw AAC frame and writes it.

type LOCOpusWriter added in v0.8.0

type LOCOpusWriter struct {
	W io.Writer
}

LOCOpusWriter writes raw LOC Opus packets directly. Raw Opus packets without a container are not directly playable but useful for debugging.

func (*LOCOpusWriter) Write added in v0.8.0

func (lw *LOCOpusWriter) Write(payload []byte) error

Write writes the raw Opus payload.

type LOCVideoWriter added in v0.8.0

type LOCVideoWriter struct {
	W io.Writer
}

LOCVideoWriter converts LOC AVC video objects (length-prefixed NALUs) to AnnexB H.264 format by replacing 4-byte length prefixes with start codes. The resulting output is playable with: ffplay -f h264 file.h264

func (*LOCVideoWriter) Write added in v0.8.0

func (lw *LOCVideoWriter) Write(payload []byte) error

Write converts a LOC AVC payload to AnnexB format and writes it.

Jump to

Keyboard shortcuts

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