Interface MovieReader

All Superinterfaces:
AutoCloseable
All Known Implementing Classes:
AVIReader, QuickTimeReader

public interface MovieReader extends AutoCloseable
A simple API for reading movie data (audio and video) from a file.

FIXME - MovieReader should extend Demultiplexer

Author:
Werner Randelshofer
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    int
    findTrack(int fromTrack, Format format)
    Finds a track with the specified format.
    long
    getChunkCount(int track)
    Returns the number of media data chunks in the specified track.
    Returns the total duration of the movie .
    getDuration(int track)
    Returns the duration of the specified track.
    Returns the file format.
    getFormat(int track)
    Returns the media format of the specified track.
    getReadTime(int track)
    Returns the current time of the track.
    int
    Returns the number of tracks.
    int
    Returns the index of the next track in playback sequence.
    void
    read(int track, Buffer buffer)
    Reads the next sample chunk from the specified track.
    sampleToTime(int track, long sample)
    Returns the time for the specified sample number.
    void
    Sets the read time of all tracks to the closest sync sample before or at the specified time.
    long
    timeToSample(int track, Rational seconds)
    Returns the sample number for the specified time.
  • Method Details

    • getTrackCount

      int getTrackCount() throws IOException
      Returns the number of tracks.
      Throws:
      IOException
    • findTrack

      int findTrack(int fromTrack, Format format) throws IOException
      Finds a track with the specified format.
      Parameters:
      fromTrack - the start track number.
      format - A format specification.
      Returns:
      The track number >= fromTrack or -1 if no track has been found.
      Throws:
      IOException
    • getDuration

      Rational getDuration() throws IOException
      Returns the total duration of the movie .
      Throws:
      IOException
    • getDuration

      Rational getDuration(int track) throws IOException
      Returns the duration of the specified track.
      Throws:
      IOException
    • timeToSample

      long timeToSample(int track, Rational seconds) throws IOException
      Returns the sample number for the specified time.
      Throws:
      IOException
    • sampleToTime

      Rational sampleToTime(int track, long sample) throws IOException
      Returns the time for the specified sample number.
      Throws:
      IOException
    • getFileFormat

      Format getFileFormat() throws IOException
      Returns the file format.
      Throws:
      IOException
    • getFormat

      Format getFormat(int track) throws IOException
      Returns the media format of the specified track.
      Parameters:
      track - Track number.
      Returns:
      The media format of the track.
      Throws:
      IOException
    • getChunkCount

      long getChunkCount(int track) throws IOException
      Returns the number of media data chunks in the specified track. A chunk contains one or more samples.
      Throws:
      IOException
    • read

      void read(int track, Buffer buffer) throws IOException
      Reads the next sample chunk from the specified track.
      Parameters:
      track - Track number.
      buffer - The buffer into which to store the sample data.
      Throws:
      IOException
    • nextTrack

      int nextTrack() throws IOException
      Returns the index of the next track in playback sequence.
      Returns:
      Index of next track or -1 if end of media reached.
      Throws:
      IOException
    • close

      void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Throws:
      IOException
    • setMovieReadTime

      void setMovieReadTime(Rational newValue) throws IOException
      Sets the read time of all tracks to the closest sync sample before or at the specified time.
      Parameters:
      newValue - Time in seconds.
      Throws:
      IOException
    • getReadTime

      Rational getReadTime(int track) throws IOException
      Returns the current time of the track.
      Throws:
      IOException