entagged.audioformats
Class EncodingInfo

java.lang.Object
  extended by entagged.audioformats.EncodingInfo

public class EncodingInfo
extends 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 String FIELD_BITRATE
          The key for the Bitrate.(Integer)
static String FIELD_CHANNEL
          The key for the number of audio channels.(Integer)
static String FIELD_INFOS
          The key for the extra encoding information.(String)
static String FIELD_LENGTH
          The key for the audio clip duration in seconds.
static String FIELD_SAMPLERATE
          The key for the audio sample rate in "Hz".
static String FIELD_TYPE
          The key for the audio type.(String)
static 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.
(The stereo, mono thing).
 String getEncodingType()
          Returns the encoding type.
 String getExtraEncodingInfos()
          This method returns some extra information about the encoding.
This may not contain anything for some audio formats.
 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(String encodingType)
          Sets the type of the encoding.
This is a bit format specific.
eg:Layer I/II/III
 void setExtraEncodingInfos(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.
 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 String FIELD_BITRATE
The key for the Bitrate.(Integer)

See Also:
content, Constant Field Values

FIELD_CHANNEL

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

See Also:
content, Constant Field Values

FIELD_INFOS

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

See Also:
content, Constant Field Values

FIELD_LENGTH

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

See Also:
content, Constant Field Values

FIELD_SAMPLERATE

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

See Also:
content, Constant Field Values

FIELD_TYPE

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

See Also:
content, Constant Field Values

FIELD_VBR

public static final 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 String getEncodingType()
Returns the encoding type.

Returns:
The encoding type

getExtraEncodingInfos

public 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(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(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 String toString()
Pretty prints this encoding info

Overrides:
toString in class Object
See Also:
Object.toString()


Copyright © 2007-2008. All Rights Reserved.