Documentation
¶
Overview ¶
Package oggwriter implements OGG media container writer
Index ¶
- type OggWriter
- type OpusTags
- type Track
- type TrackOption
- type UserComment
- type Writer
- type WriterOption
- type WriterTrackOption
- func WithChannelCount(channelCount uint16) WriterTrackOption
- func WithChannelMapping(family, streamCount, coupledCount uint8, mapping []byte) WriterTrackOption
- func WithSampleRate(sampleRate uint32) WriterTrackOption
- func WithUserComments(comments ...UserComment) WriterTrackOption
- func WithVendor(vendor string) WriterTrackOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type OggWriter ¶
type OggWriter struct {
// contains filtered or unexported fields
}
OggWriter is used to take RTP packets and write them to a single-track OGG.
type OpusTags ¶
type OpusTags struct {
Vendor string
UserComments []UserComment
}
OpusTags is the metadata for an OpusTags page. https://datatracker.ietf.org/doc/html/rfc7845#section-5.2
type Track ¶
type Track struct {
// contains filtered or unexported fields
}
Track writes RTP packets for a single logical Opus stream in a Writer.
type TrackOption ¶
type TrackOption interface {
// contains filtered or unexported methods
}
TrackOption configures a logical Opus stream in a multiplexed Ogg container.
func WithSerial ¶
func WithSerial(serial uint32) TrackOption
WithSerial sets the Ogg bitstream serial number for a track.
type UserComment ¶
UserComment is a key-value pair of a Vorbis comment.
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer is used to write multiple logical Opus streams into one OGG. Tracks are added before writing starts, and each returned Track owns WriteRTP.
func NewWriter ¶
func NewWriter(out io.Writer, opts ...WriterOption) (*Writer, error)
NewWriter creates a new multi-track OGG Opus writer with an io.Writer output. Close finalizes each logical stream with EOS. Without WithSeekableOutput, Close appends nil EOS pages because previously written pages cannot be rewritten.
type WriterOption ¶
type WriterOption interface {
// contains filtered or unexported methods
}
WriterOption configures a multiplexed Ogg writer.
func WithSeekableOutput ¶
func WithSeekableOutput(output interface {
io.Seeker
io.WriterAt
},
) WriterOption
WithSeekableOutput enables close-time Ogg page rewrites for outputs that support Seek and WriteAt.
type WriterTrackOption ¶
type WriterTrackOption interface {
WriterOption
TrackOption
}
WriterTrackOption configures both Writer defaults and per-track overrides.
func WithChannelCount ¶
func WithChannelCount(channelCount uint16) WriterTrackOption
WithChannelCount sets the default channel count for a Writer or overrides it for a Track. Mono and stereo are written with Opus channel mapping family 0. For non-zero single-stream channel mapping families, use WithChannelMapping.
func WithChannelMapping ¶
func WithChannelMapping(family, streamCount, coupledCount uint8, mapping []byte) WriterTrackOption
WithChannelMapping sets an explicit Opus channel mapping family for a Writer or Track. The channel count is derived from len(mapping). Only single-stream mappings are supported because WriteRTP accepts one Opus packet per Ogg packet. Family 1 supports mono/stereo Vorbis mappings, family 2 supports zero-order ambisonics, and family 255 supports arbitrary single-stream mappings.
func WithSampleRate ¶
func WithSampleRate(sampleRate uint32) WriterTrackOption
WithSampleRate sets the default sample rate for a Writer or overrides it for a Track.
func WithUserComments ¶
func WithUserComments(comments ...UserComment) WriterTrackOption
WithUserComments adds OpusTags user comments for a Writer or Track.
func WithVendor ¶
func WithVendor(vendor string) WriterTrackOption
WithVendor sets the OpusTags vendor string for a Writer or overrides it for a Track.