Audio files with variable bit rates are intrinsically difficult to
deal with in the case of seeking within the file. The ASPI frame
makes seeking easier by providing a list a seek points within the
audio file. The seek points are a fractional offset within the audio
data, providing a starting point from which to find an appropriate
point to start decoding. The presence of an ASPI frame requires the
existence of a TLEN frame, indicating the duration of the file in
milliseconds. There may only be one 'audio seek point index' frame in
a tag.
Indexed data start (S) $xx xx xx xx
Indexed data length (L) $xx xx xx xx
Number of index points (N) $xx xx
Bits per index point (b) $xx
Then for every index point the following data is included;
Fraction at index (Fi) $xx (xx)
'Indexed data start' is a byte offset from the beginning of the file.
'Indexed data length' is the byte length of the audio data being
indexed. 'Number of index points' is the number of index points, as
the name implies. The recommended number is 100. 'Bits per index
point' is 8 or 16, depending on the chosen precision. 8 bits works
well for short files (less than 5 minutes of audio), while 16 bits is
advantageous for long files. 'Fraction at index' is the numerator of
the fraction representing a relative position in the data. The
denominator is 2 to the power of b.
Here are the algorithms to be used in the calculation. The known data
must be the offset of the start of the indexed data (S), the offset
of the end of the indexed data (E), the number of index points (N),
the offset at index i (Oi). We calculate the fraction at index i
(Fi).
Oi is the offset of the frame whose start is soonest after the point
for which the time offset is (i/N * duration).
The frame data should be calculated as follows:
Fi = Oi/L * 2^b (rounded down to the nearest integer)
Offset calculation should be calculated as follows from data in the
frame:
Oi = (Fi/2^b)*L (rounded up to the nearest integer)
- Version:
- $Id: FrameBodyASPI.java,v 1.16 2009/11/12 13:25:22 paultaylor Exp $
- Author:
- : Paul Taylor, : Eric Farng
Constructor Summary |
FrameBodyASPI()
Creates a new FrameBodyASPI datatype. |
FrameBodyASPI(java.nio.ByteBuffer byteBuffer,
int frameSize)
Creates a new FrameBodyASPI datatype. |
FrameBodyASPI(FrameBodyASPI copyObject)
Creates a new FrameBodyASPI from another FrameBodyASPI |
Method Summary |
java.lang.String |
getIdentifier()
The ID3v2 frame identifier |
protected void |
setupObjectList()
Create the list of Datatypes that this body
expects in the correct order This method needs to be implemented by concrete subclasses |
Methods inherited from class org.jaudiotagger.tag.id3.AbstractTagFrameBody |
getBriefDescription, getHeader, getLongDescription, getObject, getObjectValue, getTextEncoding, isSubsetOf, iterator, setHeader, setObjectValue, setTextEncoding, toString |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
DATA_START_FIELD_SIZE
private static final int DATA_START_FIELD_SIZE
- See Also:
- Constant Field Values
DATA_LENGTH_FIELD_SIZE
private static final int DATA_LENGTH_FIELD_SIZE
- See Also:
- Constant Field Values
NO_OF_INDEX_POINTS_FIELD_SIZE
private static final int NO_OF_INDEX_POINTS_FIELD_SIZE
- See Also:
- Constant Field Values
BITS_PER_INDEX_POINTS_FIELD_SIZE
private static final int BITS_PER_INDEX_POINTS_FIELD_SIZE
- See Also:
- Constant Field Values
FRACTION_AT_INDEX_MINIMUM_FIELD_SIZE
private static final int FRACTION_AT_INDEX_MINIMUM_FIELD_SIZE
- See Also:
- Constant Field Values
INDEXED_DATA_START
private static final java.lang.String INDEXED_DATA_START
- See Also:
- Constant Field Values
INDEXED_DATA_LENGTH
private static final java.lang.String INDEXED_DATA_LENGTH
- See Also:
- Constant Field Values
NUMBER_OF_INDEX_POINTS
private static final java.lang.String NUMBER_OF_INDEX_POINTS
- See Also:
- Constant Field Values
BITS_PER_INDEX_POINT
private static final java.lang.String BITS_PER_INDEX_POINT
- See Also:
- Constant Field Values
FRACTION_AT_INDEX
private static final java.lang.String FRACTION_AT_INDEX
- See Also:
- Constant Field Values
FrameBodyASPI
public FrameBodyASPI()
- Creates a new FrameBodyASPI datatype.
FrameBodyASPI
public FrameBodyASPI(FrameBodyASPI copyObject)
- Creates a new FrameBodyASPI from another FrameBodyASPI
- Parameters:
copyObject
-
FrameBodyASPI
public FrameBodyASPI(java.nio.ByteBuffer byteBuffer,
int frameSize)
throws InvalidTagException
- Creates a new FrameBodyASPI datatype.
- Parameters:
byteBuffer
- frameSize
-
- Throws:
InvalidTagException
getIdentifier
public java.lang.String getIdentifier()
- The ID3v2 frame identifier
- Specified by:
getIdentifier
in class AbstractID3v2FrameBody
- Returns:
- the ID3v2 frame identifier for this frame type
setupObjectList
protected void setupObjectList()
- Description copied from class:
AbstractTagFrameBody
- Create the list of Datatypes that this body
expects in the correct order This method needs to be implemented by concrete subclasses
- Specified by:
setupObjectList
in class AbstractTagFrameBody