Class AVIWriter
java.lang.Object
org.monte.media.avi.AVIWriter
- All Implemented Interfaces:
Closeable,AutoCloseable,MovieWriter,Multiplexer
Provides high-level support for encoding and writing audio and video samples
into an AVI 1.0 file.
- Author:
- Werner Randelshofer
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new AVI writer.Creates a new AVI writer. -
Method Summary
Modifier and TypeMethodDescriptionintAdds a track.voidclose()Closes the writer.getCodec(int track) Returns the codec of the specified track.getDuration(int track) Returns the media duration of the track in seconds.Returns the file format.getFormat(int track) Returns the media format of the specified track.intReturns the number of tracks.booleanReturns true if the limit for media data has been reached.booleanisEmpty(int track) Returns true if the specified track has no samples.booleanvoidSets the codec for the specified track.voidsetPalette(int track, ColorModel palette) voidwrite(int track, BufferedImage image, long duration) Encodes the provided image and writes its sample data into the specified track.voidEncodes the data provided in the buffer and then writes it into the specified track.
-
Field Details
-
AVI
-
VIDEO_RAW
-
VIDEO_JPEG
-
VIDEO_PNG
-
VIDEO_RLE
-
VIDEO_SCREEN_CAPTURE
-
-
Constructor Details
-
AVIWriter
Creates a new AVI writer.- Parameters:
file- the output file- Throws:
IOException
-
AVIWriter
Creates a new AVI writer.- Parameters:
out- the output stream.- Throws:
IOException
-
-
Method Details
-
getFileFormat
Description copied from interface:MovieWriterReturns the file format.- Specified by:
getFileFormatin interfaceMovieWriter- Throws:
IOException
-
getFormat
Description copied from interface:MovieWriterReturns the media format of the specified track. This is a refined version of the format that was requested when the track was added. SeeMovieWriter.addTrack(org.monte.media.av.Format).- Specified by:
getFormatin interfaceMovieWriter- Parameters:
track- Track number.- Returns:
- The media format of the track.
-
getDuration
Returns the media duration of the track in seconds.- Specified by:
getDurationin interfaceMovieWriter
-
addTrack
Adds a track.- Specified by:
addTrackin interfaceMovieWriter- Specified by:
addTrackin interfaceMultiplexer- Parameters:
format- The format of the track.- Returns:
- The track number.
- Throws:
IOException
-
getCodec
Returns the codec of the specified track. -
setCodec
Sets the codec for the specified track. -
getTrackCount
public int getTrackCount()Description copied from interface:MovieWriterReturns the number of tracks.- Specified by:
getTrackCountin interfaceMovieWriter
-
write
Encodes the provided image and writes its sample data into the specified track.- Parameters:
track- The track index.image- The image of the video frame.duration- Duration given in media time units (=number of frames to be written).- Throws:
IOException- if writing the sample data failed.
-
write
Encodes the data provided in the buffer and then writes it into the specified track.Does nothing if the discard-flag in the buffer is set to true.
- Specified by:
writein interfaceMovieWriter- Specified by:
writein interfaceMultiplexer- Parameters:
track- The track number.buf- The buffer containing a data sample. The duration of the buffer must match the sample rate of the track.- Throws:
IOException- if the write fails
-
close
Description copied from interface:MovieWriterCloses the writer.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceMovieWriter- Specified by:
closein interfaceMultiplexer- Throws:
IOException- if close fails
-
isDataLimitReached
public boolean isDataLimitReached()Description copied from interface:MovieWriterReturns true if the limit for media data has been reached. If this limit is reached, no more samples should be added to the movie.This limit is imposed by data structures of the movie file which will overflow if more samples are added to the movie.
FIXME - Maybe replace by getCapacity():long.
- Specified by:
isDataLimitReachedin interfaceMovieWriter
-
isVFRSupported
public boolean isVFRSupported() -
isEmpty
public boolean isEmpty(int track) Description copied from interface:MovieWriterReturns true if the specified track has no samples.- Specified by:
isEmptyin interfaceMovieWriter
-
setPalette
-