Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
ErrInvalidPacket = errors.New("invalid opus packet")
)
Functions ¶
func NewOggReader ¶
NewWith returns a new Ogg reader and Ogg header with an io.Reader input
func ParsePacketDuration ¶
Parse the duration of a an OpusPacket https://www.rfc-editor.org/rfc/rfc6716#section-3.1
Types ¶
type OggHeader ¶
type OggHeader struct { ChannelMap uint8 Channels uint8 OutputGain uint16 PreSkip uint16 SampleRate uint32 Version uint8 }
OggHeader is the metadata from the first two pages in the file (ID and Comment)
type OggPage ¶
type OggPage struct { GranulePosition uint64 // contains filtered or unexported fields }
OggPageHeader is the metadata for a Page Pages are the fundamental unit of multiplexing in an Ogg stream
type OggReader ¶
type OggReader struct {
// contains filtered or unexported fields
}
This is a modified version of the oggreader package from github.com/pion/webrtc The original Pion package can only read OGG pages, and the payload can only be used if the page contains only one segment. And this specific segment must only contains one Opus Packet.
RTP Packet can contains only one Opus Packet. https://www.rfc-editor.org/rfc/rfc7587#section-4.2
func (*OggReader) ReadPacket ¶
Pages can contain up to a second of audio data, which is much too large for an RTP packet. Instead of returning the entire page, this will return one sample at a time.