|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jaudiotagger.audio.mp3.MPEGFrameHeader
public class MPEGFrameHeader
Represents a MPEGFrameHeader, an MP3 is made up of a number of frames each frame starts with a four byte frame header.
Field Summary | |
---|---|
private java.lang.Integer |
bitRate
Bitrate of this frame |
private static java.util.Map<java.lang.Integer,java.lang.Integer> |
bitrateMap
Bit Rates, the setBitrate varies for different Version and Layer |
private static int |
BYTE_1
Constants for MP3 Frame header, each frame has a basic header of 4 bytes |
private static int |
BYTE_2
|
private static int |
BYTE_3
|
private static int |
BYTE_4
|
private int |
channelMode
Channel Mode of this Frame (see constants) |
private java.lang.String |
channelModeAsString
Channel Mode of this Frame As English String |
private int |
emphasis
Emphasis of this frame |
static int |
EMPHASIS_5015MS
|
static int |
EMPHASIS_CCITT
|
static int |
EMPHASIS_NONE
|
static int |
EMPHASIS_RESERVED
|
private java.lang.String |
emphasisAsString
Emphasis mode string |
private static java.util.Map<java.lang.Integer,java.lang.String> |
emphasisMap
Constants for Emphasis |
private static byte[] |
header
|
static int |
HEADER_SIZE
|
private boolean |
isCopyrighted
Flag indicating if this frame contains copyrighted material |
private boolean |
isOriginal
Flag indicating if this frame contains original material |
private boolean |
isPadding
Flag indicating if this frame has padding byte |
private boolean |
isPrivate
Flag indicating if this frame is private |
private boolean |
isProtected
Flag indicating if this frame is protected |
private int |
layer
Contains the mpeg layer of this frame (see constants) |
static int |
LAYER_I
|
private static int |
LAYER_I_FRAME_SIZE_COEFFICIENT
|
static int |
LAYER_I_SLOT_SIZE
Slot Size is dependent on Layer |
static int |
LAYER_II
|
private static int |
LAYER_II_FRAME_SIZE_COEFFICIENT
|
static int |
LAYER_II_SLOT_SIZE
|
static int |
LAYER_III
|
private static int |
LAYER_III_FRAME_SIZE_COEFFICIENT
|
static int |
LAYER_III_SLOT_SIZE
|
private java.lang.String |
layerAsString
|
private static int |
MASK_MP3_BITRATE
The setBitrate of this MP3 |
private static int |
MASK_MP3_COPY
MP3 Frame Header bit mask |
private static int |
MASK_MP3_EMPHASIS
MP3 Frame Header bit mask |
private static int |
MASK_MP3_FREQUENCY
The sampling/frequency rate |
private static int |
MASK_MP3_HOME
MP3 Frame Header bit mask |
private static int |
MASK_MP3_ID
MP3 Frame Header bit mask |
private static int |
MASK_MP3_LAYER
MP3 Layer, for MP3s the Layer is 3 |
private static int |
MASK_MP3_MODE
Channel Mode, Stero/Mono/Dual Channel |
private static int |
MASK_MP3_MODE_EXTENSION
MP3 Frame Header bit mask |
private static int |
MASK_MP3_PADDING
An extra padding bit is sometimes used to make sure frames are exactly the right length |
private static int |
MASK_MP3_PRIVACY
Private bit set, for application specific |
private static int |
MASK_MP3_PROTECTION
Does it include a CRC Checksum at end of header, this can be used to check the header. |
private static int |
MASK_MP3_VERSION
MP3 version, confusingly for MP3s the version is 1. |
static int |
MODE_DUAL_CHANNEL
|
private static int |
MODE_EXTENSION_NONE
|
private static int |
MODE_EXTENSION_OFF_OFF
|
private static int |
MODE_EXTENSION_OFF_ON
|
private static int |
MODE_EXTENSION_ON_OFF
|
private static int |
MODE_EXTENSION_ON_ON
|
private static int |
MODE_EXTENSION_ONE
|
private static int |
MODE_EXTENSION_THREE
|
private static int |
MODE_EXTENSION_TWO
|
static int |
MODE_JOINT_STEREO
|
static int |
MODE_MONO
|
static int |
MODE_STEREO
|
private java.lang.String |
modeExtension
Mode Extension |
private static java.util.Map<java.lang.Integer,java.lang.String> |
modeExtensionLayerIIIMap
|
private static java.util.Map<java.lang.Integer,java.lang.String> |
modeExtensionMap
|
protected static java.util.Map<java.lang.Integer,java.lang.String> |
modeMap
Constants for Channel mode |
private byte[] |
mpegBytes
|
static java.util.Map<java.lang.Integer,java.lang.String> |
mpegLayerMap
Constants for MPEG Layer |
static java.util.Map<java.lang.Integer,java.lang.String> |
mpegVersionMap
Constants for MPEG Version |
private static java.util.Map<java.lang.Integer,java.util.Map<java.lang.Integer,java.lang.Integer>> |
samplesPerFrameMap
|
private static java.util.Map<java.lang.Integer,java.lang.Integer> |
samplesPerFrameV1Map
|
private static java.util.Map<java.lang.Integer,java.lang.Integer> |
samplesPerFrameV25Map
|
private static java.util.Map<java.lang.Integer,java.lang.Integer> |
samplesPerFrameV2Map
|
private java.lang.Integer |
samplingRate
|
private static java.util.Map<java.lang.Integer,java.util.Map<java.lang.Integer,java.lang.Integer>> |
samplingRateMap
Sampling Rate in Hz |
private static java.util.Map<java.lang.Integer,java.lang.Integer> |
samplingV1Map
|
private static java.util.Map<java.lang.Integer,java.lang.Integer> |
samplingV25Map
|
private static java.util.Map<java.lang.Integer,java.lang.Integer> |
samplingV2Map
|
private static int |
SCALE_BY_THOUSAND
|
static int |
SYNC_BYTE1
|
static int |
SYNC_BYTE2
|
static int |
SYNC_SIZE
Sync Value to identify the start of an MPEGFrame |
private int |
version
The version of this MPEG frame (see the constants) |
static int |
VERSION_1
|
static int |
VERSION_2
|
static int |
VERSION_2_5
|
private java.lang.String |
versionAsString
|
Constructor Summary | |
---|---|
private |
MPEGFrameHeader()
Hide Constructor |
private |
MPEGFrameHeader(byte[] b)
Try and create a new MPEG frame with the given byte array and decodes its contents If decoding header causes a problem it is not a valid header |
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 |
private void |
setBitrate()
Get the setBitrate of this frame |
private void |
setChannelMode()
Set the Mpeg channel mode of this frame as a constant (see constants) |
private void |
setCopyrighted()
Gets the copyrighted attribute of the MPEGFrame object |
private void |
setEmphasis()
Get the setEmphasis mode of this frame in a string representation |
private void |
setLayer()
Get the layer version of this frame as a constant int value (see constants) |
private void |
setModeExtension()
Sets the string representation of the mode extension of this frame |
private void |
setOriginal()
Sets the original attribute of the MPEGFrame object |
private void |
setPadding()
Set whether this frame uses padding bytes |
private void |
setPrivate()
Sets the private attribute of the MPEGFrame object |
private void |
setProtected()
Sets the protected attribute of the MPEGFrame object |
private void |
setSamplingRate()
set the sampling rate in Hz of this frame |
private void |
setVersion()
Set the version of this frame as an int value (see constants) |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final int BYTE_1
private static final int BYTE_2
private static final int BYTE_3
private static final int BYTE_4
public static final int HEADER_SIZE
public static final int SYNC_SIZE
public static final int SYNC_BYTE1
public static final int SYNC_BYTE2
private static final byte[] header
public static final java.util.Map<java.lang.Integer,java.lang.String> mpegVersionMap
public static final int VERSION_2_5
public static final int VERSION_2
public static final int VERSION_1
public static final java.util.Map<java.lang.Integer,java.lang.String> mpegLayerMap
public static final int LAYER_I
public static final int LAYER_II
public static final int LAYER_III
public static final int LAYER_I_SLOT_SIZE
public static final int LAYER_II_SLOT_SIZE
public static final int LAYER_III_SLOT_SIZE
private static final java.util.Map<java.lang.Integer,java.lang.Integer> bitrateMap
protected static final java.util.Map<java.lang.Integer,java.lang.String> modeMap
public static final int MODE_STEREO
public static final int MODE_JOINT_STEREO
public static final int MODE_DUAL_CHANNEL
public static final int MODE_MONO
private static final java.util.Map<java.lang.Integer,java.lang.String> emphasisMap
public static final int EMPHASIS_NONE
public static final int EMPHASIS_5015MS
public static final int EMPHASIS_RESERVED
public static final int EMPHASIS_CCITT
private static final java.util.Map<java.lang.Integer,java.lang.String> modeExtensionMap
private static final int MODE_EXTENSION_NONE
private static final int MODE_EXTENSION_ONE
private static final int MODE_EXTENSION_TWO
private static final int MODE_EXTENSION_THREE
private static final java.util.Map<java.lang.Integer,java.lang.String> modeExtensionLayerIIIMap
private static final int MODE_EXTENSION_OFF_OFF
private static final int MODE_EXTENSION_ON_OFF
private static final int MODE_EXTENSION_OFF_ON
private static final int MODE_EXTENSION_ON_ON
private static final java.util.Map<java.lang.Integer,java.util.Map<java.lang.Integer,java.lang.Integer>> samplingRateMap
private static final java.util.Map<java.lang.Integer,java.lang.Integer> samplingV1Map
private static final java.util.Map<java.lang.Integer,java.lang.Integer> samplingV2Map
private static final java.util.Map<java.lang.Integer,java.lang.Integer> samplingV25Map
private static final java.util.Map<java.lang.Integer,java.util.Map<java.lang.Integer,java.lang.Integer>> samplesPerFrameMap
private static final java.util.Map<java.lang.Integer,java.lang.Integer> samplesPerFrameV1Map
private static final java.util.Map<java.lang.Integer,java.lang.Integer> samplesPerFrameV2Map
private static final java.util.Map<java.lang.Integer,java.lang.Integer> samplesPerFrameV25Map
private static final int SCALE_BY_THOUSAND
private static final int LAYER_I_FRAME_SIZE_COEFFICIENT
private static final int LAYER_II_FRAME_SIZE_COEFFICIENT
private static final int LAYER_III_FRAME_SIZE_COEFFICIENT
private static final int MASK_MP3_ID
private static final int MASK_MP3_VERSION
private static final int MASK_MP3_LAYER
private static final int MASK_MP3_PROTECTION
private static final int MASK_MP3_BITRATE
private static final int MASK_MP3_FREQUENCY
private static final int MASK_MP3_PADDING
private static final int MASK_MP3_PRIVACY
private static final int MASK_MP3_MODE
private static final int MASK_MP3_MODE_EXTENSION
private static final int MASK_MP3_COPY
private static final int MASK_MP3_HOME
private static final int MASK_MP3_EMPHASIS
private byte[] mpegBytes
private int version
private java.lang.String versionAsString
private int layer
private java.lang.String layerAsString
private java.lang.Integer bitRate
private int channelMode
private java.lang.String channelModeAsString
private int emphasis
private java.lang.String emphasisAsString
private java.lang.String modeExtension
private boolean isPadding
private boolean isCopyrighted
private boolean isOriginal
private boolean isProtected
private boolean isPrivate
private java.lang.Integer samplingRate
Constructor Detail |
---|
private MPEGFrameHeader() throws InvalidAudioFrameException
InvalidAudioFrameException
private MPEGFrameHeader(byte[] b) throws InvalidAudioFrameException
b
- the array of bytes representing this mpeg frame
InvalidAudioFrameException
- if does not match expected formatMethod Detail |
---|
public int getLayer()
public java.lang.String getLayerAsString()
private void setCopyrighted()
private void setVersion() throws InvalidAudioFrameException
InvalidAudioFrameException
private void setOriginal()
private void setProtected()
private void setPrivate()
private void setBitrate() throws InvalidAudioFrameException
InvalidAudioFrameException
private void setChannelMode() throws InvalidAudioFrameException
InvalidAudioFrameException
private void setEmphasis() throws InvalidAudioFrameException
InvalidAudioFrameException
private void setPadding()
private void setLayer() throws InvalidAudioFrameException
InvalidAudioFrameException
private void setModeExtension() throws InvalidAudioFrameException
InvalidAudioFrameException
private void setSamplingRate() throws InvalidAudioFrameException
InvalidAudioFrameException
public int getNumberOfChannels()
public int getChannelMode()
public java.lang.String getChannelModeAsString()
public int getVersion()
public java.lang.String getVersionAsString()
public int getPaddingLength()
public java.lang.Integer getBitRate()
public java.lang.Integer getSamplingRate()
public int getFrameLength()
public int getNoOfSamples()
public boolean isPadding()
public boolean isCopyrighted()
public boolean isOriginal()
public boolean isProtected()
public boolean isPrivate()
public boolean isVariableBitRate()
public int getEmphasis()
public java.lang.String getEmphasisAsString()
public java.lang.String getModeExtension()
public static MPEGFrameHeader parseMPEGHeader(java.nio.ByteBuffer bb) throws InvalidAudioFrameException
bb
- the byte buffer containing the header
InvalidAudioFrameException
- if there is no header at this pointpublic static boolean isMPEGFrame(java.nio.ByteBuffer bb)
bb
-
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |