MpegAudioUtil
@UnstableApi
public final class MpegAudioUtil
Utility methods for handling MPEG audio streams.
Summary
Nested types |
|---|
public final class MpegAudioUtil.HeaderStores the metadata for an MPEG audio frame. |
Constants |
|
|---|---|
static final int |
MAX_FRAME_SIZE_BYTES = 4096Theoretical 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 final int |
MAX_RATE_BYTES_PER_SECOND = 40000Maximum rate for an MPEG audio stream corresponding to MPEG-1 layer III (320 kbit/s), in bytes per second. |
Public methods |
|
|---|---|
static int |
getFrameSize(int headerData)Returns the size of the frame associated with |
static int |
parseMpegAudioFrameSampleCount(int headerData)Returns the number of samples per frame associated with |
Constants
MAX_FRAME_SIZE_BYTES
public static final int MAX_FRAME_SIZE_BYTES = 4096
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.
MAX_RATE_BYTES_PER_SECOND
public static final int MAX_RATE_BYTES_PER_SECOND = 40000
Maximum rate for an MPEG audio stream corresponding to MPEG-1 layer III (320 kbit/s), in bytes per second.
Public methods
getFrameSize
public static int getFrameSize(int headerData)
Returns the size of the frame associated with header, or LENGTH_UNSET if it is invalid.
parseMpegAudioFrameSampleCount
public static int parseMpegAudioFrameSampleCount(int headerData)
Returns the number of samples per frame associated with headerData, or LENGTH_UNSET if it is invalid.