public class ImageSequenceWriter extends java.lang.Object implements MovieWriter
ImageSequenceWriter
.Constructor and Description |
---|
ImageSequenceWriter() |
Modifier and Type | Method and Description |
---|---|
int |
addTrack(Format format)
Adds a track to the writer for a suggested input format.
|
int |
addVideoTrack(java.io.File dir,
java.lang.String filenameFormatter,
int width,
int height)
Adds a video track.
|
void |
close()
Closes the writer.
|
Rational |
getDuration(int track)
Returns the sampleDuration of the track in seconds.
|
Format |
getFileFormat()
Returns the file format.
|
Format |
getFormat(int track)
Returns the media format of the specified track.
|
int |
getTrackCount()
Returns the number of tracks.
|
boolean |
isDataLimitReached()
Returns true if the limit for media data has been reached.
|
boolean |
isEmpty(int track)
Returns true if the specified track has no samples.
|
boolean |
isVFRSupported() |
void |
write(int track,
Buffer buf)
Writes a sample into the specified track.
|
void |
write(int track,
java.awt.image.BufferedImage image,
long duration) |
void |
writeSample(int track,
byte[] data,
int off,
int len,
long duration,
boolean isSync) |
void |
writeSamples(int track,
int sampleCount,
byte[] data,
int off,
int len,
long sampleDuration,
boolean isSync) |
public int addTrack(Format format) throws java.io.IOException
MovieWriter
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.
addTrack
in interface MovieWriter
format
- The desired input format of the track. The actual input
format may be a refined version of the specified format.java.io.IOException
public Format getFileFormat() throws java.io.IOException
MovieWriter
getFileFormat
in interface MovieWriter
java.io.IOException
public int getTrackCount()
MovieWriter
getTrackCount
in interface MovieWriter
public Format getFormat(int track)
MovieWriter
MovieWriter.addTrack(org.monte.media.Format)
.getFormat
in interface MovieWriter
track
- Track number.public int addVideoTrack(java.io.File dir, java.lang.String filenameFormatter, int width, int height)
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 heightjava.lang.IllegalArgumentException
- if the width or the height is smaller
than 1.public void write(int track, java.awt.image.BufferedImage image, long duration) throws java.io.IOException
java.io.IOException
public void write(int track, Buffer buf) throws java.io.IOException
MovieWriter
write
in interface MovieWriter
write
in interface Multiplexer
track
- The track number.buf
- The buffer containing the sample data.java.io.IOException
public void writeSample(int track, byte[] data, int off, int len, long duration, boolean isSync) throws java.io.IOException
java.io.IOException
public void writeSamples(int track, int sampleCount, byte[] data, int off, int len, long sampleDuration, boolean isSync) throws java.io.IOException
java.io.IOException
public void close() throws java.io.IOException
MovieWriter
close
in interface MovieWriter
close
in interface Multiplexer
java.io.IOException
public boolean isVFRSupported()
public boolean isDataLimitReached()
MovieWriter
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.
isDataLimitReached
in interface MovieWriter
public Rational getDuration(int track)
getDuration
in interface MovieWriter
public boolean isEmpty(int track)
MovieWriter
isEmpty
in interface MovieWriter