Class Mp3ConstantRateSeeker
- java.lang.Object
-
- com.sedmelluq.discord.lavaplayer.container.mp3.Mp3ConstantRateSeeker
-
- All Implemented Interfaces:
Mp3Seeker
public class Mp3ConstantRateSeeker extends java.lang.Object implements Mp3Seeker
MP3 seeking support for constant bitrate files or in cases where the variable bitrate format used by the file is not supported. In case the file is not actually CBR, this being used as a fallback may cause inaccurate seeking.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Mp3ConstantRateSeekercreateFromFrame(long firstFramePosition, long contentLength, byte[] frameBuffer)longgetDuration()static booleanisMetaFrame(byte[] frameBuffer)booleanisSeekable()longseekAndGetFrameIndex(long timecode, SeekableInputStream inputStream)
-
-
-
Method Detail
-
createFromFrame
public static Mp3ConstantRateSeeker createFromFrame(long firstFramePosition, long contentLength, byte[] frameBuffer)
- Parameters:
firstFramePosition- Position of the first frame in the filecontentLength- Total length of the fileframeBuffer- Buffer of the first frame- Returns:
- Constant rate seeker, will always succeed, never null.
-
isMetaFrame
public static boolean isMetaFrame(byte[] frameBuffer)
-
getDuration
public long getDuration()
- Specified by:
getDurationin interfaceMp3Seeker- Returns:
- The duration of the file in milliseconds. May be an estimate.
-
isSeekable
public boolean isSeekable()
- Specified by:
isSeekablein interfaceMp3Seeker- Returns:
- True if the track is seekable.
-
seekAndGetFrameIndex
public long seekAndGetFrameIndex(long timecode, SeekableInputStream inputStream) throws java.io.IOException- Specified by:
seekAndGetFrameIndexin interfaceMp3Seeker- Parameters:
timecode- The timecode that the seek is requested toinputStream- 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
-
-