Class AbstractAVIStream.Track
java.lang.Object
org.monte.media.avi.AbstractAVIStream.Track
- Direct Known Subclasses:
AbstractAVIStream.AudioTrack,AbstractAVIStream.MidiTrack,AbstractAVIStream.TextTrack,AbstractAVIStream.VideoTrack
- Enclosing class:
AbstractAVIStream
Represents a track (or "stream") in an AVI file.
A track is defined
by an "strh" chunk, which contains an AVISTREAMHEADER struct.
Additional chunks can be provided depending on the media type of the
track.
See http://msdn.microsoft.com/en-us/library/ms779638(VS.85).aspx
-----------------
AVI Stream Header
-----------------
enum {
audioStream = "auds",
midiStream = "mids",
textStream = "txts",
videoStream = "vids"
} aviStrhType;
set {
disabled = 0x00000001, // Indicates this stream should not be enabled by default.
videoPaletteChanges = 0x00010000
// Indicates this video stream contains palette changes. This flag
// warns the playback software that it will need to animate the palette.
} aviStrhFlags;
typedef struct {
Int16 left;
Int16 top;
Int16 right;
Int16 bottom;
} aviRectangle;
typedef struct {
FOURCC enum aviStrhType type;
// Contains a FOURCC that specifies the type of the data contained in
// the stream. The following standard AVI values for video and audio are
// defined.
FOURCC handler;
// Optionally, contains a FOURCC that identifies a specific data
// handler.
// The data handler is the preferred handler for the stream. For audio
// and video streams, this specifies the codec for decoding the stream.
DWORD set aviStrhFlags flags;
// Contains any flags for the data stream. The bits in the high-order
// word of these flags are specific to the type of data contained in the
// stream.
WORD priority;
// Specifies priority of a stream type. For example, in a file with
// multiple audio streams, the one with the highest priority might be
// the default stream.
WORD language;
DWORD initialFrames;
// Specifies how far audio data is skewed ahead of the video frames in
// interleaved files. Typically, this is about 0.75 seconds. If you are
// creating interleaved files, specify the number of frames in the file
// prior to the initial frame of the AVI sequence in this member. For
// more information about the contents of this member, see "Special
// Information for Interleaved Files" in the Video for Windows
// Programmer's Guide.
DWORD scale;
// Used with "rate" to specify the time scale that this stream will use.
// Dividing "rate" by "scale" gives the number of samples per second.
// For video streams, this is the frame rate. For audio streams, this
// rate corresponds to the time needed to play blockAlign bytes of
// audio, which for PCM audio is the just the sample rate.
DWORD rate;
// See "scale".
DWORD startTime;
// Specifies the starting time for this stream. The units are defined by
// the "rate" and "scale" members in the main file header. Usually, this
// is zero, but it can specify a delay time for a stream that does not
// startTime concurrently with the file.
DWORD length;
// Specifies the length of this stream. The units are defined by the
// "rate" and "scale" members of the stream's header.
DWORD suggestedBufferSize;
// Specifies how large a buffer should be used to read this stream.
// Typically, this contains a value corresponding to the largest chunk
// present in the stream. Using the correct buffer size makes playback
// more efficient. Use zero if you do not know the correct buffer size.
DWORD quality;
// Specifies an indicator of the quality of the data in the stream.
// Quality is represented as a number between 0 and 10,000. For
// compressed data, this typically represents the value of the quality
// parameter passed to the compression software. If set to �1, drivers
// use the default quality value.
DWORD sampleSize;
// Specifies the size of a single sample of data. This is set to zero if
// the samples can vary in size. If this number is nonzero, then
// multiple samples of data can be grouped into a single chunk within
// the file. If it is zero, each sample of data (such as a video frame)
// must be in a separate chunk. For video streams, this number is
// typically zero, although it can be nonzero if all video frames are
// the same size. For audio streams, this number should be the same as
// the blockAlign member of the WAVEFORMATEX structure describing the audio.
aviRectangle frame;
// Specifies the destination rectangle for a text or video stream within
// the movie rectangle specified by the "frameWidth" and "frameHeight"
// members of the AVI main header structure. The "frame" member is
// typically used in support of multiple video streams. Set this
// rectangle to the coordinates corresponding to the movie rectangle to
// update the whole movie rectangle. Units for this member are pixels.
// The upper-left corner of the destination rectangle is relative to the
// upper-left corner of the movie rectangle.
} AVISTREAMHEADER; * - Author:
- Werner Randelshofer
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe codec.List of additional header chunks.protected intOptionally, contains a FOURCC that identifies a specific data handler.protected intContains any flags for the data stream.The media format.protected longSpecifies how far audio data is skewed ahead of the video frames in interleaved files.The input buffer is used when one of the convenience methods without a Buffer parameter is used.protected intLanguage tag.longSpecifies the length of this stream.mediaType.fccTypecontains a FOURCC that specifies the type of the data contained in the stream.protected StringThe optional name of the track.The output buffer is used to store the output of the codec.protected intSpecifies priority of a stream type.protected intSpecifies an indicator of the quality of the data in the stream.longThe rate of the media in scale units.longThe current chunk index of the reader.List of samples.longUsed with rate to specify the time scale that this stream will use.longSpecifies the starting time for this stream.protected AbstractAVIStream.FixedSizeDataChunkThis chunk holds the AVI Stream Format Header.protected AbstractAVIStream.FixedSizeDataChunkThis chunk holds the AVI Stream Header.intInterval between sync samples (keyframes).protected intThe twoCC code is used for the ids of the chunks which hold the data samples. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidabstract intgetSampleChunkFourCC(boolean isSync) abstract long
-
Field Details
-
format
The media format.FIXME - AbstractAVIStream should have no dependencies to Format.
-
samples
List of samples. -
syncInterval
public int syncIntervalInterval between sync samples (keyframes). 0 = automatic. 1 = write all samples as sync samples. n = sync every n-th sample. -
twoCC
protected int twoCCThe twoCC code is used for the ids of the chunks which hold the data samples. -
mediaType
mediaType.fccTypecontains a FOURCC that specifies the type of the data contained in the stream. The following standard AVI values for video and audio are defined.FOURCC Description 'auds' Audio stream 'mids' MIDI stream 'txts' Text stream 'vids' Video stream
-
fccHandler
protected int fccHandlerOptionally, contains a FOURCC that identifies a specific data handler. The data handler is the preferred handler for the stream. For audio and video streams, this specifies the codec for decoding the stream. -
flags
protected int flagsContains any flags for the data stream. The bits in the high-order word of these flags are specific to the type of data contained in the stream. The following standard flags are defined.Value Description
AVISF_DISABLED 0x00000001 Indicates this stream should not be enabled by default.
AVISF_VIDEO_PALCHANGES 0x00010000 Indicates this video stream contains palette changes. This flag warns the playback software that it will need to animate the palette.
-
priority
protected int prioritySpecifies priority of a stream type. For example, in a file with multiple audio streams, the one with the highest priority might be the default stream. -
language
protected int languageLanguage tag. -
initialFrames
protected long initialFramesSpecifies how far audio data is skewed ahead of the video frames in interleaved files. Typically, this is about 0.75 seconds. If you are creating interleaved files, specify the number of frames in the file prior to the initial frame of the AVI sequence in this member. For more information, see the remarks for the initialFrames member of the AVIMAINHEADER structure. -
scale
public long scaleUsed with rate to specify the time scale that this stream will use. Dividing rate by scale gives the number of samples per second. For video streams, this is the frame rate. For audio streams, this rate corresponds to the time needed to play blockAlign bytes of audio, which for PCM audio is the just the sample rate. -
rate
public long rateThe rate of the media in scale units. -
startTime
public long startTimeSpecifies the starting time for this stream. The units are defined by the rate and scale members in the main file header. Usually, this is zero, but it can specify a delay time for a stream that does not startTime concurrently with the file. -
length
public long lengthSpecifies the length of this stream. The units are defined by the rate and scale members of the stream's header. -
quality
protected int qualitySpecifies an indicator of the quality of the data in the stream. Quality is represented as a number between 0 and 10,000. For compressed data, this typically represents the value of the quality parameter passed to the compression software. If set to –1, drivers use the default quality value. -
strhChunk
This chunk holds the AVI Stream Header. -
strfChunk
This chunk holds the AVI Stream Format Header. -
name
The optional name of the track. -
codec
The codec. -
outputBuffer
The output buffer is used to store the output of the codec. -
inputBuffer
The input buffer is used when one of the convenience methods without a Buffer parameter is used. -
readIndex
public long readIndexThe current chunk index of the reader. -
extraHeaders
-
-
Constructor Details
-
Track
-
-
Method Details
-
getSTRFChunkSize
public abstract long getSTRFChunkSize() -
getSampleChunkFourCC
public abstract int getSampleChunkFourCC(boolean isSync) -
addSample
-