Overview | Package | Class | Tree | Deprecated | Index | Help
| Copyright 2012-04-26 Werner Randelshofer
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.monte.media.avi
Class AVIReader

    java.lang.Object
      org.monte.media.avi.AbstractAVIStream
          org.monte.media.avi.AVIInputStream
              org.monte.media.avi.AVIReader

All Implemented Interfaces:
  MovieReader

    public class AVIReader

extends AVIInputStream
implements MovieReader

Provides high-level support for decoding and reading audio and video samples from an AVI 1.0 file.

Version:
  1.0 2011-08-24 Created.
Author:
  Werner Randelshofer

Nested Class Summary

Nested classes/interfaces inherited from class org.monte.media.avi.AbstractAVIStream
`AbstractAVIStream.AudioTrack, AbstractAVIStream.AVIMediaType, AbstractAVIStream.Chunk, AbstractAVIStream.CompositeChunk, AbstractAVIStream.DataChunk, AbstractAVIStream.FixedSizeDataChunk, AbstractAVIStream.MainHeader, AbstractAVIStream.MidiTrack, AbstractAVIStream.Sample, AbstractAVIStream.TextTrack, AbstractAVIStream.Track, AbstractAVIStream.VideoTrack`

Field Summary
`static Format` | `AVI`

Fields inherited from class org.monte.media.avi.AVIInputStream
`idx1, in, mainHeader`

Fields inherited from class org.monte.media.avi.AbstractAVIStream
`AVI_ID, AVIH_FLAG_COPYRIGHTED, AVIH_FLAG_HAS_INDEX, AVIH_FLAG_IS_INTERLEAVED, AVIH_FLAG_MUST_USE_INDEX, AVIH_FLAG_TRUST_CK_TYPE, AVIH_FLAG_WAS_CAPTURE_FILE, AVIH_ID, HDRL_ID, IDX1_ID, LIST_ID, MOVI_ID, out, REC_ID, STRD_ID, streamOffset, STRF_ID, STRH_FLAG_DISABLED, STRH_FLAG_VIDEO_PALETTE_CHANGES, STRH_ID, STRL_ID, STRN_ID, tracks`

Constructor Summary
`AVIReader(java.io.File file)`
`AVIReader(javax.imageio.stream.ImageInputStream in)`

Method Summary
`int` | `findTrack(int fromTrack, Format format)` Finds a track with the specified format.
`Rational` | `getDuration()` Returns the total duration of the movie in time scale units.
`Format` | `getFileFormat()` Returns the file format.
`Format` | `getFormat(int track)` Returns the media format of the specified track.
`Rational` | `getReadTime(int track)` Returns the current time of the track.
`long` | `getTimeScale(int track)` Returns the time scale of the specified track.
`int` | `nextTrack()` 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.
`java.awt.image.BufferedImage` | `read(int track, java.awt.image.BufferedImage img)` Reads an image.
`Rational` | `sampleToTime(int track, long sampleIndex)` Returns the time for the specified sample number.
`void` | `setMovieReadTime(Rational newValue)` Sets the read time of all tracks to the closest sync sample before or at the specified time.
`long` | `timeToSample(int track, Rational time)` Returns the sample number for the specified time.

Methods inherited from class org.monte.media.avi.AVIInputStream
`close, ensureRealized, getChunkCount, getExtraHeader, getExtraHeaderFourCCs, getHeaderFlags, getMicroSecPerFrame, getName, getStartTime, getTrackCount, getVideoDimension, readAllMetadata`

Methods inherited from class org.monte.media.avi.AbstractAVIStream
`getRelativeStreamPosition, intToType, isFlagSet, seekRelative, typeToInt`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.monte.media.MovieReader
`close, getChunkCount, getTrackCount`

Field Detail

### AVI

    public static final Format AVI

Constructor Detail

### AVIReader

    public AVIReader(javax.imageio.stream.ImageInputStream in)
              throws java.io.IOException

Throws:
  `java.io.IOException`

### AVIReader

    public AVIReader(java.io.File file)
              throws java.io.IOException

Throws:
  `java.io.IOException`

Method Detail

### getFileFormat

    public Format getFileFormat()
                         throws java.io.IOException

  Description copied from interface: `MovieReader`
  Returns the file format.

  Specified by:
    `getFileFormat` in interface `MovieReader`
  Throws:
    `java.io.IOException`

### getFormat

    public Format getFormat(int track)
                     throws java.io.IOException

  Description copied from interface: `MovieReader`
  Returns the media format of the specified track.

  Specified by:
    `getFormat` in interface `MovieReader`
  Parameters:
    `track` - Track number.
  Returns:
    The media format of the track.
  Throws:
    `java.io.IOException`

### read

    public void read(int track,
                     Buffer buffer)
              throws java.io.IOException

  Description copied from interface: `MovieReader`
  Reads the next sample chunk from the specified track.

  Specified by:
    `read` in interface `MovieReader`
  Parameters:
    `track` - Track number.
    `buffer` - The buffer into which to store the sample data.
  Throws:
    `java.io.IOException`

### read

    public java.awt.image.BufferedImage read(int track,
                                             java.awt.image.BufferedImage img)
                                      throws java.io.IOException

  Reads an image.

  Parameters:
    `track` - The track number
    `img` - An image that can be reused if it fits the media format of the track. Pass null to create a new image on each read.
  Returns:
    An image or null if the end of the media has been reached.
  Throws:
    `java.io.IOException`

### getReadTime

    public Rational getReadTime(int track)
                         throws java.io.IOException

  Description copied from interface: `MovieReader`
  Returns the current time of the track.

  Specified by:
    `getReadTime` in interface `MovieReader`
  Throws:
    `java.io.IOException`

### nextTrack

    public int nextTrack()
                  throws java.io.IOException

  Description copied from interface: `MovieReader`
  Returns the index of the next track in playback sequence.

  Specified by:
    `nextTrack` in interface `MovieReader`
  Returns:
    Index of next track or -1 if end of media reached.
  Throws:
    `java.io.IOException`

### getDuration

    public Rational getDuration()

  Description copied from interface: `MovieReader`
  Returns the total duration of the movie in time scale units.

  Specified by:
    `getDuration` in interface `MovieReader`

### getTimeScale

    public long getTimeScale(int track)

  Description copied from class: `AVIInputStream`
  Returns the time scale of the specified track.

  Overrides:
    `getTimeScale` in class `AVIInputStream`

### timeToSample

    public long timeToSample(int track,
                             Rational time)

  Description copied from interface: `MovieReader`
  Returns the sample number for the specified time.

  Specified by:
    `timeToSample` in interface `MovieReader`

### sampleToTime

    public Rational sampleToTime(int track,
                                 long sampleIndex)

  Description copied from interface: `MovieReader`
  Returns the time for the specified sample number.

  Specified by:
    `sampleToTime` in interface `MovieReader`

### setMovieReadTime

    public void setMovieReadTime(Rational newValue)

  Description copied from interface: `MovieReader`
  Sets the read time of all tracks to the closest sync sample before or at the specified time.

  Specified by:
    `setMovieReadTime` in interface `MovieReader`
  Parameters:
    `newValue` - Time in seconds.

### findTrack

    public int findTrack(int fromTrack,
                         Format format)
                  throws java.io.IOException

  Description copied from interface: `MovieReader`
  Finds a track with the specified format.

  Specified by:
    `findTrack` in interface `MovieReader`
  Parameters:
    `fromTrack` - the start track number.
    `format` - A format specification.
  Returns:
    The track number >= fromTrack or -1 if no track has been found.
  Throws:
    `java.io.IOException`

Overview | Package | Class | Tree | Deprecated | Index | Help
| Copyright 2012-04-26 Werner Randelshofer
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD