javax.media.format
Class VideoFormat

java.lang.Object
  |
  +--javax.media.Format
        |
        +--javax.media.format.VideoFormat
Direct Known Subclasses:
H261Format, H263Format, IndexedColorFormat, JPEGFormat, RGBFormat, YUVFormat

public class VideoFormat
extends Format

Encapsulates format information for video data. The attributes of a VideoFormat include the encoding type, frame size, frame rate, and the data type.

Since:
JMF 2.0
See Also:
Serialized Form

Field Summary
static java.lang.String CINEPAK
          Cinepak format.
protected  float frameRate
           
static java.lang.String H261
          H.261 format.
static java.lang.String H261_RTP
          H261 RTP format
static java.lang.String H263
          H.263 format.
static java.lang.String H263_RTP
          H.263 RTP format
static java.lang.String INDEO32
          Indeo Video 3.2
static java.lang.String INDEO41
          Indeo Interactive 4.1
static java.lang.String INDEO50
          Indeo Interactive 5.0
static java.lang.String IRGB
          8-bit Indexed RGB format.
static java.lang.String JPEG
          JPEG format.
static java.lang.String JPEG_RTP
          JPEG RTP format
protected  int maxDataLength
           
static java.lang.String MJPEGA
          Motion JPEG-A format.
static java.lang.String MJPEGB
          Motion JPEG-B format.
static java.lang.String MJPG
          Motion JPEG format.
static java.lang.String MPEG
          MPEG format.
static java.lang.String MPEG_RTP
          MPEG RTP format.
static java.lang.String RGB
          Raw RGB format.
static java.lang.String RLE
          Run Length Encoded video format.
static java.lang.String RPZA
           
protected  java.awt.Dimension size
           
static java.lang.String SMC
          Sorensen format.
static java.lang.String YUV
          Raw YUV or YCrCb format.
 
Fields inherited from class javax.media.Format
byteArray, clz, dataType, encoding, FALSE, formatArray, intArray, NOT_SPECIFIED, shortArray, TRUE
 
Constructor Summary
VideoFormat(java.lang.String encoding)
          Constructs a VideoFormat with the specified encoding type.
VideoFormat(java.lang.String encoding, java.awt.Dimension size, int maxDataLength, java.lang.Class dataType, float frameRate)
          Constructs a VideoFormat with the specified attributes.
 
Method Summary
 java.lang.Object clone()
          Creates a clone of this VideoFormat by copying each field to the clone.
protected  void copy(Format f)
          Copies the attributes from the specified Format into this VideoFormat.
 boolean equals(java.lang.Object format)
          Compares the specified Format with this VideoFormat.
 float getFrameRate()
          Gets the frame rate associated with this VideoFormat.
 int getMaxDataLength()
          Gets the length of the largest data chunk associated with this VideoFormat.
 java.awt.Dimension getSize()
          Gets the dimensions of a video frame in this VideoFormat.
 Format intersects(Format format)
          Finds the attributes shared by two matching Format objects.
 boolean matches(Format format)
          Checks whether or not the specified Format matches this VideoFormat.
 Format relax()
          Generate a format that's less restrictive than this format but contains the basic attributes that will make this resulting format useful for format matching.
 java.lang.String toString()
          Gets a String representation of the attributes of this VideoFormat.
 
Methods inherited from class javax.media.Format
getDataType, getEncoding
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

size

protected java.awt.Dimension size

maxDataLength

protected int maxDataLength

frameRate

protected float frameRate

CINEPAK

public static final java.lang.String CINEPAK
Cinepak format.

JPEG

public static final java.lang.String JPEG
JPEG format.

JPEG_RTP

public static final java.lang.String JPEG_RTP
JPEG RTP format

MPEG

public static final java.lang.String MPEG
MPEG format.

MPEG_RTP

public static final java.lang.String MPEG_RTP
MPEG RTP format.

H261

public static final java.lang.String H261
H.261 format.

H261_RTP

public static final java.lang.String H261_RTP
H261 RTP format

H263

public static final java.lang.String H263
H.263 format.

H263_RTP

public static final java.lang.String H263_RTP
H.263 RTP format

RGB

public static final java.lang.String RGB
Raw RGB format.

YUV

public static final java.lang.String YUV
Raw YUV or YCrCb format.

IRGB

public static final java.lang.String IRGB
8-bit Indexed RGB format.

SMC

public static final java.lang.String SMC
Sorensen format.

RLE

public static final java.lang.String RLE
Run Length Encoded video format.

RPZA

public static final java.lang.String RPZA

MJPG

public static final java.lang.String MJPG
Motion JPEG format.

MJPEGA

public static final java.lang.String MJPEGA
Motion JPEG-A format.

MJPEGB

public static final java.lang.String MJPEGB
Motion JPEG-B format.

INDEO32

public static final java.lang.String INDEO32
Indeo Video 3.2

INDEO41

public static final java.lang.String INDEO41
Indeo Interactive 4.1

INDEO50

public static final java.lang.String INDEO50
Indeo Interactive 5.0
Constructor Detail

VideoFormat

public VideoFormat(java.lang.String encoding)
Constructs a VideoFormat with the specified encoding type.
Parameters:
encoding - A String that describes the encoding type for this VideoFormat.

VideoFormat

public VideoFormat(java.lang.String encoding,
                   java.awt.Dimension size,
                   int maxDataLength,
                   java.lang.Class dataType,
                   float frameRate)
Constructs a VideoFormat with the specified attributes.
Parameters:
encoding - A String that describes the encoding type for this VideoFormat.
size - The size of a video frame.
maxDataLength - The maximum length of a data chunk.
dataType - The type of data. For example, byte array.
frameRate - The frame rate.
Method Detail

getSize

public java.awt.Dimension getSize()
Gets the dimensions of a video frame in this VideoFormat.
Returns:
A Dimension that specifies the frame size.

getMaxDataLength

public int getMaxDataLength()
Gets the length of the largest data chunk associated with this VideoFormat.
Returns:
The maximum length of a data chunk in this VideoFormat.

clone

public java.lang.Object clone()
Creates a clone of this VideoFormat by copying each field to the clone.
Overrides:
clone in class Format
Returns:
A clone of this VideoFormat.

getFrameRate

public float getFrameRate()
Gets the frame rate associated with this VideoFormat.
Returns:
The frame rate.

copy

protected void copy(Format f)
Copies the attributes from the specified Format into this VideoFormat.
Overrides:
copy in class Format
Parameters:
f - The Format to copy the attributes from.

toString

public java.lang.String toString()
Gets a String representation of the attributes of this VideoFormat. For example: "RGB, 352x240, ...".
Overrides:
toString in class Format
Returns:
A String that describes the VideoFormat attributes.

equals

public boolean equals(java.lang.Object format)
Compares the specified Format with this VideoFormat. Returns true only if the specified Format is a VideoFormat object and all of its attributes are identical to the attributes in this VideoFormat.
Overrides:
equals in class Format
Parameters:
format - The Format to compare.
Returns:
true if the specified Format is the same as this one.

matches

public boolean matches(Format format)
Checks whether or not the specified Format matches this VideoFormat. Matches only compares the attributes that are defined in the specified Format, unspecified attributes are ignored.

The two Format objects do not have to be of the same class to match. For example, if "A" are "B" are being compared, a match is possible if "A" is derived from "B" or "B" is derived from "A". (The compared attributes must still match, or matches fails.)

Overrides:
matches in class Format
Parameters:
format - The Format to compare with this one.
Returns:
true if the specified Format matches this one, false if it does not.

intersects

public Format intersects(Format format)
Finds the attributes shared by two matching Format objects. If the specified Format does not match this one, the result is undefined.
Overrides:
intersects in class Format
Parameters:
The - matching Format to intersect with this VideoFormat.
Returns:
A Format object with its attributes set to those attributes common to both Format objects.
See Also:
matches(javax.media.Format)

relax

public Format relax()
Generate a format that's less restrictive than this format but contains the basic attributes that will make this resulting format useful for format matching.
Overrides:
relax in class Format
Returns:
A Format that's less restrictive than the this format.


Submit a bug or feature
Copyright 1999-2000 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved. See the Specification License for more details.
Sun, Sun Microsystems, and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.