FileDocCategorySizeDatePackage
ProcessorModel.javaAPI DocJMF 2.1.1e6500Mon May 12 12:20:36 BST 2003javax.media

ProcessorModel

public class ProcessorModel extends Object
Encapsulates the basic information required to create a Processor. A ProcessorModel can be passed to Manager.createRealizedProcessor to construct a Processor.

Extend this class to provide more control over what the output format of each track should be and let the Manager.createRealizedProcessor method do the rest of the work of creating and realizing a suitable Processor.

since
JMF 2.0

Fields Summary
private Format[]
formats
private MediaLocator
inputLocator
private DataSource
inputDataSource
private ContentDescriptor
outputContentDescriptor
Constructors Summary
public ProcessorModel()
Creates a ProcessorModel with null properties.


               
      
	// Nothing to do
    
public ProcessorModel(Format[] formats, ContentDescriptor outputContentDescriptor)
Creates a ProcessorModel for the specified track formats and output content-type. This constructor creates a ProcessorModel that can be used to construct a Processor for capturing media data.

param
formats An array of Format objects that contains the desired track formats.
param
outputContentDescriptor A ContentDescriptor that describes the desired output content-type.
return
A ProcessorModel that encapsulates the specified attributes.

	this.outputContentDescriptor = outputContentDescriptor;
	this.formats = formats;
    
public ProcessorModel(DataSource inputDataSource, Format[] formats, ContentDescriptor outputContentDescriptor)
Creates a ProcessorModel for the specified input DataSource, track formats, and output type.

param
inputDataSource The DataSource that identifies the media source for the ProcessorModel.
param
formats An array of Format objects that contains the desired track formats.
param
outputContentDescriptor A ContentDescriptor that describes the desired output content-type.
return
A ProcessorModel that encapsulates the specified attributes.

	this.inputDataSource = inputDataSource;
	this.formats = formats;
	this.outputContentDescriptor = outputContentDescriptor;
	
    
public ProcessorModel(MediaLocator inputLocator, Format[] formats, ContentDescriptor outputContentDescriptor)
Creates a ProcessorModel for the specified input MediaLocator, track formats, and output type.

param
inputLocator The MediaLocator that identifies the media source for this ProcessorModel.
param
formats An array of Format objects that contains the desired track formats.
param
outputContentDescriptor A ContentDescriptor that describes the desired output content-type.
return
A ProcessorModel that encapsulates the specified attributes.

	this.inputLocator = inputLocator;
	this.formats = formats;
	this.outputContentDescriptor = outputContentDescriptor;
	
    
Methods Summary
public javax.media.protocol.ContentDescriptorgetContentDescriptor()
Gets the output content-type specified by this ProcessorModel.

return
A ContentDescriptor that defines the output content-type. Returns null if the output type is not applicable or the output streams are to contain raw data that doesn't pertain to a specific content-type.

	return outputContentDescriptor;
    
public javax.media.protocol.DataSourcegetInputDataSource()
Gets the input DataSource that specifies the media source for this ProcessorModel. The inputLocator is ignored if this value is non-null.

return
A DataSource that specifies the media source.

	return inputDataSource;
    
public javax.media.MediaLocatorgetInputLocator()
Gets the input MediaLocator that specifies the media source for this ProcessorModel. This value is ignored if an input DataSource is specified.

return
A MediaLocator that specifies the media source.

	return inputLocator;
    
public javax.media.FormatgetOutputTrackFormat(int tIndex)
Gets the preferred Format of the specified track.

param
tIndex The index of the track for which you want to get the preferred Format.
return
The preferred Format for the track.

	if (formats != null && formats.length > tIndex)
	    return formats[tIndex];
	return null;
    
public intgetTrackCount(int availableTrackCount)
Gets the number of tracks required as the output of the Processor constructed with this ProcessorModel.

param
availableTrackCount The number of tracks available, as an integer.
return
The number of tracks required, as an integer.

	if (formats != null)
	    return formats.length;
	return -1;
    
public booleanisFormatAcceptable(int tIndex, javax.media.Format tFormat)
Checks whether or not tFormat is an acceptable format for the track tIndex.

param
tIndex The index of the track you want to check.
param
tFormat The Format to check.
return
true if the Format is acceptable, otherwise returns false.

	if (formats != null && formats.length > tIndex) {
	    if (tFormat.matches(formats[tIndex]))
		return true;
	    else
		return false;
	}
	return true;