Class QTWriter

All Implemented Interfaces:
Closeable, AutoCloseable, ICompressedTileWriter, IFormatHandler, IFormatWriter, IMetadataConfigurable, IPyramidHandler

public class QTWriter extends FormatWriter
QTWriter is the file format writer for uncompressed QuickTime movie files.
Author:
Melissa Linkert melissa at glencoesoftware.com
  • Field Details

    • CODEC_MOTION_JPEG_B

      public static final int CODEC_MOTION_JPEG_B
      Value indicating Motion JPEG-B codec.
      See Also:
    • CODEC_CINEPAK

      public static final int CODEC_CINEPAK
      Value indicating Cinepak codec.
      See Also:
    • CODEC_ANIMATION

      public static final int CODEC_ANIMATION
      Value indicating Animation codec.
      See Also:
    • CODEC_H_263

      public static final int CODEC_H_263
      Value indicating H.263 codec.
      See Also:
    • CODEC_SORENSON

      public static final int CODEC_SORENSON
      Value indicating Sorenson codec.
      See Also:
    • CODEC_SORENSON_3

      public static final int CODEC_SORENSON_3
      Value indicating Sorenson 3 codec.
      See Also:
    • CODEC_MPEG_4

      public static final int CODEC_MPEG_4
      Value indicating MPEG-4 codec.
      See Also:
    • CODEC_RAW

      public static final int CODEC_RAW
      Value indicating Raw codec.
      See Also:
    • QUALITY_LOW

      public static final int QUALITY_LOW
      Value indicating Low quality.
      See Also:
    • QUALITY_NORMAL

      public static final int QUALITY_NORMAL
      Value indicating Normal quality.
      See Also:
    • QUALITY_HIGH

      public static final int QUALITY_HIGH
      Value indicating High quality.
      See Also:
    • QUALITY_MAXIMUM

      public static final int QUALITY_MAXIMUM
      Value indicating Maximum quality.
      See Also:
    • BYTE_COUNT_OFFSET

      private static final long BYTE_COUNT_OFFSET
      Seek to this offset to update the total number of pixel bytes.
      See Also:
    • codec

      protected int codec
      The codec to use.
    • quality

      protected int quality
      The quality to use.
    • numBytes

      protected int numBytes
      Total number of pixel bytes.
    • offsets

      protected List<Integer> offsets
      Vector of plane offsets.
    • created

      protected int created
      Time the file was created.
    • pad

      protected int pad
      Number of padding bytes in each row.
    • numWritten

      private int numWritten
  • Constructor Details

    • QTWriter

      public QTWriter()
  • Method Details

    • setCodec

      public void setCodec(int codec)
      Sets the encoded movie's codec.
      Parameters:
      codec - Codec value:
      • QTWriterCODEC_CINEPAK
      • QTWriter.CODEC_ANIMATION
      • QTWriter.CODEC_H_263
      • QTWriter.CODEC_SORENSON
      • QTWriter.CODEC_SORENSON_3
      • QTWriter.CODEC_MPEG_4
      • QTWriter.CODEC_RAW
    • setQuality

      public void setQuality(int quality)
      Sets the quality of the encoded movie.
      Parameters:
      quality - Quality value:
      • QTWriter.QUALITY_LOW
      • QTWriter.QUALITY_MEDIUM
      • QTWriter.QUALITY_HIGH
      • QTWriter.QUALITY_MAXIMUM
    • saveBytes

      public void saveBytes(int no, byte[] buf, int x, int y, int w, int h) throws FormatException, IOException
      Description copied from interface: IFormatWriter
      Saves the given image tile to the current series in the current file.
      Parameters:
      no - the plane index within the series.
      buf - the byte array that represents the image tile.
      x - the X coordinate of the upper-left corner of the image tile.
      y - the Y coordinate of the upper-left corner of the image tile.
      w - the width (in pixels) of the image tile.
      h - the height (in pixels) of the image tile.
      Throws:
      FormatException - if one of the parameters is invalid.
      IOException - if there was a problem writing to the file.
      See Also:
    • canDoStacks

      public boolean canDoStacks()
      Description copied from interface: IFormatWriter
      Reports whether the writer can save multiple images to a single file.
      Specified by:
      canDoStacks in interface IFormatWriter
      Overrides:
      canDoStacks in class FormatWriter
    • getPixelTypes

      public int[] getPixelTypes(String codec)
      Description copied from interface: IFormatWriter
      Gets the supported pixel types for the given codec.
      Specified by:
      getPixelTypes in interface IFormatWriter
      Overrides:
      getPixelTypes in class FormatWriter
    • setId

      public void setId(String id) throws FormatException, IOException
      Description copied from class: FormatWriter
      Initializes a writer from the input file name. Initializes a RandomAccessOutputStream for the output file and initializes the metadata for all the series using FormatWriter.setSeries(int).
      Specified by:
      setId in interface IFormatHandler
      Overrides:
      setId in class FormatWriter
      Parameters:
      id - a String specifying the path to the file
      Throws:
      FormatException
      IOException
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Overrides:
      close in class FormatWriter
      Throws:
      IOException
    • setCodec

      private void setCodec()
    • writeFooter

      private void writeFooter() throws IOException
      Throws:
      IOException
    • writeRotationMatrix

      private void writeRotationMatrix() throws IOException
      Write the 3x3 matrix that describes how to rotate the image.
      Throws:
      IOException
    • writeAtom

      private void writeAtom(int length, String type) throws IOException
      Write the atom length and type.
      Throws:
      IOException