Class AVIReader
java.lang.Object
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
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()intFinds a track with the specified format.longgetChunkCount(int track) Returns the number of media data chunks in the specified track.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) intReturns the number of tracks.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.
-
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
-
getChunkCount
Description copied from interface:MovieReaderReturns the number of media data chunks in the specified track. A chunk contains one or more samples.- Specified by:
getChunkCountin interfaceMovieReader- 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- on IO failure
-
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
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceMovieReader- 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- Throws:
IOException
-
getTimeScale
- Throws:
IOException
-
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
-
getTrackCount
Description copied from interface:MovieReaderReturns the number of tracks.- Specified by:
getTrackCountin interfaceMovieReader- 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
-