public class AVIInputStream extends AbstractAVIStream
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
AbstractAVIStream.AudioTrack, AbstractAVIStream.AVIMediaType, AbstractAVIStream.Chunk, AbstractAVIStream.CompositeChunk, AbstractAVIStream.DataChunk, AbstractAVIStream.FixedSizeDataChunk, AbstractAVIStream.MainHeader, AbstractAVIStream.MidiTrack, AbstractAVIStream.Sample, AbstractAVIStream.TextTrack, AbstractAVIStream.Track, AbstractAVIStream.VideoTrack
Modifier and Type | Field and Description |
---|---|
protected java.util.ArrayList<AbstractAVIStream.Sample> |
idx1 |
protected javax.imageio.stream.ImageInputStream |
in
The image input stream.
|
protected AbstractAVIStream.MainHeader |
mainHeader |
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 and Description |
---|
AVIInputStream(java.io.File file)
Creates a new instance.
|
AVIInputStream(javax.imageio.stream.ImageInputStream in)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
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.
|
getRelativeStreamPosition, intToType, isFlagSet, seekRelative, typeToInt
protected final javax.imageio.stream.ImageInputStream in
protected AbstractAVIStream.MainHeader mainHeader
protected java.util.ArrayList<AbstractAVIStream.Sample> idx1
public AVIInputStream(java.io.File file) throws java.io.IOException
file
- the input filejava.io.IOException
public AVIInputStream(javax.imageio.stream.ImageInputStream in) throws java.io.IOException
in
- the input stream.java.io.IOException
protected void ensureRealized() throws java.io.IOException
java.io.IOException
public int getHeaderFlags() throws java.io.IOException
AVIH_...
values.java.io.IOException
public java.awt.Dimension getVideoDimension() throws java.io.IOException
java.io.IOException
public int getTrackCount() throws java.io.IOException
java.io.IOException
public long getMicroSecPerFrame() throws java.io.IOException
java.io.IOException
public long getTimeScale(int track) throws java.io.IOException
java.io.IOException
public long getStartTime(int track) throws java.io.IOException
java.io.IOException
public long getChunkCount(int track) throws java.io.IOException
track
- java.io.IOException
public java.lang.String getName(int track) throws java.io.IOException
java.io.IOException
public byte[] getExtraHeader(int track, java.lang.String fourcc) throws java.io.IOException
track
- fourcc
- java.io.IOException
public java.lang.String[] getExtraHeaderFourCCs(int track) throws java.io.IOException
track
- java.io.IOException
protected void readAllMetadata() throws java.io.IOException
java.io.IOException
public void close() throws java.io.IOException
java.io.IOException