pub

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: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MediaPriority = 128
)

Variables

This section is empty.

Functions

func PublishLOCTrack added in v0.8.0

func PublishLOCTrack(ctx context.Context, publisher moqtransport.Publisher, asset *internal.Asset, trackName string)

PublishLOCTrack publishes LOC media track data (one raw frame per object) in MoQ groups, pacing delivery to wall-clock time. Each object carries a LOC Timestamp property (draft-ietf-moq-loc-02 §2.3.1.1) with the sample presentation time in microseconds since the Unix epoch.

func PublishMoqMITrack added in v0.8.0

func PublishMoqMITrack(ctx context.Context, publisher moqtransport.Publisher,
	asset *internal.Asset, assetTrackName, moqmiTrackName string)

PublishMoqMITrack publishes a single track using the moq-mi wire format (draft-cenzano-moq-media-interop-03). It attaches moqmi extension headers to every object and uses the codec-specific grouping rules:

  • Video (H.264 AVCC): one group per GOP (IDR-bounded), object 0 of each group carries the AVCDecoderConfigurationRecord in extension 0x0D.
  • Audio (AAC-LC, Opus): one group per audio frame, single object per group.

Payloads are the codec bitstream as defined by moqmi (AVCC length-prefixed NALUs for H.264, raw Opus packets, AAC raw_data_block).

func PublishSubtitleTrack

func PublishSubtitleTrack(ctx context.Context, publisher moqtransport.Publisher, st *internal.SubtitleTrack)

PublishSubtitleTrack publishes subtitle track data in MoQ groups, pacing delivery to wall-clock time.

func PublishTrack

func PublishTrack(ctx context.Context, publisher moqtransport.Publisher, asset *internal.Asset, trackName string)

PublishTrack publishes media track data in MoQ groups, pacing delivery to wall-clock time.

func ResolveMoqMITrack added in v0.8.0

func ResolveMoqMITrack(m MoqMITrackMap, moqmiName string) string

ResolveMoqMITrack maps a moqmi-convention track name to an asset track name. Returns "" if the moqmi track is not mapped.

func WriteSubtitleGroup

func WriteSubtitleGroup(ctx context.Context, moq *internal.MoQGroup, groupNr uint64, cb internal.ObjectWriter) error

WriteSubtitleGroup writes subtitle objects with appropriate timing.

Types

type Handler

type Handler struct {
	Namespaces []NamespaceEntry
	Asset      *internal.Asset
	Logfh      io.Writer
}

Handler handles MoQ publisher sessions. It serves catalogs and publishes media tracks (video, audio, subtitles) to subscribers across multiple namespaces.

func (*Handler) Handle

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

Handle runs a MoQ session on the given connection, announces all namespaces, and serves subscriptions. The context controls the lifetime of publishing goroutines.

type MoqMITrackMap added in v0.8.0

type MoqMITrackMap map[string]string

MoqMITrackMap maps moqmi-convention track names (video0, audio0, ...) to names of tracks in the asset. moqmi has no catalog, so the server advertises these fixed names by convention; this map provides the binding to real assets.

func BuildMoqMITrackMap added in v0.8.0

func BuildMoqMITrackMap(asset *internal.Asset) (MoqMITrackMap, error)

BuildMoqMITrackMap inspects an asset and chooses default mappings for video0 (first AVC track) and audio0 (first AAC-LC track, else first Opus track).

type NamespaceEntry added in v0.6.1

type NamespaceEntry struct {
	Namespace []string
	Catalog   *internal.Catalog
	Packaging string // "cmaf", "loc", or "moqmi"
	// MoqMITracks, when Packaging == "moqmi", maps moqmi-convention track names
	// (e.g. "video0", "audio0") to asset track names. moqmi has no catalog, so
	// this map provides the server-side binding to real asset tracks.
	MoqMITracks MoqMITrackMap
}

NamespaceEntry pairs an announcement namespace with its catalog.

Jump to

Keyboard shortcuts

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