Mp3dings 
20100427

helliker.id3
Class VBRIHeader

java.lang.Object
  extended by helliker.id3.VBRIHeader
All Implemented Interfaces:
VBRHeader

public class VBRIHeader
extends Object


Constructor Summary
VBRIHeader(ByteBuffer header, int layer, int mpegVersion, int sampleRate)
           
 
Method Summary
protected  void calc(int layer, int mpegVersion, int sampleRate)
          Calculates the playing time and the average bitrate.
 boolean exists()
          Returns true if a VBRI header was found in the file passed to the constructor.
 int getAvgBitrate()
          Returns the average bit rate of the mpeg file if a Xing header exists and -1 otherwise.
 int getLength()
          Returns the length of this header in bytes
 int getNumBytes()
          Returns the number of data bytes in the mpeg frames.
 int getNumFrames()
          Returns the number of MPEG frames in the file passed to the constructor.
 int getPlayingTime()
          Returns the approximate playing time in seconds.
 int getQuality()
          Returns the value of quality.
 int getTOCBytesPerEntry()
          Returns the number of bytes per TOC entry.
 int getTOCFramesPerEntry()
          Returns the number of frames per TOC entry.
 int getTOCLength()
          Returns the length of the TOC in bytes.
 int getTOCNumEntries()
          Returns the value of tocNumEntries.
 int getTOCScale()
          Returns the value of tocScale.
 int getVersion()
          Returns the VBRI version.
 String toString()
          Returns a string representation of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

VBRIHeader

public VBRIHeader(ByteBuffer header,
                  int layer,
                  int mpegVersion,
                  int sampleRate)
Method Detail

exists

public boolean exists()
Returns true if a VBRI header was found in the file passed to the constructor.

Returns:
whether a VBRI header was found

getNumFrames

public int getNumFrames()
Returns the number of MPEG frames in the file passed to the constructor. If a header is not found, -1 is returned.

Returns:
the number of MPEG frames

getNumBytes

public int getNumBytes()
Returns the number of data bytes in the mpeg frames. If a header is not found, -1 is returned.

Returns:
the number of data bytes in the mpeg frames

getQuality

public int getQuality()
Returns the value of quality.


getTOCScale

public int getTOCScale()
Returns the value of tocScale.


getTOCBytesPerEntry

public int getTOCBytesPerEntry()
Returns the number of bytes per TOC entry.


getTOCFramesPerEntry

public int getTOCFramesPerEntry()
Returns the number of frames per TOC entry.


getTOCLength

public int getTOCLength()
Returns the length of the TOC in bytes.


getTOCNumEntries

public int getTOCNumEntries()
Returns the value of tocNumEntries.


getVersion

public int getVersion()
Returns the VBRI version.


getLength

public int getLength()
Returns the length of this header in bytes


calc

protected void calc(int layer,
                    int mpegVersion,
                    int sampleRate)
Calculates the playing time and the average bitrate.

Parameters:
layer - the layer value read by the MPEGAudioFrameHeader
mpegVersion - the version value read by the MPEGAudioFrameHeader
sampleRate - the sample rate read by the MPEGAudioFrameHeader

getAvgBitrate

public int getAvgBitrate()
Returns the average bit rate of the mpeg file if a Xing header exists and -1 otherwise.

Specified by:
getAvgBitrate in interface VBRHeader
Returns:
the average bit rate (in kbps)

getPlayingTime

public int getPlayingTime()
Description copied from interface: VBRHeader
Returns the approximate playing time in seconds.

Specified by:
getPlayingTime in interface VBRHeader

toString

public String toString()
Returns a string representation of this object.

Overrides:
toString in class Object
Returns:
a string representation of this object

Mp3dings 
20100427