de.vdheide.mp3
Class MP3Properties

java.lang.Object
  extended byde.vdheide.mp3.MP3Properties

public class MP3Properties
extends java.lang.Object

This class reads properties like bit rate etc. from an MP3 file. Of course these properties are read only... It supports ID3v2, i.e. it reliably skips even files which tags do not use the unsynchronization scheme Illegal entries are marked with special return values, not with exceptions. This enables the class to continue reading other properties.


Field Summary
static int EMPHASIS_5015MS
          Emphasis: 5012ms
static int EMPHASIS_CCITT
          Emphasis: CCITT
static int EMPHASIS_ILLEGAL
          Emphasis: Illegal value
static int EMPHASIS_NONE
          Emphasis: None
static int MODE_DUAL_CHANNEL
          Mode: Dual channel
static int MODE_JOINT_STEREO
          Mode: Joint stereo
static int MODE_MONO
          Mode: Mono
static int MODE_STEREO
          Mode: Stereo
 
Constructor Summary
MP3Properties(java.io.File file)
          Create a new instance connected to file.
 
Method Summary
 int getBitrate()
           
 boolean getCopyright()
           
 int getEmphasis()
          Returns emphasis used in MP3 file.
 int getLayer()
           
 long getLength()
           
 int getMode()
          Returns mode (mono, stereo) used in MP3 file.
 int getMPEGLevel()
           
 boolean getOriginal()
           
 boolean getPadding()
           
 boolean getPrivate()
           
 boolean getProtection()
           
 int getSamplerate()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MODE_STEREO

public static final int MODE_STEREO
Mode: Stereo

See Also:
Constant Field Values

MODE_JOINT_STEREO

public static final int MODE_JOINT_STEREO
Mode: Joint stereo

See Also:
Constant Field Values

MODE_DUAL_CHANNEL

public static final int MODE_DUAL_CHANNEL
Mode: Dual channel

See Also:
Constant Field Values

MODE_MONO

public static final int MODE_MONO
Mode: Mono

See Also:
Constant Field Values

EMPHASIS_ILLEGAL

public static final int EMPHASIS_ILLEGAL
Emphasis: Illegal value

See Also:
Constant Field Values

EMPHASIS_NONE

public static final int EMPHASIS_NONE
Emphasis: None

See Also:
Constant Field Values

EMPHASIS_5015MS

public static final int EMPHASIS_5015MS
Emphasis: 5012ms

See Also:
Constant Field Values

EMPHASIS_CCITT

public static final int EMPHASIS_CCITT
Emphasis: CCITT

See Also:
Constant Field Values
Constructor Detail

MP3Properties

public MP3Properties(java.io.File file)
              throws java.io.IOException,
                     NoMP3FrameException
Create a new instance connected to file. Properties are read immediately.

Parameters:
file - File to connect to
Throws:
java.io.IOException - If an I/O error occurs
NoMP3FrameException - If file does not contain at least one mp3 frame
Method Detail

getMPEGLevel

public int getMPEGLevel()
Returns:
MPEG level

getLayer

public int getLayer()
Returns:
Layer, 0 for illegal entries

getBitrate

public int getBitrate()
Returns:
bitrate, 0 for illegal entries

getSamplerate

public int getSamplerate()
Returns:
samplerate, 0 for illegal entries

getMode

public int getMode()
Returns mode (mono, stereo) used in MP3 file. Please use the constants MODE_XXX.

Returns:
Mode

getEmphasis

public int getEmphasis()
Returns emphasis used in MP3 file. There are constants...

Returns:
emphasis

getProtection

public boolean getProtection()
Returns:
Protection set?

getPadding

public boolean getPadding()
Returns:
Padding set?

getPrivate

public boolean getPrivate()
Returns:
Private bit set?

getCopyright

public boolean getCopyright()
Returns:
Copyright bit set?

getOriginal

public boolean getOriginal()
Returns:
Original?

getLength

public long getLength()
Returns:
Length in seconds