Class Mp3XingSeeker

  • All Implemented Interfaces:
    Mp3Seeker

    public class Mp3XingSeeker
    extends java.lang.Object
    implements Mp3Seeker
    Seeking support for VBR files with Xing header.
    • Method Detail

      • createFromFrame

        public static Mp3XingSeeker createFromFrame​(long firstFramePosition,
                                                    long contentLength,
                                                    byte[] frameBuffer)
        Parameters:
        firstFramePosition - Position of the first frame in the file
        contentLength - Total length of the file
        frameBuffer - Buffer of the first frame
        Returns:
        Xing seeker, if its header is found in the first frame and has all the necessary fields
      • getDuration

        public long getDuration()
        Specified by:
        getDuration in interface Mp3Seeker
        Returns:
        The duration of the file in milliseconds. May be an estimate.
      • isSeekable

        public boolean isSeekable()
        Specified by:
        isSeekable in interface Mp3Seeker
        Returns:
        True if the track is seekable.
      • seekAndGetFrameIndex

        public long seekAndGetFrameIndex​(long timecode,
                                         SeekableInputStream inputStream)
                                  throws java.io.IOException
        Specified by:
        seekAndGetFrameIndex in interface Mp3Seeker
        Parameters:
        timecode - The timecode that the seek is requested to
        inputStream - The input stream to perform the seek on
        Returns:
        The index of the frame that the seek was performed to
        Throws:
        java.io.IOException - On IO error