Class AVIInputStream
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
-
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
FieldsModifier and TypeFieldDescriptionprotected ArrayList<AbstractAVIStream.Sample> protected final ImageInputStreamThe image input stream.protected AbstractAVIStream.MainHeaderFields 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, AVIX_ID, CHUNK_SUBTYPE_MASK, DB_ID, DC_ID, HDRL_ID, IDX1_ID, LIST_ID, MOVI_ID, out, PC_ID, REC_ID, RIFF_ID, STRD_ID, streamOffset, STRF_ID, STRH_FLAG_DISABLED, STRH_FLAG_VIDEO_PALETTE_CHANGES, STRH_ID, STRL_ID, STRN_ID, tracks, WB_ID -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()protected voidEnsures that all meta-data has been read from the file.longgetChunkCount(int track) Returns the number of media data chunks in the track.byte[]getExtraHeader(int track, String fourcc) Returns the contents of the extra track header.String[]getExtraHeaderFourCCs(int track) Returns the fourcc's of all extra stream headers.intReturns the main header flags.longReturns the number of microseconds (10^-6 seconds) per frame.getName(int track) Returns the name of the track, or null if the name is not specified.longgetStartTime(int track) Returns the start time of the track given as the number of frames in microSecPerFrame units.longgetTimeScale(int track) Returns the time scale of the specified track.intprotected voidReads all metadata of the file.Methods inherited from class org.monte.media.avi.AbstractAVIStream
getRelativeStreamPosition, intToType, isFlagSet, seekRelative, typeToInt
-
Field Details
-
in
The image input stream. -
mainHeader
-
idx1
-
-
Constructor Details
-
AVIInputStream
Creates a new instance.- Parameters:
file- the input file- Throws:
IOException
-
AVIInputStream
Creates a new instance.- Parameters:
in- the input stream.- Throws:
IOException
-
-
Method Details
-
ensureRealized
Ensures that all meta-data has been read from the file.- Throws:
IOException
-
getHeaderFlags
Returns the main header flags. The flags are an or-combination of theAVIH_...values.- Throws:
IOException
-
getVideoDimension
- Throws:
IOException
-
getTrackCount
- Throws:
IOException
-
getMicroSecPerFrame
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
Returns the time scale of the specified track.- Throws:
IOException
-
getStartTime
Returns the start time of the track given as the number of frames in microSecPerFrame units.- Throws:
IOException
-
getChunkCount
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
Returns the name of the track, or null if the name is not specified.- Throws:
IOException
-
getExtraHeader
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
Returns the fourcc's of all extra stream headers.- Parameters:
track- the track index- Returns:
- An array of fourcc's of all extra stream headers.
- Throws:
IOException
-
readAllMetadata
Reads all metadata of the file.- Throws:
IOException
-
close
- Throws:
IOException
-