Class ImageSequenceWriter
java.lang.Object
org.monte.media.imgseq.ImageSequenceWriter
- All Implemented Interfaces:
Closeable,AutoCloseable,MovieWriter,Multiplexer
ImageSequenceWriter.- Author:
- Werner Randelshofer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintAdds a track to the writer for a suggested input format.intaddVideoTrack(File dir, String filenameFormatter, int width, int height) Adds a video track.voidclose()Closes the writer.getDuration(int track) Returns the sampleDuration 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.booleanvoidwrite(int track, BufferedImage image, long duration) voidWrites a sample into the specified track.voidwriteSample(int track, byte[] data, int off, int len, long duration, boolean isSync) voidwriteSamples(int track, int sampleCount, byte[] data, int off, int len, long sampleDuration, boolean isSync)
-
Constructor Details
-
ImageSequenceWriter
public ImageSequenceWriter()
-
-
Method Details
-
addTrack
Description copied from interface:MovieWriterAdds a track to the writer for a suggested input format.The format should at least specify the desired
FormatKeys.MediaType. The actual input format is a refined version of the suggested format. For example, if a MovieWriter only supports fixed frame rate video, then the MovieWriter will extend the format with that information.If the suggested input format is not compatible, then an IOException is thrown. For example, if a MovieWriter only supports fixed frame rate video, but a format with variable frame rate was requested.
- Specified by:
addTrackin interfaceMovieWriter- Specified by:
addTrackin interfaceMultiplexer- Parameters:
format- The desired input format of the track. The actual input format may be a refined version of the specified format.- Returns:
- The track number.
- Throws:
IOException
-
getFileFormat
Description copied from interface:MovieWriterReturns the file format.- Specified by:
getFileFormatin interfaceMovieWriter- Throws:
IOException
-
getTrackCount
public int getTrackCount()Description copied from interface:MovieWriterReturns the number of tracks.- Specified by:
getTrackCountin interfaceMovieWriter
-
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.
-
addVideoTrack
Adds a video track.- Parameters:
dir- The output directory.filenameFormatter- a format string for a filename with a number, for example "frame_%d0000$.png";width- the image widthheight- the image height- Returns:
- Returns the track index.
- Throws:
IllegalArgumentException- if the width or the height is smaller than 1.
-
write
- Throws:
IOException
-
write
Description copied from interface:MovieWriterWrites a sample 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 the sample data.- Throws:
IOException- if the write fails
-
writeSample
public void writeSample(int track, byte[] data, int off, int len, long duration, boolean isSync) throws IOException - Throws:
IOException
-
writeSamples
public void writeSamples(int track, int sampleCount, byte[] data, int off, int len, long sampleDuration, boolean isSync) throws IOException - Throws:
IOException
-
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
-
isVFRSupported
public boolean isVFRSupported() -
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
-
getDuration
Returns the sampleDuration of the track in seconds.- Specified by:
getDurationin interfaceMovieWriter
-
isEmpty
public boolean isEmpty(int track) Description copied from interface:MovieWriterReturns true if the specified track has no samples.- Specified by:
isEmptyin interfaceMovieWriter
-