java.lang.Object
org.monte.media.avi.AbstractAVIStream
org.monte.media.avi.AVIOutputStream
org.monte.media.avi.AVIWriter
- All Implemented Interfaces:
AutoCloseable,MovieWriter,Multiplexer
Provides high-level support for encoding and writing audio and video samples
into an AVI 1.0 file.
- Author:
- Werner Randelshofer
-
Nested Class Summary
Nested classes/interfaces inherited from class org.monte.media.avi.AVIOutputStream
AVIOutputStream.StatesNested 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 TypeFieldDescriptionstatic final Formatstatic final Formatstatic final Formatstatic final Formatstatic final Formatstatic final FormatFields inherited from class org.monte.media.avi.AVIOutputStream
aviChunk, avihChunk, moviChunk, stateFields 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
ConstructorsConstructorDescriptionCreates a new AVI writer.Creates a new AVI writer. -
Method Summary
Modifier and TypeMethodDescriptionintAdds a track.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.booleanisEmpty(int track) Returns true if the specified track has no samples.booleanvoidSets the codec for the specified track.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.Methods inherited from class org.monte.media.avi.AVIOutputStream
addAudioTrack, addVideoTrack, close, ensureFinished, ensureStarted, finish, getCompressionQuality, getExtraHeaderFourCCs, getMediaDuration, getVideoDimension, isDataLimitReached, putExtraHeader, setCompressionQuality, setName, setPalette, writePalette, writeSample, writeSample, writeSample, writeSamplesMethods 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.MovieWriter
close, isDataLimitReached
-
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- 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
-
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
-