Class AVIInputStream

java.lang.Object
org.monte.media.avi.AbstractAVIStream
org.monte.media.avi.AVIInputStream
Direct Known Subclasses:
AVIReader

public class AVIInputStream extends AbstractAVIStream
Provides low-level support for reading encoded audio and video samples from an AVI 1.0 or an AVI 2.0 file.

The length of an AVI 1.0 file is limited to 1 GB. This class supports lengths of up to 4 GB, but such files may not work on all players.

Support for AVI 2.0 file is incomplete. This class currently ignores the extended index chunks. Instead all chunks in the "movi" list are scanned. With scanning, the reader is not able to distinguish between keyframes and non-keyframes. As a consequence opening an AVI 2.0 file is very slow, and decoding of frames may fail.

For detailed information about the AVI 1.0 file format see:
msdn.microsoft.com AVI RIFF
www.microsoft.com FOURCC for Video Compression
www.saettler.com RIFF

For detailed information about the AVI 2.0 file format see:
OpenDML AVI File Format Extensions, Version 1.02

FIXME - This class lacks readSample() methods.

Author:
Werner Randelshofer
  • Field Details

  • Constructor Details

  • Method Details

    • ensureRealized

      protected void ensureRealized() throws IOException
      Ensures that all meta-data has been read from the file.
      Throws:
      IOException
    • getHeaderFlags

      public int getHeaderFlags() throws IOException
      Returns the main header flags. The flags are an or-combination of the AVIH_... values.
      Throws:
      IOException
    • getVideoDimension

      public Dimension getVideoDimension() throws IOException
      Throws:
      IOException
    • getTrackCount

      public int getTrackCount() throws IOException
      Throws:
      IOException
    • getMicroSecPerFrame

      public long getMicroSecPerFrame() throws IOException
      Returns the number of microseconds (10^-6 seconds) per frame. This is used as a time basis for the start time of tracks within a movie.
      Throws:
      IOException
    • getTimeScale

      public long getTimeScale(int track) throws IOException
      Returns the time scale of the specified track.
      Throws:
      IOException
    • getStartTime

      public long getStartTime(int track) throws IOException
      Returns the start time of the track given as the number of frames in microSecPerFrame units.
      Throws:
      IOException
    • getChunkCount

      public long getChunkCount(int track) throws IOException
      Returns the number of media data chunks in the track. This includes chunks which do not affect the timing of the media, such as palette changes.
      Parameters:
      track -
      Returns:
      the number of chunks
      Throws:
      IOException
    • getName

      public String getName(int track) throws IOException
      Returns the name of the track, or null if the name is not specified.
      Throws:
      IOException
    • getExtraHeader

      public byte[] getExtraHeader(int track, String fourcc) throws IOException
      Returns the contents of the extra track header. Returns null if the header is not present.
      Parameters:
      track -
      fourcc -
      Returns:
      The extra header as a byte array
      Throws:
      IOException
    • getExtraHeaderFourCCs

      public String[] getExtraHeaderFourCCs(int track) throws IOException
      Returns the fourcc's of all extra stream headers.
      Parameters:
      track -
      Returns:
      An array of fourcc's of all extra stream headers.
      Throws:
      IOException
    • readAllMetadata

      protected void readAllMetadata() throws IOException
      Reads all metadata of the file.
      Throws:
      IOException
    • close

      public void close() throws IOException
      Throws:
      IOException