Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.esau.ptarmigan.impl
Class MPEGFrameHeader  view MPEGFrameHeader download MPEGFrameHeader.java

java.lang.Object
  extended byorg.esau.ptarmigan.impl.MPEGFrameHeader

public final class MPEGFrameHeader
extends java.lang.Object

MPEG Frame Header

Parse and validate a 4-byte MPEG Header

Version:
$Revision: 1.2 $ $Date: 2002/10/02 05:27:03 $

Field Summary
(package private) static int AUDIO_VER_MASK
           
(package private) static int AUDIO_VER_RESERVED
           
(package private) static int AUDIO_VER_SHIFT
           
(package private) static int AUDIO_VER_VERSION_1
           
(package private) static int AUDIO_VER_VERSION_2
           
(package private) static int AUDIO_VER_VERSION_2_5
           
(package private) static int BAD
           
(package private) static int[][] BIT_RATES
           
(package private) static int BITRATE_MASK
           
(package private) static int BITRATE_SHIFT
           
(package private) static int CHANNEL_DUAL
           
(package private) static int CHANNEL_JOINT_STEREO
           
(package private) static int CHANNEL_MASK
           
(package private) static int CHANNEL_SHIFT
           
(package private) static int CHANNEL_SINGLE
           
(package private) static int CHANNEL_STEREO
           
(package private) static int COPYRIGHT_MASK
           
(package private) static int EMPHASIS_MASK
           
(package private) static int EMPHASIS_SHIFT
           
(package private) static int FRAME_SYNC_MASK
           
(package private) static int FREE
           
(package private) static int HEADER_SIZE
           
(package private) static int LAYER_I
           
(package private) static int LAYER_II
           
(package private) static int LAYER_III
           
(package private) static int LAYER_MASK
           
(package private) static int LAYER_RESERVED
           
(package private) static int LAYER_SHIFT
           
(package private) static org.apache.commons.logging.Log log
          logging object
(package private) static int LOOKUP_FAILURE
           
(package private)  int m_audio_ver
           
(package private)  int m_bit_rate
           
(package private)  int m_bitrate_index
           
(package private)  int m_channel_mode
           
(package private)  boolean m_copyright
           
(package private)  int m_emphasis
           
(package private)  int m_frame_length
           
(package private)  int m_layer_code
           
(package private)  int m_mode_ext
           
(package private)  boolean m_original
           
(package private)  boolean m_padding
           
(package private)  boolean m_private_bit
           
(package private)  boolean m_protection
           
(package private)  int m_sample_index
           
(package private)  int m_sample_rate
           
(package private) static int MODE_EXT_MASK
           
(package private) static int MODE_EXT_SHIFT
           
(package private) static int ORIGINAL_MASK
           
(package private) static int PADDING_MASK
           
(package private) static int PRIVATE_MASK
           
(package private) static int PROTECTION_MASK
           
(package private) static java.lang.String[] S_AUDIO_VER
           
(package private) static java.lang.String[] S_CHANNEL_MODE
           
(package private) static int[] S_LAYER
           
(package private) static java.lang.String[] S_MODE_EXT_LAYER_I_II
           
(package private) static java.lang.String[] S_MODE_EXT_LAYER_III
           
(package private) static int SAMPLE_MASK
           
(package private) static int[][] SAMPLE_RATES
           
(package private) static int SAMPLE_SHIFT
           
(package private) static int SLOT_LAYER_I
           
(package private) static int SLOT_LAYER_II_III
           
 
Constructor Summary
MPEGFrameHeader()
          ctor
MPEGFrameHeader(MPEGFrameHeader other)
          copy ctor
 
Method Summary
(package private)  boolean calculateFrameLength()
          frame length in bytes
 java.lang.String getAudioVersion()
           
 int getBitRate()
           
 java.lang.String getChannelDesc()
           
 int getChannelMode()
           
 int getChannels()
           
 boolean getCopyright()
           
 int getEmphasis()
           
 int getFrameLength()
           
 int getLayer()
           
 int getModeExt()
           
 boolean getOriginal()
           
 boolean getPadding()
           
 boolean getPrivateBit()
           
 boolean getProtection()
           
 int getSampleRate()
           
 boolean initHeader(byte[] buf, int offset)
          Try to identify a frame header in the specified buffer at the specified offset.
(package private)  boolean lookupBitRate()
          bit rate in bits per second
(package private)  boolean lookupSampleRate()
          sample rate
 void resetData()
           
(package private)  boolean validate()
          A number of tests to validate a single frame.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_audio_ver

int m_audio_ver

m_layer_code

int m_layer_code

m_protection

boolean m_protection

m_bitrate_index

int m_bitrate_index

m_sample_index

int m_sample_index

m_padding

boolean m_padding

m_private_bit

boolean m_private_bit

m_channel_mode

int m_channel_mode

m_mode_ext

int m_mode_ext

m_copyright

boolean m_copyright

m_original

boolean m_original

m_emphasis

int m_emphasis

m_bit_rate

int m_bit_rate

m_sample_rate

int m_sample_rate

m_frame_length

int m_frame_length

FRAME_SYNC_MASK

static final int FRAME_SYNC_MASK
See Also:
Constant Field Values

AUDIO_VER_MASK

static final int AUDIO_VER_MASK
See Also:
Constant Field Values

AUDIO_VER_SHIFT

static final int AUDIO_VER_SHIFT
See Also:
Constant Field Values

LAYER_MASK

static final int LAYER_MASK
See Also:
Constant Field Values

LAYER_SHIFT

static final int LAYER_SHIFT
See Also:
Constant Field Values

PROTECTION_MASK

static final int PROTECTION_MASK
See Also:
Constant Field Values

BITRATE_MASK

static final int BITRATE_MASK
See Also:
Constant Field Values

BITRATE_SHIFT

static final int BITRATE_SHIFT
See Also:
Constant Field Values

SAMPLE_MASK

static final int SAMPLE_MASK
See Also:
Constant Field Values

SAMPLE_SHIFT

static final int SAMPLE_SHIFT
See Also:
Constant Field Values

PADDING_MASK

static final int PADDING_MASK
See Also:
Constant Field Values

PRIVATE_MASK

static final int PRIVATE_MASK
See Also:
Constant Field Values

CHANNEL_MASK

static final int CHANNEL_MASK
See Also:
Constant Field Values

CHANNEL_SHIFT

static final int CHANNEL_SHIFT
See Also:
Constant Field Values

MODE_EXT_MASK

static final int MODE_EXT_MASK
See Also:
Constant Field Values

MODE_EXT_SHIFT

static final int MODE_EXT_SHIFT
See Also:
Constant Field Values

COPYRIGHT_MASK

static final int COPYRIGHT_MASK
See Also:
Constant Field Values

ORIGINAL_MASK

static final int ORIGINAL_MASK
See Also:
Constant Field Values

EMPHASIS_MASK

static final int EMPHASIS_MASK
See Also:
Constant Field Values

EMPHASIS_SHIFT

static final int EMPHASIS_SHIFT
See Also:
Constant Field Values

LOOKUP_FAILURE

static final int LOOKUP_FAILURE
See Also:
Constant Field Values

FREE

static final int FREE
See Also:
Constant Field Values

BAD

static final int BAD
See Also:
Constant Field Values

BIT_RATES

static final int[][] BIT_RATES

SAMPLE_RATES

static final int[][] SAMPLE_RATES

S_AUDIO_VER

static final java.lang.String[] S_AUDIO_VER

S_LAYER

static final int[] S_LAYER

S_CHANNEL_MODE

static final java.lang.String[] S_CHANNEL_MODE

S_MODE_EXT_LAYER_I_II

static final java.lang.String[] S_MODE_EXT_LAYER_I_II

S_MODE_EXT_LAYER_III

static final java.lang.String[] S_MODE_EXT_LAYER_III

HEADER_SIZE

static final int HEADER_SIZE
See Also:
Constant Field Values

AUDIO_VER_VERSION_2_5

static final int AUDIO_VER_VERSION_2_5
See Also:
Constant Field Values

AUDIO_VER_RESERVED

static final int AUDIO_VER_RESERVED
See Also:
Constant Field Values

AUDIO_VER_VERSION_2

static final int AUDIO_VER_VERSION_2
See Also:
Constant Field Values

AUDIO_VER_VERSION_1

static final int AUDIO_VER_VERSION_1
See Also:
Constant Field Values

LAYER_RESERVED

static final int LAYER_RESERVED
See Also:
Constant Field Values

LAYER_III

static final int LAYER_III
See Also:
Constant Field Values

LAYER_II

static final int LAYER_II
See Also:
Constant Field Values

LAYER_I

static final int LAYER_I
See Also:
Constant Field Values

CHANNEL_STEREO

static final int CHANNEL_STEREO
See Also:
Constant Field Values

CHANNEL_JOINT_STEREO

static final int CHANNEL_JOINT_STEREO
See Also:
Constant Field Values

CHANNEL_DUAL

static final int CHANNEL_DUAL
See Also:
Constant Field Values

CHANNEL_SINGLE

static final int CHANNEL_SINGLE
See Also:
Constant Field Values

SLOT_LAYER_I

static final int SLOT_LAYER_I
See Also:
Constant Field Values

SLOT_LAYER_II_III

static final int SLOT_LAYER_II_III
See Also:
Constant Field Values

log

static org.apache.commons.logging.Log log
logging object

Constructor Detail

MPEGFrameHeader

public MPEGFrameHeader()
ctor


MPEGFrameHeader

public MPEGFrameHeader(MPEGFrameHeader other)
copy ctor

Method Detail

initHeader

public boolean initHeader(byte[] buf,
                          int offset)
Try to identify a frame header in the specified buffer at the specified offset. Note that it's not definitive. You have to look for repeating MPEG frames and check CRCs to make sure. AAAAAAAA AAABBCCD EEEEFFGH IIJJKLMM


getAudioVersion

public java.lang.String getAudioVersion()

getLayer

public int getLayer()

getProtection

public boolean getProtection()

getPadding

public boolean getPadding()

getPrivateBit

public boolean getPrivateBit()

getChannelMode

public int getChannelMode()

getModeExt

public int getModeExt()

getChannels

public int getChannels()

getChannelDesc

public java.lang.String getChannelDesc()

getCopyright

public boolean getCopyright()

getOriginal

public boolean getOriginal()

getEmphasis

public int getEmphasis()

getBitRate

public int getBitRate()

getSampleRate

public int getSampleRate()

getFrameLength

public int getFrameLength()

validate

boolean validate()
A number of tests to validate a single frame. The results are not definitive. For best results, check consecutive frames and the CRC, if present.


lookupBitRate

boolean lookupBitRate()
bit rate in bits per second


lookupSampleRate

boolean lookupSampleRate()
sample rate


calculateFrameLength

boolean calculateFrameLength()
frame length in bytes


resetData

public void resetData()