Fields Summary |
---|
public static Logger | logger |
public static final byte[] | CAPTURE_PATTERN |
public static final int | OGG_PAGE_HEADER_FIXED_LENGTH |
public static final int | MAXIMUM_NO_OF_SEGMENT_SIZE |
public static final int | MAXIMUM_SEGMENT_SIZE |
public static final int | MAXIMUM_PAGE_HEADER_SIZE |
public static final int | MAXIMUM_PAGE_DATA_SIZE |
public static final int | MAXIMUM_PAGE_SIZE |
public static final int | FIELD_CAPTURE_PATTERN_POS |
public static final int | FIELD_STREAM_STRUCTURE_VERSION_POS |
public static final int | FIELD_HEADER_TYPE_FLAG_POS |
public static final int | FIELD_ABSOLUTE_GRANULE_POS |
public static final int | FIELD_STREAM_SERIAL_NO_POS |
public static final int | FIELD_PAGE_SEQUENCE_NO_POS |
public static final int | FIELD_PAGE_CHECKSUM_POS |
public static final int | FIELD_PAGE_SEGMENTS_POS |
public static final int | FIELD_SEGMENT_TABLE_POS |
public static final int | FIELD_CAPTURE_PATTERN_LENGTH |
public static final int | FIELD_STREAM_STRUCTURE_VERSION_LENGTH |
public static final int | FIELD_HEADER_TYPE_FLAG_LENGTH |
public static final int | FIELD_ABSOLUTE_GRANULE_LENGTH |
public static final int | FIELD_STREAM_SERIAL_NO_LENGTH |
public static final int | FIELD_PAGE_SEQUENCE_NO_LENGTH |
public static final int | FIELD_PAGE_CHECKSUM_LENGTH |
public static final int | FIELD_PAGE_SEGMENTS_LENGTH |
private byte[] | rawHeaderData |
private double | absoluteGranulePosition |
private int | checksum |
private byte | headerTypeFlag |
private boolean | isValid |
private int | pageLength |
private int | pageSequenceNumber |
private int | streamSerialNumber |
private byte[] | segmentTable |
private List | packetList |
private boolean | lastPacketIncomplete |
private long | startByte |
Methods Summary |
---|
public double | getAbsoluteGranulePosition()
logger.fine("Number Of Samples: " + absoluteGranulePosition);
return this.absoluteGranulePosition;
|
public int | getCheckSum()
return checksum;
|
public byte | getHeaderType()
return headerTypeFlag;
|
public java.util.List | getPacketList()
return packetList;
|
public int | getPageLength()
logger.fine("This page length: " + pageLength);
return this.pageLength;
|
public int | getPageSequence()
return pageSequenceNumber;
|
public byte[] | getRawHeaderData()
return rawHeaderData;
|
public byte[] | getSegmentTable()
return this.segmentTable;
|
public int | getSerialNumber()
return streamSerialNumber;
|
public long | getStartByte()Startbyte of this pageHeader in the file
This is useful for Ogg files that contain unsupported additional data at the start of the file such
as ID3 data
return startByte;
|
public boolean | isLastPacketIncomplete()
return lastPacketIncomplete;
|
public boolean | isValid()
return isValid;
|
public static org.jaudiotagger.audio.ogg.util.OggPageHeader | read(java.nio.ByteBuffer byteBuffer)Read next PageHeader from Buffer
//byteBuffer
int start = byteBuffer.position();
logger.fine("Trying to read OggPage at:" + start);
byte[] b = new byte[OggPageHeader.CAPTURE_PATTERN.length];
byteBuffer.get(b);
if (!(Arrays.equals(b, OggPageHeader.CAPTURE_PATTERN)))
{
throw new CannotReadException(ErrorMessage.OGG_HEADER_CANNOT_BE_FOUND.getMsg(new String(b)));
}
byteBuffer.position(start + OggPageHeader.FIELD_PAGE_SEGMENTS_POS);
int pageSegments = byteBuffer.get() & 0xFF; //unsigned
byteBuffer.position(start);
b = new byte[OggPageHeader.OGG_PAGE_HEADER_FIXED_LENGTH + pageSegments];
byteBuffer.get(b);
OggPageHeader pageHeader = new OggPageHeader(b);
//Now just after PageHeader, ready for Packet Data
return pageHeader;
|
public static org.jaudiotagger.audio.ogg.util.OggPageHeader | read(java.io.RandomAccessFile raf)Read next PageHeader from file
long start = raf.getFilePointer();
logger.fine("Trying to read OggPage at:" + start);
byte[] b = new byte[OggPageHeader.CAPTURE_PATTERN.length];
raf.read(b);
if (!(Arrays.equals(b, OggPageHeader.CAPTURE_PATTERN)))
{
raf.seek(start);
if(AbstractID3v2Tag.isId3Tag(raf))
{
logger.warning(ErrorMessage.OGG_CONTAINS_ID3TAG.getMsg(raf.getFilePointer() - start));
raf.read(b);
if ((Arrays.equals(b, OggPageHeader.CAPTURE_PATTERN)))
{
//Go to the end of the ID3 header
start=raf.getFilePointer() - OggPageHeader.CAPTURE_PATTERN.length;
}
}
else
{
throw new CannotReadException(ErrorMessage.OGG_HEADER_CANNOT_BE_FOUND.getMsg(new String(b)));
}
}
raf.seek(start + OggPageHeader.FIELD_PAGE_SEGMENTS_POS);
int pageSegments = raf.readByte() & 0xFF; //unsigned
raf.seek(start);
b = new byte[OggPageHeader.OGG_PAGE_HEADER_FIXED_LENGTH + pageSegments];
raf.read(b);
OggPageHeader pageHeader = new OggPageHeader(b);
pageHeader.setStartByte(start);
//Now just after PageHeader, ready for Packet Data
return pageHeader;
|
public void | setStartByte(long startByte)
this.startByte = startByte;
|
public java.lang.String | toString()
String out = "Ogg Page Header:isValid:" + isValid + ":type:" + headerTypeFlag + ":oggPageHeaderLength:" + rawHeaderData.length + ":length:" + pageLength + ":seqNo:" + getPageSequence() + ":packetIncomplete:" + isLastPacketIncomplete() + ":serNum:" + this.getSerialNumber();
for (PacketStartAndLength packet : getPacketList())
{
out += packet.toString();
}
return out;
|
private int | u(int i)
return i & 0xFF;
|