1.0: Final Release

javax.microedition.amms.control
Interface FormatControl

All Superinterfaces:
javax.microedition.media.Control
All Known Subinterfaces:
AudioFormatControl, ContainerFormatControl, ImageFormatControl, VideoFormatControl

public interface FormatControl
extends javax.microedition.media.Control

FormatControl controls the format used for storing media.

Formats are specified when media is captured from a Player or if the format is changed when media is processed by a MediaProcessor. FormatControl is a super interface for ContainerFormatControl, ImageFormatControl, AudioFormatControl and VideoFormatControls. FormatControl specifies the methods to set and get various parameters to specify the media format.

The purpose of the the different format Controls is as follows:

Formats

The format is set by the setFormat method which takes one of the formats returned by the getSupportedFormats as a parameter. Formats are represented as MIME types. MIME type alone does not provide enough information to specify the format exactly. Once the format has been set by setFormat() FormatControl.PARAM_VERSION_TYPE parameter can be used to set the format exactly to the one that is wanted.

PARAM_VERSION_TYPE definitions are not part of this specification. Instead, a list of definitions can be downloaded from Forum Nokia. The list will be constantly updated and new types will be added as needed.

Parameters

The parameter interface allows various content type specific parameters to be accessed. Supported integer parameters are queried by getSupportedIntParameters and supported String parameters by getSupportedStrParameters, respectively. The range of integer values to be set by setParameter(String parameter, int value) can be queried by getSupportedIntParameterRange. Different values for String parameters to be set by setParameter(String parameter, String value) can be queried by getSupportedStrParameterValues.

Metadata

Some formats can contain metadata that can be set by setMetadata. getMetadataSupportMode tells what kind of metadata can be set to the media and getSupportedMetadataKeys returns a list of the metadata keys or, in case any metadata keys can be used, a list of the most common ones.

Occasionally, when the MediaProcessor is used it is possible that the metadata is at the end of the processed stream and it is not known before the processing is started. This could result into contradiction between the metadata set by the application and the metadata already in the media. setMetadataOverride() can be used to tell if the new metadata should override the existing metadata or vice versa.


Field Summary
static int METADATA_NOT_SUPPORTED
          Setting metadata is not supported.
static int METADATA_SUPPORTED_FIXED_KEYS
          Setting metadata is supported and the set of metadata keys is limited.
static int METADATA_SUPPORTED_FREE_KEYS
          Setting metadata is supported and any Strings can be used as metadata keys.
static java.lang.String PARAM_BITRATE
          The output bit rate integer parameter.
static java.lang.String PARAM_BITRATE_TYPE
          The bit rate type String parameter tells if the bit rate is constant or variable.
static java.lang.String PARAM_FRAMERATE
          The output frame rate integer parameter.
static java.lang.String PARAM_QUALITY
          The quality parameter for example for JPEG.
static java.lang.String PARAM_SAMPLERATE
          The output sample rate integer parameter.
static java.lang.String PARAM_VERSION_TYPE
          The format version type String parameter to specify what is the the type of the format.
 
Method Summary
 int getEstimatedBitRate()
          Gets the estimated bit rate of the media.
 java.lang.String getFormat()
          Get the format.
 int getIntParameterValue(java.lang.String parameter)
          Gets the current value of an integer parameter.
 boolean getMetadataOverride()
          Returns the metadata override mode.
 int getMetadataSupportMode()
          Returns the metadata support mode.
 java.lang.String getStrParameterValue(java.lang.String parameter)
          Gets the current value of a String parameter.
 java.lang.String[] getSupportedFormats()
          Gets supported formats.
 int[] getSupportedIntParameterRange(java.lang.String parameter)
          Gets range for the given int-valued parameter.
 java.lang.String[] getSupportedIntParameters()
          Gets the supported parameters for the current format.
 java.lang.String[] getSupportedMetadataKeys()
          Returns a list of supported metadata keys.
 java.lang.String[] getSupportedStrParameters()
          Gets the supported parameters for the current format.
 java.lang.String[] getSupportedStrParameterValues(java.lang.String parameter)
          Gets available values for the given String-valued parameter.
 void setFormat(java.lang.String format)
          Sets the format.
 void setMetadata(java.lang.String key, java.lang.String value)
          Sets metadata for the media
 void setMetadataOverride(boolean override)
          Sets the metadata override mode.
 int setParameter(java.lang.String parameter, int value)
          Sets int-valued parameter's value.
 void setParameter(java.lang.String parameter, java.lang.String value)
          Sets String-valued parameter's value.
 

Field Detail

METADATA_NOT_SUPPORTED

public static final int METADATA_NOT_SUPPORTED
Setting metadata is not supported.

See Also:
Constant Field Values

METADATA_SUPPORTED_FIXED_KEYS

public static final int METADATA_SUPPORTED_FIXED_KEYS
Setting metadata is supported and the set of metadata keys is limited.

See Also:
Constant Field Values

METADATA_SUPPORTED_FREE_KEYS

public static final int METADATA_SUPPORTED_FREE_KEYS
Setting metadata is supported and any Strings can be used as metadata keys.

See Also:
Constant Field Values

PARAM_BITRATE

public static final java.lang.String PARAM_BITRATE
The output bit rate integer parameter. The value of this parameter will be defined in bits per second.

See Also:
Constant Field Values

PARAM_BITRATE_TYPE

public static final java.lang.String PARAM_BITRATE_TYPE
The bit rate type String parameter tells if the bit rate is constant or variable. Possible values are "constant" and "variable".

See Also:
Constant Field Values

PARAM_SAMPLERATE

public static final java.lang.String PARAM_SAMPLERATE
The output sample rate integer parameter. The value of this parameter will be defined in samples per second.

See Also:
Constant Field Values

PARAM_FRAMERATE

public static final java.lang.String PARAM_FRAMERATE
The output frame rate integer parameter. The value of this parameter will be defined in samples per second.

See Also:
Constant Field Values

PARAM_QUALITY

public static final java.lang.String PARAM_QUALITY
The quality parameter for example for JPEG. This parameter can be both integer and String.

See Also:
Constant Field Values

PARAM_VERSION_TYPE

public static final java.lang.String PARAM_VERSION_TYPE
The format version type String parameter to specify what is the the type of the format.

See Also:
Constant Field Values
Method Detail

getSupportedFormats

public java.lang.String[] getSupportedFormats()
Gets supported formats.

Returns:
an array of supported formats

getSupportedStrParameters

public java.lang.String[] getSupportedStrParameters()
Gets the supported parameters for the current format.

Returns:
an array of supported String-valued parameters

getSupportedIntParameters

public java.lang.String[] getSupportedIntParameters()
Gets the supported parameters for the current format.

Returns:
an array of supported int-valued parameters

getSupportedStrParameterValues

public java.lang.String[] getSupportedStrParameterValues(java.lang.String parameter)
Gets available values for the given String-valued parameter.

Parameters:
parameter - the parameter whose valid values are queried
Returns:
an array of supported values for the given parameter
Throws:
java.lang.IllegalArgumentException - if the parameter is not supported or if it is null

getSupportedIntParameterRange

public int[] getSupportedIntParameterRange(java.lang.String parameter)
Gets range for the given int-valued parameter.

Parameters:
parameter - the parameter whose range is queried
Returns:
min and max value for the given parameter
Throws:
java.lang.IllegalArgumentException - if the parameter is not supported or if it is null

setFormat

public void setFormat(java.lang.String format)
Sets the format.

Parameters:
format - the new format
Throws:
java.lang.IllegalArgumentException - if the format is not supported or if it is null

getFormat

public java.lang.String getFormat()
Get the format.

Returns:
the current format

setParameter

public int setParameter(java.lang.String parameter,
                        int value)
Sets int-valued parameter's value.

Parameters:
parameter - the parameter to be set
value - the new value to be set
Returns:
the value that was set
Throws:
java.lang.IllegalArgumentException - if the parameter is not supported or the value for the supported parameter is not supported or if the parameter is null

setParameter

public void setParameter(java.lang.String parameter,
                         java.lang.String value)
Sets String-valued parameter's value.

Parameters:
parameter - the parameter to be set
value - the new value to be set
Throws:
java.lang.IllegalArgumentException - if the parameter is not supported or the value for the supported parameter is not supported or if the parameter or value is null

getStrParameterValue

public java.lang.String getStrParameterValue(java.lang.String parameter)
Gets the current value of a String parameter.

Parameters:
parameter - the parameter whose value is queried
Returns:
the current value of the given parameter
Throws:
java.lang.IllegalArgumentException - if the parameter is not supported or if it is null

getIntParameterValue

public int getIntParameterValue(java.lang.String parameter)
Gets the current value of an integer parameter.

Parameters:
parameter - the parameter whose value is queried
Returns:
the current value of the given parameter
Throws:
java.lang.IllegalArgumentException - if the parameter is not supported or if it is null

getEstimatedBitRate

public int getEstimatedBitRate()
                        throws javax.microedition.media.MediaException
Gets the estimated bit rate of the media.

Returns:
estimated bit rate in bits/second
Throws:
javax.microedition.media.MediaException - if size estimation is not supported or if the media type is unstreamable

setMetadata

public void setMetadata(java.lang.String key,
                        java.lang.String value)
                 throws javax.microedition.media.MediaException
Sets metadata for the media

Parameters:
key - metadata key
value - metadata value
Throws:
javax.microedition.media.MediaException - if setting of the metadata is not supported
java.lang.IllegalArgumentException - if the key or value contains unsupported values or if either is null

getSupportedMetadataKeys

public java.lang.String[] getSupportedMetadataKeys()
Returns a list of supported metadata keys. If any String can be used as a metadata getSupportedMetadataKeys returns a list of the most common metadata keys

Returns:
supported metadata keys or a list of the most common ones

getMetadataSupportMode

public int getMetadataSupportMode()
Returns the metadata support mode. The support mode is one of the following.

Returns:
current metadata support mode

setMetadataOverride

public void setMetadataOverride(boolean override)
Sets the metadata override mode. In the overried mode, the metadata set by the application overrides the metadata existing in the media when the existing metadata is found out only when the processing of the media is already going on.

By default, the metadata override mode is true.

Parameters:
override - true to make application set metadata to be written on top of the existing metadata, false to preserve the existing metadata

getMetadataOverride

public boolean getMetadataOverride()
Returns the metadata override mode.

Returns:
true if the metadata set by the application overrides the existing metadata, false if the existing metadata is preserved

1.0: Final Release

Copyright © 2004-2005 Nokia Corporation. See the Copyright for details.