ogg

package module
v0.0.0-...-2f9ee9e Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2013 License: BSD-3-Clause Imports: 3 Imported by: 3

README

ogg Build Status

Pure Go implementation of the libogg 1.3.0 container format library. See [www.xiph.org/ogg] for more info about libogg.

Testing 100% pass. Tested on Debian6 32-bit and Windows7 64-bit.

See also https://github.com/runningwild/gorbis for an excellent ogg/vorbis implementation.

Documentation

Index

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) Read

func (b *PackBuffer) Read(bits int8) int32

bits <= 32

func (*PackBuffer) Read1

func (b *PackBuffer) Read1() int32

func (*PackBuffer) Read1B

func (b *PackBuffer) Read1B() int32

func (*PackBuffer) ReadB

func (b *PackBuffer) ReadB(bits int8) int32

bits <= 32

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

type Packet struct {
	Packet []byte
	BOS    bool
	EOS    bool

	GranulePos int64
	PacketNo   int64
}

Packet is used to encapsulate the data and metadata belonging to a single raw Ogg/Vorbis packet.

type Page

type Page struct {
	Header []byte
	Body   []byte
}

Page is used to encapsulate the data in one Ogg bitstream page

func (*Page) Bos

func (og *Page) Bos() bool

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) Continued

func (og *Page) Continued() bool

func (*Page) Eos

func (og *Page) Eos() bool

func (*Page) GranulePos

func (og *Page) GranulePos() int64

func (*Page) Packets

func (og *Page) Packets() (count int)

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

func (*Page) PageNo

func (og *Page) PageNo() int32

func (*Page) Reset

func (og *Page) Reset()

func (*Page) SerialNo

func (og *Page) SerialNo() int32

func (*Page) Version

func (og *Page) Version() byte

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) Buffer

func (oy *SyncState) Buffer(size int) []byte

func (*SyncState) PageOut

func (oy *SyncState) PageOut(og *Page) int

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

func (oy *SyncState) PageSeek(og *Page) int

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

func (*SyncState) Reset

func (oy *SyncState) Reset()

Reset clears things to an initial state. Good to call, eg, before seeking

func (*SyncState) Wrote

func (oy *SyncState) Wrote(Bytes int) int

Jump to

Keyboard shortcuts

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