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.avi
Class AVIWriter

    java.lang.Object
      org.monte.media.avi.AbstractAVIStream
          org.monte.media.avi.AVIOutputStream
              org.monte.media.avi.AVIWriter

All Implemented Interfaces:
  MovieWriter, Multiplexer

    public class AVIWriter

extends AVIOutputStream
implements MovieWriter

Provides high-level support for encoding and writing audio and video samples into an AVI 1.0 file.

Version:
  $Id: AVIWriter.java 192 2012-03-29 22:00:37Z werner $
Author:
  Werner Randelshofer

Nested Class Summary

Nested classes/interfaces inherited from class org.monte.media.avi.AVIOutputStream
`AVIOutputStream.States`

Nested 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
`static Format` | `AVI`
`static Format` | `VIDEO_JPEG`
`static Format` | `VIDEO_PNG`
`static Format` | `VIDEO_RAW`
`static Format` | `VIDEO_RLE`
`static Format` | `VIDEO_SCREEN_CAPTURE`

Fields inherited from class org.monte.media.avi.AVIOutputStream
`aviChunk, avihChunk, moviChunk, state`

Fields 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, HDRL_ID, IDX1_ID, LIST_ID, MOVI_ID, out, REC_ID, STRD_ID, streamOffset, STRF_ID, STRH_FLAG_DISABLED, STRH_FLAG_VIDEO_PALETTE_CHANGES, STRH_ID, STRL_ID, STRN_ID, tracks`

Constructor Summary
`AVIWriter(java.io.File file)` Creates a new AVI writer.
`AVIWriter(javax.imageio.stream.ImageOutputStream out)` Creates a new AVI writer.

Method Summary
`int` | `addTrack(Format format)` Adds a track.
`Codec` | `getCodec(int track)` Returns the codec of the specified track.
`Rational` | `getDuration(int track)` Returns the media 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` | `isVFRSupported()`
`void` | `setCodec(int track, Codec codec)` Sets the codec for the specified track.
`void` | `write(int track, Buffer buf)` Encodes the data provided in the buffer and then writes it into the specified track.
`void` | `write(int track, java.awt.image.BufferedImage image, long duration)` Encodes the provided image and writes its sample data into the specified track.

Methods inherited from class org.monte.media.avi.AVIOutputStream
`addAudioTrack, addVideoTrack, close, ensureFinished, ensureStarted, finish, getExtraHeaderFourCCs, getMediaDuration, getVideoDimension, isDataLimitReached, putExtraHeader, setName, setPalette, writePalette, writeSample, writeSample, writeSample, writeSamples`

Methods inherited from class org.monte.media.avi.AbstractAVIStream
`getRelativeStreamPosition, intToType, isFlagSet, seekRelative, typeToInt`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.monte.media.MovieWriter
`close, isDataLimitReached`

Field Detail

### AVI

    public static final Format AVI

### VIDEO_RAW

    public static final Format VIDEO_RAW

### VIDEO_JPEG

    public static final Format VIDEO_JPEG

### VIDEO_PNG

    public static final Format VIDEO_PNG

### VIDEO_RLE

    public static final Format VIDEO_RLE

### VIDEO_SCREEN_CAPTURE

    public static final Format VIDEO_SCREEN_CAPTURE

Constructor Detail

### AVIWriter

    public AVIWriter(java.io.File file)
              throws java.io.IOException

  Creates a new AVI writer.

  Parameters:
    `file` - the output file
  Throws:
    `java.io.IOException`

### AVIWriter

    public AVIWriter(javax.imageio.stream.ImageOutputStream out)
              throws java.io.IOException

  Creates a new AVI writer.

  Parameters:
    `out` - the output stream.
  Throws:
    `java.io.IOException`

Method Detail

### getFileFormat

    public Format getFileFormat()
                         throws java.io.IOException

  Description copied from interface: `MovieWriter`
  Returns the file format.

  Specified by:
    `getFileFormat` in interface `MovieWriter`
  Throws:
    `java.io.IOException`

### getFormat

    public Format getFormat(int track)

  Description copied from interface: `MovieWriter`
  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 `MovieWriter.addTrack(org.monte.media.Format)`.

  Specified by:
    `getFormat` in interface `MovieWriter`
  Parameters:
    `track` - Track number.
  Returns:
    The media format of the track.

### getDuration

    public Rational getDuration(int track)

  Returns the media duration of the track in seconds.

  Specified by:
    `getDuration` in interface `MovieWriter`

### addTrack

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

  Adds a track.

  Specified by:
    `addTrack` in interface `MovieWriter`
  Parameters:
    `format` - The format of the track.
  Returns:
    The track number.
  Throws:
    `java.io.IOException`

### getCodec

    public Codec getCodec(int track)

  Returns the codec of the specified track.

### setCodec

    public void setCodec(int track,
                         Codec codec)

  Sets the codec for the specified track.

### getTrackCount

    public int getTrackCount()

  Description copied from interface: `MovieWriter`
  Returns the number of tracks.

  Specified by:
    `getTrackCount` in interface `MovieWriter`

### write

    public void write(int track,
                      java.awt.image.BufferedImage image,
                      long duration)
               throws java.io.IOException

  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.
  Throws:
    `IndexOutofBoundsException` - if the track index is out of bounds.
    `if` - the duration is less than 1, or if the dimension of the frame does not match the dimension of the video.
    `java.lang.UnsupportedOperationException` - if the `MovieWriter` does not have a built-in encoder for this video format.
    `java.io.IOException` - if writing the sample data failed.

### write

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

  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:
    `write` in interface `MovieWriter`
  Specified by:
    `write` in interface `Multiplexer`
  Parameters:
    `track` - The track number.
    `buf` - The buffer containing a data sample.
  Throws:
    `java.io.IOException`

### isVFRSupported

    public boolean isVFRSupported()

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