ogg

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package oggreader implements the Ogg media container reader

Package oggwriter implements OGG media container writer

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewReaderWith

func NewReaderWith(in io.Reader) (*Reader, *Header, error)

NewReaderWith returns a new Ogg reader and Ogg header with an io.Reader input

Types

type Header struct {
	ChannelMap uint8
	Channels   uint8
	OutputGain uint16
	PreSkip    uint16
	SampleRate uint32
	Version    uint8
}

Header is the metadata from the first two pages in the file (ID and Comment)

https://tools.ietf.org/html/rfc7845.html#section-3

type PageHeader struct {
	GranulePosition uint64
	// contains filtered or unexported fields
}

PageHeader is the metadata for a Page Pages are the fundamental unit of multiplexing in an Ogg stream

https://tools.ietf.org/html/rfc7845.html#section-1

type Reader

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

Reader is used to read Ogg files and return page payloads

func (*Reader) ParseNextPage

func (o *Reader) ParseNextPage() ([]byte, *PageHeader, error)

ParseNextPage reads from stream and returns Ogg page payload, header, and an error if there is incomplete page data.

func (*Reader) ResetReader

func (o *Reader) ResetReader(reset func(bytesRead int64) io.Reader)

ResetReader resets the internal stream of Reader. This is useful for live streams, where the end of the file might be read without the data being finished.

type Writer

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

Writer is used to take RTP packets and write them to an OGG on disk

func NewWith

func NewWith(out io.Writer, sampleRate uint32, channelCount uint16) (*Writer, error)

NewWith initialize a new OGG Opus writer with an io.Writer output

func NewWriter

func NewWriter(fileName string, sampleRate uint32, channelCount uint16) (*Writer, error)

NewWriter builds a new OGG Opus writer

func (*Writer) Close

func (i *Writer) Close() error

Close stops the recording

func (*Writer) WriteRTP

func (i *Writer) WriteRTP(packet *rtp.Packet, gap uint64) error

WriteRTP adds a new packet and writes the appropriate headers for it

Jump to

Keyboard shortcuts

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