- All Superinterfaces:
AutoCloseable,Multiplexer
- All Known Implementing Classes:
AVIWriter,ImageSequenceWriter,QuickTimeMultiplexer,QuickTimeWriter
A simple API for writing movie data (audio and video) into a file.
- Author:
- Werner Randelshofer
-
Method Summary
Modifier and TypeMethodDescriptionintAdds a track to the writer for a suggested input format.voidclose()Closes the writer.getDuration(int track) Returns the 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.voidWrites a sample into the specified track.
-
Method Details
-
getFileFormat
Returns the file format.- Throws:
IOException
-
addTrack
Adds 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.
- 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
-
getFormat
Returns the media format of the specified track. This is a refined version of the format that was requested when the track was added. SeeaddTrack(org.monte.media.av.Format).- Parameters:
track- Track number.- Returns:
- The media format of the track.
-
getTrackCount
int getTrackCount()Returns the number of tracks. -
write
Writes a sample into the specified track. Does nothing if the discard-flag in the buffer is set to true.- Specified by:
writein interfaceMultiplexer- Parameters:
track- The track number.buf- The buffer containing the sample data.- Throws:
IOException- if the write fails
-
close
Closes the writer.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceMultiplexer- Throws:
IOException- if close fails
-
isDataLimitReached
boolean isDataLimitReached()Returns 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.
-
getDuration
Returns the duration of the track in seconds. -
isEmpty
boolean isEmpty(int track) Returns true if the specified track has no samples.
-