Class MpegAudioUtil
- java.lang.Object
-
- com.google.android.exoplayer2.audio.MpegAudioUtil
-
public final class MpegAudioUtil extends Object
Utility methods for handling MPEG audio streams.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMpegAudioUtil.HeaderStores the metadata for an MPEG audio frame.
-
Field Summary
Fields Modifier and Type Field Description static intMAX_FRAME_SIZE_BYTESTheoretical maximum frame size for an MPEG audio stream, which occurs when playing a Layer 2 MPEG 2.5 audio stream at 16 kb/s (with padding).static intMAX_RATE_BYTES_PER_SECONDMaximum rate for an MPEG audio stream corresponding to MPEG-1 layer III (320 kbit/s), in bytes per second.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intgetFrameSize(int headerData)Returns the size of the frame associated withheader, orC.LENGTH_UNSETif it is invalid.static intparseMpegAudioFrameSampleCount(int headerData)Returns the number of samples per frame associated withheaderData, orC.LENGTH_UNSETif it is invalid.
-
-
-
Field Detail
-
MAX_FRAME_SIZE_BYTES
public static final int MAX_FRAME_SIZE_BYTES
Theoretical maximum frame size for an MPEG audio stream, which occurs when playing a Layer 2 MPEG 2.5 audio stream at 16 kb/s (with padding). The size is 1152 sample/frame * 160000 bit/s / (8000 sample/s * 8 bit/byte) + 1 padding byte/frame = 2881 byte/frame. The next power of two size is 4 KiB.- See Also:
- Constant Field Values
-
MAX_RATE_BYTES_PER_SECOND
public static final int MAX_RATE_BYTES_PER_SECOND
Maximum rate for an MPEG audio stream corresponding to MPEG-1 layer III (320 kbit/s), in bytes per second.- See Also:
- Constant Field Values
-
-
Method Detail
-
getFrameSize
public static int getFrameSize(int headerData)
Returns the size of the frame associated withheader, orC.LENGTH_UNSETif it is invalid.
-
parseMpegAudioFrameSampleCount
public static int parseMpegAudioFrameSampleCount(int headerData)
Returns the number of samples per frame associated withheaderData, orC.LENGTH_UNSETif it is invalid.
-
-