Class MatroskaStreamingFile


  • public class MatroskaStreamingFile
    extends java.lang.Object
    Handles processing an MKV/WEBM file for the purpose of streaming one specific track from it. Only performs seeks when absolutely necessary, as the stream may be a network connection, in which case each seek may require a new connection.
    • Constructor Detail

      • MatroskaStreamingFile

        public MatroskaStreamingFile​(SeekableInputStream inputStream)
        Parameters:
        inputStream - The input stream for the file
    • Method Detail

      • getTimecodeScale

        public long getTimecodeScale()
        Returns:
        Timescale for the durations used in this file
      • getTitle

        public java.lang.String getTitle()
        Returns:
        The title for this file.
      • getArtist

        public java.lang.String getArtist()
      • getIsrc

        public java.lang.String getIsrc()
      • getDuration

        public double getDuration()
        Returns:
        Total duration of the file
      • getTrackList

        public MatroskaFileTrack[] getTrackList()
        Returns:
        Array of tracks in this file
      • readFile

        public void readFile()
                      throws java.io.IOException
        Read the headers and tracks from the file.
        Throws:
        java.io.IOException - On read error.
      • seekToTimecode

        public void seekToTimecode​(int trackId,
                                   long timecode)
        Perform a seek to a specified timecode
        Parameters:
        trackId - ID of the reference track
        timecode - Timecode using the timescale of the file
      • provideFrames

        public void provideFrames​(MatroskaTrackConsumer consumer)
                           throws java.lang.InterruptedException
        Provide data chunks for the specified track consumer
        Parameters:
        consumer - Track data consumer
        Throws:
        java.lang.InterruptedException - When interrupted externally (or for seek/stop).