org.jaudiotagger.audio.mp3
Class MPEGFrameHeader

java.lang.Object
  extended by org.jaudiotagger.audio.mp3.MPEGFrameHeader

public class MPEGFrameHeader
extends java.lang.Object

Represents a MPEGFrameHeader, an MP3 is made up of a number of frames each frame starts with a four byte frame header.


Field Summary
static int EMPHASIS_5015MS
           
static int EMPHASIS_CCITT
           
static int EMPHASIS_NONE
           
static int EMPHASIS_RESERVED
           
static int HEADER_SIZE
           
static int LAYER_I
           
static int LAYER_I_SLOT_SIZE
          Slot Size is dependent on Layer
static int LAYER_II
           
static int LAYER_II_SLOT_SIZE
           
static int LAYER_III
           
static int LAYER_III_SLOT_SIZE
           
static int MODE_DUAL_CHANNEL
           
static int MODE_JOINT_STEREO
           
static int MODE_MONO
           
static int MODE_STEREO
           
static java.util.Map mpegLayerMap
          Constants for MPEG Layer
static java.util.Map mpegVersionMap
          Constants for MPEG Version
static int SYNC_BYTE1
           
static int SYNC_BYTE2
           
static int SYNC_SIZE
          Sync Value to identify the start of an MPEGFrame
static int VERSION_1
           
static int VERSION_2
           
static int VERSION_2_5
           
 
Method Summary
 java.lang.Integer getBitRate()
           
 int getChannelMode()
           
 java.lang.String getChannelModeAsString()
           
 int getEmphasis()
           
 java.lang.String getEmphasisAsString()
           
 int getFrameLength()
           
 int getLayer()
          Gets the layerVersion attribute of the MPEGFrame object
 java.lang.String getLayerAsString()
           
 java.lang.String getModeExtension()
           
 int getNoOfSamples()
          Get the number of samples in a frame, all frames in a file have a set number of samples as defined by their MPEG Versiona and Layer
 int getNumberOfChannels()
          Gets the number of channels
 int getPaddingLength()
          Gets the paddingLength attribute of the MPEGFrame object
 java.lang.Integer getSamplingRate()
           
 int getVersion()
          Gets the mPEGVersion attribute of the MPEGFrame object
 java.lang.String getVersionAsString()
           
 boolean isCopyrighted()
           
static boolean isMPEGFrame(java.nio.ByteBuffer bb)
          Gets the MPEGFrame attribute of the MPEGFrame object
 boolean isOriginal()
           
 boolean isPadding()
           
 boolean isPrivate()
           
 boolean isProtected()
           
 boolean isVariableBitRate()
           
static MPEGFrameHeader parseMPEGHeader(java.nio.ByteBuffer bb)
          Parse the MPEGFrameHeader of an MP3File, file pointer returns at end of the frame header
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

HEADER_SIZE

public static final int HEADER_SIZE
See Also:
Constant Field Values

SYNC_SIZE

public static final int SYNC_SIZE
Sync Value to identify the start of an MPEGFrame

See Also:
Constant Field Values

SYNC_BYTE1

public static final int SYNC_BYTE1
See Also:
Constant Field Values

SYNC_BYTE2

public static final int SYNC_BYTE2
See Also:
Constant Field Values

mpegVersionMap

public static final java.util.Map mpegVersionMap
Constants for MPEG Version


VERSION_2_5

public static final int VERSION_2_5
See Also:
Constant Field Values

VERSION_2

public static final int VERSION_2
See Also:
Constant Field Values

VERSION_1

public static final int VERSION_1
See Also:
Constant Field Values

mpegLayerMap

public static final java.util.Map mpegLayerMap
Constants for MPEG Layer


LAYER_I

public static final int LAYER_I
See Also:
Constant Field Values

LAYER_II

public static final int LAYER_II
See Also:
Constant Field Values

LAYER_III

public static final int LAYER_III
See Also:
Constant Field Values

LAYER_I_SLOT_SIZE

public static final int LAYER_I_SLOT_SIZE
Slot Size is dependent on Layer

See Also:
Constant Field Values

LAYER_II_SLOT_SIZE

public static final int LAYER_II_SLOT_SIZE
See Also:
Constant Field Values

LAYER_III_SLOT_SIZE

public static final int LAYER_III_SLOT_SIZE
See Also:
Constant Field Values

MODE_STEREO

public static final int MODE_STEREO
See Also:
Constant Field Values

MODE_JOINT_STEREO

public static final int MODE_JOINT_STEREO
See Also:
Constant Field Values

MODE_DUAL_CHANNEL

public static final int MODE_DUAL_CHANNEL
See Also:
Constant Field Values

MODE_MONO

public static final int MODE_MONO
See Also:
Constant Field Values

EMPHASIS_NONE

public static final int EMPHASIS_NONE
See Also:
Constant Field Values

EMPHASIS_5015MS

public static final int EMPHASIS_5015MS
See Also:
Constant Field Values

EMPHASIS_RESERVED

public static final int EMPHASIS_RESERVED
See Also:
Constant Field Values

EMPHASIS_CCITT

public static final int EMPHASIS_CCITT
See Also:
Constant Field Values
Method Detail

getLayer

public int getLayer()
Gets the layerVersion attribute of the MPEGFrame object

Returns:
The layerVersion value

getLayerAsString

public java.lang.String getLayerAsString()

getNumberOfChannels

public int getNumberOfChannels()
Gets the number of channels

Returns:
The setChannelMode value

getChannelMode

public int getChannelMode()

getChannelModeAsString

public java.lang.String getChannelModeAsString()

getVersion

public int getVersion()
Gets the mPEGVersion attribute of the MPEGFrame object

Returns:
The mPEGVersion value

getVersionAsString

public java.lang.String getVersionAsString()

getPaddingLength

public int getPaddingLength()
Gets the paddingLength attribute of the MPEGFrame object

Returns:
The paddingLength value

getBitRate

public java.lang.Integer getBitRate()

getSamplingRate

public java.lang.Integer getSamplingRate()

getFrameLength

public int getFrameLength()

getNoOfSamples

public int getNoOfSamples()
Get the number of samples in a frame, all frames in a file have a set number of samples as defined by their MPEG Versiona and Layer


isPadding

public boolean isPadding()

isCopyrighted

public boolean isCopyrighted()

isOriginal

public boolean isOriginal()

isProtected

public boolean isProtected()

isPrivate

public boolean isPrivate()

isVariableBitRate

public boolean isVariableBitRate()

getEmphasis

public int getEmphasis()

getEmphasisAsString

public java.lang.String getEmphasisAsString()

getModeExtension

public java.lang.String getModeExtension()

parseMPEGHeader

public static MPEGFrameHeader parseMPEGHeader(java.nio.ByteBuffer bb)
                                       throws InvalidAudioFrameException
Parse the MPEGFrameHeader of an MP3File, file pointer returns at end of the frame header

Parameters:
bb - the byte buffer containing the header
Returns:
Throws:
InvalidAudioFrameException - if there is no header at this point

isMPEGFrame

public static boolean isMPEGFrame(java.nio.ByteBuffer bb)
Gets the MPEGFrame attribute of the MPEGFrame object

Returns:
The mPEGFrame value

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
a string represntation