Crosstales.NVorbis.DataPacket Class Referenceabstract

A single data packet from a logical Vorbis stream. More...

Inheritance diagram for Crosstales.NVorbis.DataPacket:
Crosstales.NVorbis.Ogg.Packet

Public Member Functions

virtual void Done ()
 Indicates that the packet has been read and its data is no longer needed. More...
 
ulong TryPeekBits (int count, out int bitsRead)
 Attempts to read the specified number of bits from the packet, but may return fewer. Does not advance the position counter. More...
 
void SkipBits (int count)
 Advances the position counter by the specified number of bits. More...
 
ulong ReadBits (int count)
 Reads the specified number of bits from the packet and advances the position counter. More...
 
byte PeekByte ()
 Reads the next byte from the packet. Does not advance the position counter. More...
 
byte ReadByte ()
 Reads the next byte from the packet and advances the position counter. More...
 
byte[] ReadBytes (int count)
 Reads the specified number of bytes from the packet and advances the position counter. More...
 
int Read (byte[] buffer, int index, int count)
 Reads the specified number of bytes from the packet into the buffer specified and advances the position counter. More...
 
bool ReadBit ()
 Reads the next bit from the packet and advances the position counter. More...
 
short ReadInt16 ()
 Retrieves the next 16 bits from the packet as a short and advances the position counter. More...
 
int ReadInt32 ()
 Retrieves the next 32 bits from the packet as a int and advances the position counter. More...
 
long ReadInt64 ()
 Retrieves the next 64 bits from the packet as a long and advances the position counter. More...
 
ushort ReadUInt16 ()
 Retrieves the next 16 bits from the packet as a ushort and advances the position counter. More...
 
uint ReadUInt32 ()
 Retrieves the next 32 bits from the packet as a uint and advances the position counter. More...
 
ulong ReadUInt64 ()
 Retrieves the next 64 bits from the packet as a ulong and advances the position counter. More...
 
void SkipBytes (int count)
 Advances the position counter by the specified number of bytes. More...
 

Protected Types

enum  PacketFlags : byte {
  PacketFlags.IsResync = 0x01, PacketFlags.IsEndOfStream = 0x02, PacketFlags.IsShort = 0x04, PacketFlags.HasGranuleCount = 0x08,
  PacketFlags.User1 = 0x10, PacketFlags.User2 = 0x20, PacketFlags.User3 = 0x40, PacketFlags.User4 = 0x80
}
 Defines flags to apply to the current packet More...
 

Protected Member Functions

bool GetFlag (PacketFlags flag)
 Gets the value of the specified flag. More...
 
void SetFlag (PacketFlags flag, bool value)
 Sets the value of the specified flag. More...
 
 DataPacket (int length)
 Creates a new instance with the specified length. More...
 
abstract int ReadNextByte ()
 Reads the next byte of the packet. More...
 
void ResetBitReader ()
 Resets the bit reader. More...
 

Properties

bool IsResync [get, set]
 Gets whether the packet was found after a stream resync. More...
 
long GranulePosition [get, set]
 Gets the position of the last granule in the packet. More...
 
long PageGranulePosition [get, set]
 Gets the position of the last granule in the page the packet is in. More...
 
int Length [get, protected set]
 Gets the length of the packet. More...
 
bool IsEndOfStream [get, set]
 Gets whether the packet is the last one in the logical stream. More...
 
long BitsRead [get]
 Gets the number of bits read from the packet. More...
 
int? GranuleCount [get, set]
 Gets the number of granules in the packet. If null, the packet has not been decoded yet. More...
 

Detailed Description

A single data packet from a logical Vorbis stream.

Member Enumeration Documentation

◆ PacketFlags

enum Crosstales.NVorbis.DataPacket.PacketFlags : byte
strongprotected

Defines flags to apply to the current packet

Enumerator
IsResync 

Packet is first since reader had to resync with stream.

IsEndOfStream 

Packet is the last in the logical stream.

IsShort 

Packet does not have all its data available.

HasGranuleCount 

Packet has a granule count defined.

User1 

Flag for use by inheritors.

User2 

Flag for use by inheritors.

User3 

Flag for use by inheritors.

User4 

Flag for use by inheritors.

Constructor & Destructor Documentation

◆ DataPacket()

Crosstales.NVorbis.DataPacket.DataPacket ( int  length)
protected

Creates a new instance with the specified length.

Parameters
lengthThe length of the packet.

Member Function Documentation

◆ Done()

virtual void Crosstales.NVorbis.DataPacket.Done ( )
virtual

Indicates that the packet has been read and its data is no longer needed.

Reimplemented in Crosstales.NVorbis.Ogg.Packet.

◆ GetFlag()

bool Crosstales.NVorbis.DataPacket.GetFlag ( PacketFlags  flag)
protected

Gets the value of the specified flag.

◆ PeekByte()

byte Crosstales.NVorbis.DataPacket.PeekByte ( )

Reads the next byte from the packet. Does not advance the position counter.

Returns
The byte read from the packet.

◆ Read()

int Crosstales.NVorbis.DataPacket.Read ( byte[]  buffer,
int  index,
int  count 
)

Reads the specified number of bytes from the packet into the buffer specified and advances the position counter.

Parameters
bufferThe buffer to read into.
indexThe index into the buffer to start placing the read data.
countThe number of bytes to read.
Returns
The number of bytes read.
Exceptions
ArgumentOutOfRangeExceptionindex is less than 0 or index + count is past the end of buffer .

◆ ReadBit()

bool Crosstales.NVorbis.DataPacket.ReadBit ( )

Reads the next bit from the packet and advances the position counter.

Returns
The value of the bit read.

◆ ReadBits()

ulong Crosstales.NVorbis.DataPacket.ReadBits ( int  count)

Reads the specified number of bits from the packet and advances the position counter.

Parameters
countThe number of bits to read.
Returns
The value of the bits read.
Exceptions
ArgumentOutOfRangeExceptionThe number of bits specified is not between 0 and 64.

◆ ReadByte()

byte Crosstales.NVorbis.DataPacket.ReadByte ( )

Reads the next byte from the packet and advances the position counter.

Returns
The byte read from the packet.

◆ ReadBytes()

byte [] Crosstales.NVorbis.DataPacket.ReadBytes ( int  count)

Reads the specified number of bytes from the packet and advances the position counter.

Parameters
countThe number of bytes to read.
Returns
A byte array holding the data read.

◆ ReadInt16()

short Crosstales.NVorbis.DataPacket.ReadInt16 ( )

Retrieves the next 16 bits from the packet as a short and advances the position counter.

Returns
The value of the next 16 bits.

◆ ReadInt32()

int Crosstales.NVorbis.DataPacket.ReadInt32 ( )

Retrieves the next 32 bits from the packet as a int and advances the position counter.

Returns
The value of the next 32 bits.

◆ ReadInt64()

long Crosstales.NVorbis.DataPacket.ReadInt64 ( )

Retrieves the next 64 bits from the packet as a long and advances the position counter.

Returns
The value of the next 64 bits.

◆ ReadNextByte()

abstract int Crosstales.NVorbis.DataPacket.ReadNextByte ( )
protectedpure virtual

Reads the next byte of the packet.

Returns
The next byte if available, otherwise -1.

Implemented in Crosstales.NVorbis.Ogg.Packet.

◆ ReadUInt16()

ushort Crosstales.NVorbis.DataPacket.ReadUInt16 ( )

Retrieves the next 16 bits from the packet as a ushort and advances the position counter.

Returns
The value of the next 16 bits.

◆ ReadUInt32()

uint Crosstales.NVorbis.DataPacket.ReadUInt32 ( )

Retrieves the next 32 bits from the packet as a uint and advances the position counter.

Returns
The value of the next 32 bits.

◆ ReadUInt64()

ulong Crosstales.NVorbis.DataPacket.ReadUInt64 ( )

Retrieves the next 64 bits from the packet as a ulong and advances the position counter.

Returns
The value of the next 64 bits.

◆ ResetBitReader()

void Crosstales.NVorbis.DataPacket.ResetBitReader ( )
protected

Resets the bit reader.

◆ SetFlag()

void Crosstales.NVorbis.DataPacket.SetFlag ( PacketFlags  flag,
bool  value 
)
protected

Sets the value of the specified flag.

◆ SkipBits()

void Crosstales.NVorbis.DataPacket.SkipBits ( int  count)

Advances the position counter by the specified number of bits.

Parameters
countThe number of bits to advance.

◆ SkipBytes()

void Crosstales.NVorbis.DataPacket.SkipBytes ( int  count)

Advances the position counter by the specified number of bytes.

Parameters
countThe number of bytes to advance.

◆ TryPeekBits()

ulong Crosstales.NVorbis.DataPacket.TryPeekBits ( int  count,
out int  bitsRead 
)

Attempts to read the specified number of bits from the packet, but may return fewer. Does not advance the position counter.

Parameters
countThe number of bits to attempt to read.
bitsReadThe number of bits actually read.
Returns
The value of the bits read.
Exceptions
ArgumentOutOfRangeExceptioncount is not between 0 and 64.

Property Documentation

◆ BitsRead

long Crosstales.NVorbis.DataPacket.BitsRead
get

Gets the number of bits read from the packet.

◆ GranuleCount

int? Crosstales.NVorbis.DataPacket.GranuleCount
getset

Gets the number of granules in the packet. If null, the packet has not been decoded yet.

◆ GranulePosition

long Crosstales.NVorbis.DataPacket.GranulePosition
getset

Gets the position of the last granule in the packet.

◆ IsEndOfStream

bool Crosstales.NVorbis.DataPacket.IsEndOfStream
getset

Gets whether the packet is the last one in the logical stream.

◆ IsResync

bool Crosstales.NVorbis.DataPacket.IsResync
getset

Gets whether the packet was found after a stream resync.

◆ Length

int Crosstales.NVorbis.DataPacket.Length
getprotected set

Gets the length of the packet.

◆ PageGranulePosition

long Crosstales.NVorbis.DataPacket.PageGranulePosition
getset

Gets the position of the last granule in the page the packet is in.


The documentation for this class was generated from the following file:
  • C:/Users/slaub/Unity/assets/DJPro/DJPro/Assets/Plugins/crosstales/Common/Libraries/NVorbis/DataPacket.cs