Copyright 2012-04-26 Werner Randelshofer

org.monte.media.avi
Class AbstractAVIStream

java.lang.Object
  extended by org.monte.media.avi.AbstractAVIStream
Direct Known Subclasses:
AVIInputStream, AVIOutputStream

public abstract class AbstractAVIStream
extends java.lang.Object

This is the base class for low-level AVI stream IO.

Version:
$Id: AbstractAVIStream.java 160 2012-01-28 17:07:17Z werner $
Author:
Werner Randelshofer

Nested Class Summary
protected  class AbstractAVIStream.AudioTrack
           The format of a video track is defined in a "strf" chunk, which contains a WAVEFORMATEX struct.
static class AbstractAVIStream.AVIMediaType
          Supported media types.
protected  class AbstractAVIStream.Chunk
          Chunk base class.
protected  class AbstractAVIStream.CompositeChunk
          A CompositeChunk contains an ordered list of Chunks.
protected  class AbstractAVIStream.DataChunk
          Data Chunk.
protected  class AbstractAVIStream.FixedSizeDataChunk
          A DataChunk with a fixed size.
protected static class AbstractAVIStream.MainHeader
          Holds information about the entire movie.
protected  class AbstractAVIStream.MidiTrack
           
protected static class AbstractAVIStream.Sample
          AVI stores media data in sample chunks.
protected  class AbstractAVIStream.TextTrack
           
protected  class AbstractAVIStream.Track
          Represents a track (or "stream") in an AVI file.
protected  class AbstractAVIStream.VideoTrack
          Represents a video track in an AVI file.
 
Field Summary
protected static int AVI_ID
          Chunk IDs.
static int AVIH_FLAG_COPYRIGHTED
           
static int AVIH_FLAG_HAS_INDEX
          Indicates the AVI file has an index.
static int AVIH_FLAG_IS_INTERLEAVED
          Indicates the AVI file is interleaved.
static int AVIH_FLAG_MUST_USE_INDEX
          Indicates that application should use the index, rather than the physical ordering of the chunks in the file, to determine the order of presentation of the data.
static int AVIH_FLAG_TRUST_CK_TYPE
          ??
static int AVIH_FLAG_WAS_CAPTURE_FILE
          // Indicates the AVI file is a specially allocated file used for capturing real-time video.
protected static int AVIH_ID
           
protected static int HDRL_ID
           
protected static int IDX1_ID
           
protected static int LIST_ID
           
protected static int MOVI_ID
           
protected  javax.imageio.stream.ImageOutputStream out
          Underlying output stream.
protected static int REC_ID
           
protected static int STRD_ID
           
protected  long streamOffset
          The offset in the underlying ImageOutputStream.
protected static int STRF_ID
           
static int STRH_FLAG_DISABLED
          Indicates this stream should not be enabled by default.
static int STRH_FLAG_VIDEO_PALETTE_CHANGES
          Indicates this video stream contains palette changes.
protected static int STRH_ID
           
protected static int STRL_ID
           
protected static int STRN_ID
           
protected  java.util.ArrayList<AbstractAVIStream.Track> tracks
          The list of tracks in the file.
 
Constructor Summary
AbstractAVIStream()
           
 
Method Summary
protected  long getRelativeStreamPosition()
          Gets the position relative to the beginning of the QuickTime stream.
protected static java.lang.String intToType(int id)
           
protected static boolean isFlagSet(int flag, int mask)
          Returns true, if the specified mask is set on the flag.
protected  void seekRelative(long newPosition)
          Seeks relative to the beginning of the AVI stream.
protected static int typeToInt(java.lang.String str)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

AVI_ID

protected static final int AVI_ID
Chunk IDs.

See Also:
Constant Field Values

LIST_ID

protected static final int LIST_ID
See Also:
Constant Field Values

MOVI_ID

protected static final int MOVI_ID
See Also:
Constant Field Values

HDRL_ID

protected static final int HDRL_ID
See Also:
Constant Field Values

AVIH_ID

protected static final int AVIH_ID
See Also:
Constant Field Values

STRL_ID

protected static final int STRL_ID
See Also:
Constant Field Values

STRH_ID

protected static final int STRH_ID
See Also:
Constant Field Values

STRN_ID

protected static final int STRN_ID
See Also:
Constant Field Values

STRF_ID

protected static final int STRF_ID
See Also:
Constant Field Values

STRD_ID

protected static final int STRD_ID
See Also:
Constant Field Values

IDX1_ID

protected static final int IDX1_ID
See Also:
Constant Field Values

REC_ID

protected static final int REC_ID
See Also:
Constant Field Values

AVIH_FLAG_HAS_INDEX

public static final int AVIH_FLAG_HAS_INDEX
Indicates the AVI file has an index.

See Also:
Constant Field Values

AVIH_FLAG_MUST_USE_INDEX

public static final int AVIH_FLAG_MUST_USE_INDEX
Indicates that application should use the index, rather than the physical ordering of the chunks in the file, to determine the order of presentation of the data. For example, this flag could be used to create a list of frames for editing.

See Also:
Constant Field Values

AVIH_FLAG_IS_INTERLEAVED

public static final int AVIH_FLAG_IS_INTERLEAVED
Indicates the AVI file is interleaved.

See Also:
Constant Field Values

AVIH_FLAG_TRUST_CK_TYPE

public static final int AVIH_FLAG_TRUST_CK_TYPE
??

See Also:
Constant Field Values

AVIH_FLAG_WAS_CAPTURE_FILE

public static final int AVIH_FLAG_WAS_CAPTURE_FILE
// Indicates the AVI file is a specially allocated file used for capturing real-time video. Applications should warn the user before writing over a file with this flag set because the user probably defragmented this file.

See Also:
Constant Field Values

AVIH_FLAG_COPYRIGHTED

public static final int AVIH_FLAG_COPYRIGHTED
See Also:
Constant Field Values

STRH_FLAG_DISABLED

public static final int STRH_FLAG_DISABLED
Indicates this stream should not be enabled by default.

See Also:
Constant Field Values

STRH_FLAG_VIDEO_PALETTE_CHANGES

public static final int STRH_FLAG_VIDEO_PALETTE_CHANGES
Indicates this video stream contains palette changes. This flag warns the playback software that it will need to animate the palette.

See Also:
Constant Field Values

out

protected javax.imageio.stream.ImageOutputStream out
Underlying output stream.


streamOffset

protected long streamOffset
The offset in the underlying ImageOutputStream. Normally this is 0 unless the underlying stream already contained data when it was passed to the constructor.


tracks

protected java.util.ArrayList<AbstractAVIStream.Track> tracks
The list of tracks in the file.

Constructor Detail

AbstractAVIStream

public AbstractAVIStream()
Method Detail

getRelativeStreamPosition

protected long getRelativeStreamPosition()
                                  throws java.io.IOException
Gets the position relative to the beginning of the QuickTime stream.

Usually this value is equal to the stream position of the underlying ImageOutputStream, but can be larger if the underlying stream already contained data.

Returns:
The relative stream position.
Throws:
java.io.IOException

seekRelative

protected void seekRelative(long newPosition)
                     throws java.io.IOException
Seeks relative to the beginning of the AVI stream.

Usually this equal to seeking in the underlying ImageOutputStream, but can be different if the underlying stream already contained data.

Throws:
java.io.IOException

typeToInt

protected static int typeToInt(java.lang.String str)

intToType

protected static java.lang.String intToType(int id)

isFlagSet

protected static boolean isFlagSet(int flag,
                                   int mask)
Returns true, if the specified mask is set on the flag.


Copyright 2012-04-26 Werner Randelshofer