Documentation ¶
Index ¶
- type PackBuffer
- func (b *PackBuffer) Adv(bits int8)
- func (b *PackBuffer) Adv1()
- func (b *PackBuffer) Adv1B()
- func (b *PackBuffer) AdvB(bits int8)
- func (b *PackBuffer) Bits() int32
- func (b *PackBuffer) BitsB() int32
- func (b *PackBuffer) Bytes() int32
- func (b *PackBuffer) BytesB() int32
- func (b *PackBuffer) GetBuffer() []byte
- func (b *PackBuffer) GetBufferB() []byte
- func (b *PackBuffer) Look(bits int8) int32
- func (b *PackBuffer) Look1() int32
- func (b *PackBuffer) Look1B() int32
- func (b *PackBuffer) LookB(bits int8) int32
- func (b *PackBuffer) Read(bits int8) int32
- func (b *PackBuffer) Read1() int32
- func (b *PackBuffer) Read1B() int32
- func (b *PackBuffer) ReadB(bits int8) int32
- func (b *PackBuffer) ReadInit(buf []byte)
- func (b *PackBuffer) ReadInitB(buf []byte)
- func (b *PackBuffer) Reset()
- func (b *PackBuffer) ResetB()
- func (b *PackBuffer) Write(value uint32, bits int8)
- func (b *PackBuffer) WriteAlign()
- func (b *PackBuffer) WriteAlignB()
- func (b *PackBuffer) WriteB(value uint32, bits int8)
- func (b *PackBuffer) WriteCheck() bool
- func (b *PackBuffer) WriteCheckB() bool
- func (b *PackBuffer) WriteClear()
- func (b *PackBuffer) WriteClearB()
- func (b *PackBuffer) WriteCopy(source []byte, bits int8)
- func (b *PackBuffer) WriteCopyB(source []byte, bits int8)
- func (b *PackBuffer) WriteInit()
- func (b *PackBuffer) WriteInitB()
- func (b *PackBuffer) WriteTrunc(bits int32)
- func (b *PackBuffer) WriteTruncB(bits int32)
- type Packet
- type Page
- func (og *Page) Bos() bool
- func (og *Page) ChecksumSet()
- func (og *Page) Continued() bool
- func (og *Page) Eos() bool
- func (og *Page) GranulePos() int64
- func (og *Page) Packets() (count int)
- func (og *Page) PageNo() int32
- func (og *Page) Reset()
- func (og *Page) SerialNo() int32
- func (og *Page) Version() byte
- type StreamState
- func (ot *StreamState) Eos() bool
- func (ot *StreamState) Flush(og *Page) bool
- func (ot *StreamState) FlushFill(og *Page, nfill int) bool
- func (ot *StreamState) Init(serialNo int32)
- func (ot *StreamState) IovecIn(iov [][]byte, eos bool, granulepos int64) error
- func (ot *StreamState) PacketIn(op *Packet) error
- func (ot *StreamState) PacketOut(op *Packet) int
- func (ot *StreamState) PacketPeek(op *Packet) int
- func (ot *StreamState) PageIn(og *Page) error
- func (ot *StreamState) PageOut(og *Page) bool
- func (ot *StreamState) PageOutFill(og *Page, nfill int) bool
- func (ot *StreamState) Reset()
- func (ot *StreamState) ResetSerialNo(serialno int32)
- type SyncState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PackBuffer ¶
type PackBuffer struct {
// contains filtered or unexported fields
}
func (*PackBuffer) Adv ¶
func (b *PackBuffer) Adv(bits int8)
func (*PackBuffer) Adv1 ¶
func (b *PackBuffer) Adv1()
func (*PackBuffer) Adv1B ¶
func (b *PackBuffer) Adv1B()
func (*PackBuffer) AdvB ¶
func (b *PackBuffer) AdvB(bits int8)
func (*PackBuffer) Bits ¶
func (b *PackBuffer) Bits() int32
func (*PackBuffer) BitsB ¶
func (b *PackBuffer) BitsB() int32
func (*PackBuffer) Bytes ¶
func (b *PackBuffer) Bytes() int32
func (*PackBuffer) BytesB ¶
func (b *PackBuffer) BytesB() int32
func (*PackBuffer) GetBuffer ¶
func (b *PackBuffer) GetBuffer() []byte
func (*PackBuffer) GetBufferB ¶
func (b *PackBuffer) GetBufferB() []byte
func (*PackBuffer) Look ¶
func (b *PackBuffer) Look(bits int8) int32
Read in bits without advancing the bitptr; bits <= 32
func (*PackBuffer) Look1 ¶
func (b *PackBuffer) Look1() int32
func (*PackBuffer) Look1B ¶
func (b *PackBuffer) Look1B() int32
func (*PackBuffer) LookB ¶
func (b *PackBuffer) LookB(bits int8) int32
Read in bits without advancing the bitptr; bits <= 32
func (*PackBuffer) Read1 ¶
func (b *PackBuffer) Read1() int32
func (*PackBuffer) Read1B ¶
func (b *PackBuffer) Read1B() int32
func (*PackBuffer) ReadInit ¶
func (b *PackBuffer) ReadInit(buf []byte)
func (*PackBuffer) ReadInitB ¶
func (b *PackBuffer) ReadInitB(buf []byte)
func (*PackBuffer) Reset ¶
func (b *PackBuffer) Reset()
func (*PackBuffer) ResetB ¶
func (b *PackBuffer) ResetB()
func (*PackBuffer) Write ¶
func (b *PackBuffer) Write(value uint32, bits int8)
Takes only up to 32 bits.
func (*PackBuffer) WriteAlign ¶
func (b *PackBuffer) WriteAlign()
func (*PackBuffer) WriteAlignB ¶
func (b *PackBuffer) WriteAlignB()
func (*PackBuffer) WriteB ¶
func (b *PackBuffer) WriteB(value uint32, bits int8)
Takes only up to 32 bits.
func (*PackBuffer) WriteCheck ¶
func (b *PackBuffer) WriteCheck() bool
func (*PackBuffer) WriteCheckB ¶
func (b *PackBuffer) WriteCheckB() bool
func (*PackBuffer) WriteClear ¶
func (b *PackBuffer) WriteClear()
func (*PackBuffer) WriteClearB ¶
func (b *PackBuffer) WriteClearB()
func (*PackBuffer) WriteCopy ¶
func (b *PackBuffer) WriteCopy(source []byte, bits int8)
func (*PackBuffer) WriteCopyB ¶
func (b *PackBuffer) WriteCopyB(source []byte, bits int8)
func (*PackBuffer) WriteInit ¶
func (b *PackBuffer) WriteInit()
func (*PackBuffer) WriteInitB ¶
func (b *PackBuffer) WriteInitB()
func (*PackBuffer) WriteTrunc ¶
func (b *PackBuffer) WriteTrunc(bits int32)
func (*PackBuffer) WriteTruncB ¶
func (b *PackBuffer) WriteTruncB(bits int32)
type Packet ¶
Packet is used to encapsulate the data and metadata belonging to a single raw Ogg/Vorbis packet.
type Page ¶
Page is used to encapsulate the data in one Ogg bitstream page
func (*Page) ChecksumSet ¶
func (og *Page) ChecksumSet()
ChecksumSet the page Direct table CRC; note that this will be faster in the future if we perform the checksum simultaneously with other copies
func (*Page) GranulePos ¶
func (*Page) Packets ¶
Packets returns the number of packets that are completed on this page (if the leading packet is begun on a previous page, but ends on this page, it's counted
NOTE: If a page consists of a packet begun on a previous page, and a new packet begun (but not completed) on this page, the return will be:
Page.Packets() == 1 Page.Continued() != false
If a page happens to be a single packet that was begun on a previous page, and spans to the next page (in the case of a three or more page packet), the return will be:
Page.Packets() == 0 Page.Continued() != false
type StreamState ¶
type StreamState struct { SerialNo int32 // contains filtered or unexported fields }
StreamState contains the current encode/decode state of a logical Ogg bitstream
func (*StreamState) Eos ¶
func (ot *StreamState) Eos() bool
func (*StreamState) Flush ¶
func (ot *StreamState) Flush(og *Page) bool
Flush will flush remaining packets into a page (returning nonzero), even if there is not enough data to trigger a flush normally (undersized page). If there are no packets or partial packets to flush, Flush returns 0. Note that Flush will try to flush a normal sized page like Pageout; a call to Flush does not guarantee that all packets have flushed. Only a return value of 0 from Flush indicates all packet data is flushed into pages.
Since Flush will flush the last page in a stream even if it's undersized, you almost certainly want to use PageOut (and *not* Flush) unless you specifically need to flush a page regardless of size in the middle of a stream.
func (*StreamState) FlushFill ¶
func (ot *StreamState) FlushFill(og *Page, nfill int) bool
FlushFill, like Flush, but an argument is provided to adjust the nominal page size for applications which are smart enough to provide their own delay based flushing
func (*StreamState) Init ¶
func (ot *StreamState) Init(serialNo int32)
Init the encode/decode logical stream state
func (*StreamState) IovecIn ¶
func (ot *StreamState) IovecIn(iov [][]byte, eos bool, granulepos int64) error
IovecIn submit data to the internal buffer of the framing engine
func (*StreamState) PacketIn ¶
func (ot *StreamState) PacketIn(op *Packet) error
func (*StreamState) PacketOut ¶
func (ot *StreamState) PacketOut(op *Packet) int
func (*StreamState) PacketPeek ¶
func (ot *StreamState) PacketPeek(op *Packet) int
func (*StreamState) PageIn ¶
func (ot *StreamState) PageIn(og *Page) error
PageIn adds the incoming page to the stream state; we decompose the page into packet segments here as well.
func (*StreamState) PageOut ¶
func (ot *StreamState) PageOut(og *Page) bool
PageOut constructs pages from buffered packet segments. The pointers returned are to static buffers; do not free. The returned buffers are good only until the next call (using the same StreamState).
func (*StreamState) PageOutFill ¶
func (ot *StreamState) PageOutFill(og *Page, nfill int) bool
PageOutFill, like PageOut, but an argument is provided to adjust the nominal page size for applications which are smart enough to provide their own delay based flushing.
func (*StreamState) Reset ¶
func (ot *StreamState) Reset()
func (*StreamState) ResetSerialNo ¶
func (ot *StreamState) ResetSerialNo(serialno int32)
type SyncState ¶
type SyncState struct {
// contains filtered or unexported fields
}
SyncState tracks the synchronization of the current page.
func (*SyncState) PageOut ¶
PageOut sync the stream and get a page. Keep trying until we find a page. Suppress 'sync errors' after reporting the first. return values:
-1) recapture (hole in data) 0) need more data 1) page returned
Returns pointers into buffered data; invalidated by next call to Init(), or Buffer()
func (*SyncState) PageSeek ¶
PageSeek syncs the stream. Useful for finding page boundaries. Return values for this:
-n) skipped n bytes 0) page not ready; more data (no bytes skipped) n) page synced at current location; page length n bytes