entagged.audioformats
Class EncodingInfo

java.lang.Object
  extended byentagged.audioformats.EncodingInfo

public class EncodingInfo
extends java.lang.Object

This class represents a structure for storing and retrieving information about the codec respectively the encoding parameters.
Most of the parameters are available for nearly each audio format. Some others would result in standard values.
Consider: None of the setter methods will actually affect the audio file. This is just a structure for retrieving information, not manipulating the audio file.

Author:
Raphael Slinckx

Field Summary
static java.lang.String FIELD_BITRATE
          The key for the Bitrate.
static java.lang.String FIELD_CHANNEL
          The key for the number of audio channels.
static java.lang.String FIELD_INFOS
          The key for the extra encoding information.
static java.lang.String FIELD_LENGTH
          The key for the audio clip duration in seconds.
static java.lang.String FIELD_SAMPLERATE
          The key for the audio sample rate in "Hz".
static java.lang.String FIELD_TYPE
          The key for the audio type.
static java.lang.String FIELD_VBR
          The key for the VBR flag.
 
Constructor Summary
EncodingInfo()
          Creates an instance with emtpy values.
 
Method Summary
 int getBitrate()
          This method returns the bitrate of the represented audio clip in "Kbps".
 int getChannelNumber()
          This method returns the number of audio channels the clip contains.
 java.lang.String getEncodingType()
          Returns the encoding type.
 java.lang.String getExtraEncodingInfos()
          This method returns some extra information about the encoding.
 int getLength()
          This method returns the duration of the represented audio clip in seconds.
 float getPreciseLength()
          This method returns the duration of the represented audio clip in seconds (single-precision).
 int getSamplingRate()
          This method returns the sample rate, the audio clip was encoded with.
 boolean isVbr()
          This method returns true, if the audio file is encoded with "Variable Bitrate".
 void setBitrate(int bitrate)
          This Method sets the bitrate in "Kbps".
 void setChannelNumber(int chanNb)
          Sets the number of channels.
 void setEncodingType(java.lang.String encodingType)
          Sets the type of the encoding.
 void setExtraEncodingInfos(java.lang.String infos)
          A string contianing anything else that might be interesting
 void setLength(int length)
          This method sets the audio duration of the represented clip.
 void setPreciseLength(float seconds)
          This method sets the audio duration of the represented clip.
 void setSamplingRate(int samplingRate)
          Sets the Sampling rate in "Hz"
 void setVbr(boolean b)
          Sets the VBR flag for the represented audio clip.
 java.lang.String toString()
          Pretty prints this encoding info
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FIELD_BITRATE

public static final java.lang.String FIELD_BITRATE
The key for the Bitrate.(Integer)

See Also:
#content, Constant Field Values

FIELD_CHANNEL

public static final java.lang.String FIELD_CHANNEL
The key for the number of audio channels.(Integer)

See Also:
#content, Constant Field Values

FIELD_INFOS

public static final java.lang.String FIELD_INFOS
The key for the extra encoding information.(String)

See Also:
#content, Constant Field Values

FIELD_LENGTH

public static final java.lang.String FIELD_LENGTH
The key for the audio clip duration in seconds. (Float)

See Also:
#content, Constant Field Values

FIELD_SAMPLERATE

public static final java.lang.String FIELD_SAMPLERATE
The key for the audio sample rate in "Hz". (Integer)

See Also:
#content, Constant Field Values

FIELD_TYPE

public static final java.lang.String FIELD_TYPE
The key for the audio type.(String)

See Also:
#content, Constant Field Values

FIELD_VBR

public static final java.lang.String FIELD_VBR
The key for the VBR flag. (Boolean)

See Also:
#content, Constant Field Values
Constructor Detail

EncodingInfo

public EncodingInfo()
Creates an instance with emtpy values.

Method Detail

getBitrate

public int getBitrate()
This method returns the bitrate of the represented audio clip in "Kbps".

Returns:
The bitrate in Kbps.

getChannelNumber

public int getChannelNumber()
This method returns the number of audio channels the clip contains.
(The stereo, mono thing).

Returns:
The number of channels. (2 for stereo, 1 for mono)

getEncodingType

public java.lang.String getEncodingType()
Returns the encoding type.

Returns:
The encoding type

getExtraEncodingInfos

public java.lang.String getExtraEncodingInfos()
This method returns some extra information about the encoding.
This may not contain anything for some audio formats.

Returns:
Some extra information.

getLength

public int getLength()
This method returns the duration of the represented audio clip in seconds.

Returns:
The duration in seconds.
See Also:
getPreciseLength()

getPreciseLength

public float getPreciseLength()
This method returns the duration of the represented audio clip in seconds (single-precision).

Returns:
The duration in seconds.
See Also:
getLength()

getSamplingRate

public int getSamplingRate()
This method returns the sample rate, the audio clip was encoded with.

Returns:
Sample rate of the audio clip in "Hz".

isVbr

public boolean isVbr()
This method returns true, if the audio file is encoded with "Variable Bitrate".

Returns:
true if audio clip is encoded with VBR.

setBitrate

public void setBitrate(int bitrate)
This Method sets the bitrate in "Kbps".

Parameters:
bitrate - bitrate in kbps.

setChannelNumber

public void setChannelNumber(int chanNb)
Sets the number of channels.

Parameters:
chanNb - number of channels (2 for stereo, 1 for mono).

setEncodingType

public void setEncodingType(java.lang.String encodingType)
Sets the type of the encoding.
This is a bit format specific.
eg:Layer I/II/III

Parameters:
encodingType - Encoding type.

setExtraEncodingInfos

public void setExtraEncodingInfos(java.lang.String infos)
A string contianing anything else that might be interesting

Parameters:
infos - Extra information.

setLength

public void setLength(int length)
This method sets the audio duration of the represented clip.

Parameters:
length - The duration of the audio clip in seconds.

setPreciseLength

public void setPreciseLength(float seconds)
This method sets the audio duration of the represented clip.

Parameters:
seconds - The duration of the audio clip in seconds (single-precision).

setSamplingRate

public void setSamplingRate(int samplingRate)
Sets the Sampling rate in "Hz"

Parameters:
samplingRate - Sample rate.

setVbr

public void setVbr(boolean b)
Sets the VBR flag for the represented audio clip.

Parameters:
b - true if VBR.

toString

public java.lang.String toString()
Pretty prints this encoding info

See Also:
Object.toString()