Overview | Package | Class | Tree | Deprecated | Index | Help
| Copyright 2012-04-26 Werner Randelshofer
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.monte.media
Interface MovieWriter

All Superinterfaces:
  Multiplexer

All Known Implementing Classes:
  ANIMWriter, AVIWriter, ImageSequenceWriter, QuickTimeMultiplexer, QuickTimeWriter

    public interface MovieWriter

extends Multiplexer

A simple API for writing movie data (audio and video) into a file.

Version:
  $Id: MovieWriter.java 204 2012-04-12 12:25:37Z werner $
Author:
  Werner Randelshofer

Method Summary
`int` | `addTrack(Format format)` Adds a track to the writer for a suggested input format.
`void` | `close()` Closes the writer.
`Rational` | `getDuration(int track)` Returns the duration 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.
`void` | `write(int track, Buffer buf)` Writes a sample into the specified track.

Method Detail

### getFileFormat

    Format getFileFormat()
                         throws java.io.IOException

  Returns the file format.

  Throws:
    `java.io.IOException`

### addTrack

    int addTrack(Format format)
                 throws java.io.IOException

  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:
    `java.io.IOException`

### getFormat

    Format getFormat(int track)

  Returns the media format of the specified track. This is a refined version of the format that was requested when the track was added. See `addTrack(org.monte.media.Format)`.

  Parameters:
    `track` - Track number.
  Returns:
    The media format of the track.

### getTrackCount

    int getTrackCount()

  Returns the number of tracks.

### write

    void write(int track,
               Buffer buf)
               throws java.io.IOException

  Writes a sample into the specified track. Does nothing if the discard-flag in the buffer is set to true.

  Specified by:
    `write` in interface `Multiplexer`
  Parameters:
    `track` - The track number.
    `buf` - The buffer containing the sample data.
  Throws:
    `java.io.IOException`

### close

    void close()
               throws java.io.IOException

  Closes the writer.

  Specified by:
    `close` in interface `Multiplexer`
  Throws:
    `java.io.IOException`

### 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

    Rational getDuration(int track)

  Returns the duration of the track in seconds.

Overview | Package | Class | Tree | Deprecated | Index | Help
| Copyright 2012-04-26 Werner Randelshofer
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD