java.lang.Object
org.monte.media.av.AbstractCodec
org.monte.media.av.codec.video.AbstractVideoCodec
org.monte.media.avi.codec.video.DIBCodec
- All Implemented Interfaces:
Codec
DIBCodec encodes a BufferedImage as a Microsoft Device Independent
Bitmap (DIB) into a byte array.
The DIB codec only works with the AVI file format. Other file formats, such as QuickTime, use a different encoding for uncompressed video.
This codec currently only supports encoding from a BufferedImage into
the file format. Decoding support may be added in the future.
This codec does not encode the color palette of an image. This must be done separately.
The pixels of a frame are written row by row from bottom to top and from the left to the right. 24-bit pixels are encoded as BGR.
Supported input formats:
FormatwithBufferedImage.class, any width, any height, depth=4.
Formatwithbyte[].class, same width and height as input format, depth=4.
- Author:
- Werner Randelshofer
-
Field Summary
Fields inherited from class org.monte.media.av.AbstractCodec
inputFormat, inputFormats, name, outputFormat, outputFormatsFields inherited from interface org.monte.media.av.Codec
CODEC_FAILED, CODEC_INPUT_NOT_CONSUMED, CODEC_OK, CODEC_OUTPUT_NOT_FILLED -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintintintPerforms the media processing defined by this codec.voidreadKey24(byte[] in, int offset, int length, BufferedImage img) voidreadKey4(byte[] in, int offset, int length, BufferedImage img) voidreadKey8(byte[] in, int offset, int length, BufferedImage img) Sets the output format.voidwriteKey24(OutputStream out, int[] pixels, int width, int height, int offset, int scanlineStride) Encodes a 24-bit key frame.voidwriteKey4(OutputStream out, byte[] pixels, int width, int height, int offset, int scanlineStride) Encodes a 4-bit key frame.voidwriteKey8(OutputStream out, byte[] pixels, int width, int height, int offset, int scanlineStride) Encodes an 8-bit key frame.Methods inherited from class org.monte.media.av.codec.video.AbstractVideoCodec
copyImage, getARGB32, getBufferedImage, getColorModel, getIndexed8, getRGB15, getRGB16, getRGB24, writeInt24, writeInt24LE, writeInts24, writeInts24LEMethods inherited from class org.monte.media.av.AbstractCodec
getInputFormat, getInputFormats, getName, getOutputFormat, getOutputFormats, reset, setInputFormat, toString
-
Constructor Details
-
DIBCodec
public DIBCodec()
-
-
Method Details
-
setOutputFormat
Description copied from interface:CodecSets the output format. Returns the format that was actually set. This is the closest format that the Codec supports. Returns null if the specified format is not supported and no reasonable match could be found.- Specified by:
setOutputFormatin interfaceCodec- Overrides:
setOutputFormatin classAbstractCodec
-
process
Description copied from interface:CodecPerforms the media processing defined by this codec.Copies the data from the input buffer into the output buffer.
- Returns:
- A combination of processing flags.
-
decode
-
encode
-
readKey4
-
readKey8
-
readKey24
-
writeKey4
public void writeKey4(OutputStream out, byte[] pixels, int width, int height, int offset, int scanlineStride) throws IOException Encodes a 4-bit key frame.- Parameters:
out- The output stream.pixels- The image data.width- The width of the image in data elements.offset- The offset to the first pixel in the data array.scanlineStride- The number to append to offset to get to the next scanline.- Throws:
IOException
-
writeKey8
public void writeKey8(OutputStream out, byte[] pixels, int width, int height, int offset, int scanlineStride) throws IOException Encodes an 8-bit key frame.- Parameters:
out- The output stream.pixels- The image data.width- The width of the image in data elements.offset- The offset to the first pixel in the data array.scanlineStride- The number to append to offset to get to the next scanline.- Throws:
IOException
-
writeKey24
public void writeKey24(OutputStream out, int[] pixels, int width, int height, int offset, int scanlineStride) throws IOException Encodes a 24-bit key frame.- Parameters:
out- The output stream.pixels- The image data.width- The width of the image in data elements.offset- The offset to the first pixel in the data array.scanlineStride- The number to append to offset to get to the next scanline.- Throws:
IOException
-