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 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 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.

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

Version:
  $Id: AVIInputStream.java 187 2012-03-28 11:49:30Z werner $
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
`protected java.util.ArrayList<AbstractAVIStream.Sample>` | `idx1`
`protected javax.imageio.stream.ImageInputStream` | `in` The image input stream.
`protected AbstractAVIStream.MainHeader` | `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
`AVIInputStream(java.io.File file)` Creates a new instance.
`AVIInputStream(javax.imageio.stream.ImageInputStream in)` Creates a new instance.

Method Summary
`void` | `close()`
`protected void` | `ensureRealized()` Ensures that all meta-data has been read from the file.
`long` | `getChunkCount(int track)` Returns the number of media data chunks in the track.
`byte[]` | `getExtraHeader(int track, java.lang.String fourcc)` Returns the contents of the extra track header.
`java.lang.String[]` | `getExtraHeaderFourCCs(int track)` Returns the fourcc's of all extra stream headers.
`int` | `getHeaderFlags()` Returns the main header flags.
`long` | `getMicroSecPerFrame()` Returns the number of microseconds (10^-6 seconds) per frame.
`java.lang.String` | `getName(int track)` Returns the name of the track, or null if the name is not specified.
`long` | `getStartTime(int track)` Returns the start time of the track given as the number of frames in microSecPerFrame units.
`long` | `getTimeScale(int track)` Returns the time scale of the specified track.
`int` | `getTrackCount()`
`java.awt.Dimension` | `getVideoDimension()`
`protected void` | `readAllMetadata()` Reads all metadata of the file.

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`

Field Detail

### in

    protected final javax.imageio.stream.ImageInputStream in

  The image input stream.

### mainHeader

    protected AbstractAVIStream.MainHeader mainHeader

### idx1

    protected java.util.ArrayList<AbstractAVIStream.Sample> idx1

Constructor Detail

### AVIInputStream

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

  Creates a new instance.

  Parameters:
    `file` - the input file
  Throws:
    `java.io.IOException`

### AVIInputStream

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

  Creates a new instance.

  Parameters:
    `in` - the input stream.
  Throws:
    `java.io.IOException`

Method Detail

### ensureRealized

    protected void ensureRealized()
                           throws java.io.IOException

  Ensures that all meta-data has been read from the file.

  Throws:
    `java.io.IOException`

### getHeaderFlags

    public int getHeaderFlags()
                       throws java.io.IOException

  Returns the main header flags. The flags are an or-combination of the `AVIH_...` values.

  Throws:
    `java.io.IOException`

### getVideoDimension

    public java.awt.Dimension getVideoDimension()
                                         throws java.io.IOException

  Throws:
    `java.io.IOException`

### getTrackCount

    public int getTrackCount()
                      throws java.io.IOException

  Throws:
    `java.io.IOException`

### getMicroSecPerFrame

    public long getMicroSecPerFrame()
                             throws java.io.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:
    `java.io.IOException`

### getTimeScale

    public long getTimeScale(int track)
                      throws java.io.IOException

  Returns the time scale of the specified track.

  Throws:
    `java.io.IOException`

### getStartTime

    public long getStartTime(int track)
                      throws java.io.IOException

  Returns the start time of the track given as the number of frames in microSecPerFrame units.

  Throws:
    `java.io.IOException`

### getChunkCount

    public long getChunkCount(int track)
                       throws java.io.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:
    `java.io.IOException`

### getName

    public java.lang.String getName(int track)
                             throws java.io.IOException

  Returns the name of the track, or null if the name is not specified.

  Throws:
    `java.io.IOException`

### getExtraHeader

    public byte[] getExtraHeader(int track,
                                 java.lang.String fourcc)
                          throws java.io.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:
    `java.io.IOException`

### getExtraHeaderFourCCs

    public java.lang.String[] getExtraHeaderFourCCs(int track)
                                             throws java.io.IOException

  Returns the fourcc's of all extra stream headers.

  Parameters:
    `track` -
  Returns:
    An array of fourcc's of all extra stream headers.
  Throws:
    `java.io.IOException`

### readAllMetadata

    protected void readAllMetadata()
                            throws java.io.IOException

  Reads all metadata of the file.

  Throws:
    `java.io.IOException`

### close

    public void close()
               throws java.io.IOException

  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