|
||||||||||
上一个类 下一个类 | 框架 无框架 | |||||||||
摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 |
java.lang.Objectjmp123.decoder.Header
public final class Header
帧同步及帧头信息解码。
源代码中解析帧头32位用到的变量及含义:
偏移量 | 长度 | 变量名 | 含义 |
---|---|---|---|
0 | 11 | 帧同步时直接解析 | 11位全设置为'1'的帧同步字 |
11 | 2 | verID | MPEG版本 |
13 | 2 | layer | MPEG压缩层 |
15 | 1 | protection_bit | 是否CRC |
16 | 4 | bitrate_index | 位率索引 |
20 | 2 | sampling_frequency | 采样率索引 |
22 | 1 | padding | 当前帧是否附加填充一槽数据 |
23 | 1 | 未解析 | 告知是否私有 |
24 | 2 | mode | 声道模式 |
26 | 2 | mode_extension | 声道扩展模式 |
28 | 1 | 未解析 | 告知是否有版权 |
29 | 1 | 未解析 | 告知是否为原版 |
30 | 2 | 不常用,未解析 | 预加重 |
字段摘要 | |
---|---|
static int |
MPEG1
MPEG版本MPEG-1。 |
static int |
MPEG2
MPEG版本MPEG-2。 |
static int |
MPEG25
MPEG版本MPEG-2.5(非官方版本)。 |
构造方法摘要 | |
---|---|
Header()
|
方法摘要 | |
---|---|
protected void |
decode(int h)
帧头解码。 |
int |
getBitrate()
获取当前帧的位率。 |
int |
getBitrateIndex()
获取当前帧的位率的索引值。 |
int |
getChannels()
获取声道数。 |
float |
getFrameDuration()
获取当前文件一帧的播放时间长度。 |
int |
getFrameSize()
获取帧长度。 |
int |
getLayer()
获取MPEG编码层。 |
int |
getMainDataSize()
获取主数据长度。 |
int |
getMode()
获取声道模式。 |
int |
getModeExtension()
获取声道扩展模式。 |
int |
getPcmSize()
获取当前帧解码后得到的PCM样本长度。 |
int |
getSamplingFrequency()
获取PCM样本采样率的索引值。 |
int |
getSamplingRate()
获取PCM样本采样率。 |
int |
getSideInfoSize()
获取边信息长度。 |
int |
getVersion()
获取MPEG版本。 |
protected void |
initialize()
初始化。 |
boolean |
isIntensityStereo()
获取声道模式是否为强度立体声(Intensity Stereo)模式。 |
boolean |
isMS()
获取声道模式是否为中/侧立体声(Mid/Side stereo)模式。 |
boolean |
isProtected()
是否有循环冗余校验码。 |
java.lang.String |
toString()
获取帧头的简短信息。 |
从类 java.lang.Object 继承的方法 |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
字段详细信息 |
---|
public static final int MPEG1
public static final int MPEG2
public static final int MPEG25
构造方法详细信息 |
---|
public Header()
方法详细信息 |
---|
protected void initialize()
protected void decode(int h)
h
- 帧头,大头在上的4字节(32位)整数。public boolean isProtected()
public boolean isMS()
public boolean isIntensityStereo()
public int getBitrate()
public int getBitrateIndex()
public int getChannels()
public int getMode()
返回值 | 声道模式 |
---|---|
0 | 立体声(stereo) |
1 | 联合立体声(joint stereo) |
2 | 双声道(dual channel) |
3 | 单声道(mono channel) |
getModeExtension()
public int getModeExtension()
返回值 | 强度立体声 | 中/侧立体声 |
---|---|---|
0 | off | off |
1 | on | off |
2 | off | on |
3 | on | on |
getMode()
public int getVersion()
MPEG1
、 MPEG2
或 MPEG25
。public int getLayer()
public int getSamplingFrequency()
public int getSamplingRate()
public int getMainDataSize()
public int getSideInfoSize()
public int getFrameSize()
帧的长度 = 4字节帧头 + CRC(如果有的话,2字节) + 音乐数据长度。
其中音乐数据长度 = 边信息长度 + 主数据长度。
无论是可变位率(VBR)编码的文件还是固定位率(CBR)编码的文件,每帧的长度不一定同。
public int getPcmSize()
public float getFrameDuration()
public java.lang.String toString()
java.lang.Object
中的 toString
|
||||||||||
上一个类 下一个类 | 框架 无框架 | |||||||||
摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 |