FileDocCategorySizeDatePackage
GSMMux.javaAPI DocJMF 2.1.1e2491Mon May 12 12:20:58 BST 2003com.sun.media.multiplexer.audio

GSMMux

public class GSMMux extends BasicMux

Fields Summary
Constructors Summary
public GSMMux()

	supportedInputs = new Format[1];
	supportedInputs[0] = new AudioFormat(AudioFormat.GSM);
	supportedOutputs = new ContentDescriptor[1];
	supportedOutputs[0] = new FileTypeDescriptor(FileTypeDescriptor.GSM);
    
Methods Summary
public java.lang.StringgetName()

	return "GSM Multiplexer";
    
public javax.media.FormatsetInputFormat(javax.media.Format input, int trackID)

	if (!(input instanceof AudioFormat))
	    return null;
	AudioFormat format = (AudioFormat) input;
	double sampleRate =  format.getSampleRate();

	String reason = null;
	double epsilon = 0.25;

	// Check to see if some of these restrictions can be removed
 	if (!format.getEncoding().equalsIgnoreCase(AudioFormat.GSM))
	    reason = "Encoding has to be GSM";
	else if ( Math.abs(sampleRate - 8000.0) > epsilon )
	    reason = "Sample rate should be 8000. Cannot handle sample rate " + sampleRate;
 	else if (format.getFrameSizeInBits() != (33*8))
 	    reason = "framesize should be 33 bytes";
	else if (format.getChannels() != 1)
	    reason = "Number of channels should be 1";		

	if (reason != null) {
	    return null;
	} else {
	    inputs[0] = format;
	    return format;
	}