java.lang.Object
org.monte.media.avi.AbstractAVIStream
org.monte.media.avi.AVIInputStream
org.monte.media.avi.AVIReader
- All Implemented Interfaces:
AutoCloseable,MovieReader
Provides high-level support for decoding and reading audio and video samples
from an AVI 1.0 file.
- 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
FieldsFields inherited from class org.monte.media.avi.AVIInputStream
idx1, in, 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 TypeMethodDescriptionintFinds a track with the specified format.Returns the total duration of the movie .getDuration(int track) Returns the duration of the specified track.Returns the file format.getFormat(int track) Returns the media format of the specified track.getReadTime(int track) Returns the current time of the track.longgetTimeScale(int track) Returns the time scale of the specified track.intReturns the index of the next track in playback sequence.read(int track, BufferedImage img) Reads an image.voidReads a chunk of media data from the specified track.sampleToTime(int track, long sampleIndex) Returns the time for the specified sample number.voidsetMovieReadTime(Rational newValue) Sets the read time of all tracks to the closest sync sample before or at the specified time.longtimeToSample(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, readAllMetadataMethods inherited from class org.monte.media.avi.AbstractAVIStream
getRelativeStreamPosition, intToType, isFlagSet, seekRelative, typeToIntMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.monte.media.av.MovieReader
close, getChunkCount, getTrackCount
-
Field Details
-
AVI
-
-
Constructor Details
-
AVIReader
- Throws:
IOException
-
AVIReader
- Throws:
IOException
-
-
Method Details
-
getFileFormat
Description copied from interface:MovieReaderReturns the file format.- Specified by:
getFileFormatin interfaceMovieReader- Throws:
IOException
-
getFormat
Description copied from interface:MovieReaderReturns the media format of the specified track.- Specified by:
getFormatin interfaceMovieReader- Parameters:
track- Track number.- Returns:
- The media format of the track.
- Throws:
IOException
-
read
Reads a chunk of media data from the specified track.If the track is a video track with palette change "..PC" chunks, then the body of the palette change chunk can be found in the buffer.header.
- Specified by:
readin interfaceMovieReader- Parameters:
track- The track number.buffer- The buffer for the media data.- Throws:
IOException
-
read
Reads an image.- Parameters:
track- The track numberimg- 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:
IOException
-
getReadTime
Description copied from interface:MovieReaderReturns the current time of the track.- Specified by:
getReadTimein interfaceMovieReader- Throws:
IOException
-
nextTrack
Description copied from interface:MovieReaderReturns the index of the next track in playback sequence.- Specified by:
nextTrackin interfaceMovieReader- Returns:
- Index of next track or -1 if end of media reached.
- Throws:
IOException
-
getDuration
Description copied from interface:MovieReaderReturns the total duration of the movie .- Specified by:
getDurationin interfaceMovieReader
-
getDuration
Description copied from interface:MovieReaderReturns the duration of the specified track.- Specified by:
getDurationin interfaceMovieReader
-
getTimeScale
public long getTimeScale(int track) Description copied from class:AVIInputStreamReturns the time scale of the specified track.- Overrides:
getTimeScalein classAVIInputStream
-
timeToSample
Description copied from interface:MovieReaderReturns the sample number for the specified time.- Specified by:
timeToSamplein interfaceMovieReader
-
sampleToTime
Description copied from interface:MovieReaderReturns the time for the specified sample number.- Specified by:
sampleToTimein interfaceMovieReader- Throws:
IOException
-
setMovieReadTime
Description copied from interface:MovieReaderSets the read time of all tracks to the closest sync sample before or at the specified time.- Specified by:
setMovieReadTimein interfaceMovieReader- Parameters:
newValue- Time in seconds.- Throws:
IOException
-
findTrack
Description copied from interface:MovieReaderFinds a track with the specified format.- Specified by:
findTrackin interfaceMovieReader- Parameters:
fromTrack- the start track number.format- A format specification.- Returns:
- The track number >= fromTrack or -1 if no track has been found.
- Throws:
IOException
-