Class MP3Header


  • public class MP3Header
    extends Object
    Header of a MP3 frame.
    Author:
    The Red5 Project, Joachim Bauch (jojo@struktur.de)
    See Also:
    File format
    • Constructor Detail

      • MP3Header

        public MP3Header​(int data)
                  throws Exception
        Creates MP3 header from frame sync value
        Parameters:
        data - Frame sync data
        Throws:
        Exception - On invalid frame synchronization
    • Method Detail

      • getData

        public int getData()
        Getter for frame sync word data
        Returns:
        Frame sync word data
      • isStereo

        public boolean isStereo()
        Whether stereo playback mode is used
        Returns:
        true if stereo mode is used, false otherwise
      • isProtected

        public boolean isProtected()
        Whether MP3 has protection bit
        Returns:
        true if MP3 has protection bit, false otherwise
      • getBitRate

        public int getBitRate()
        Getter for bitrate
        Returns:
        File bitrate
      • getSampleRate

        public int getSampleRate()
        Getter for sample rate
        Returns:
        Sampling rate
      • frameSize

        public int frameSize()
        Calculate the size of a MP3 frame for this header.
        Returns:
        size of the frame including the header
      • frameDuration

        public double frameDuration()
        Return the duration of the frame for this header.
        Returns:
        The duration in milliseconds