net.sf.fmj.media.codec.audio
Class RateConverter

java.lang.Object
  extended by net.sf.fmj.media.AbstractControls
      extended by net.sf.fmj.media.AbstractPlugIn
          extended by net.sf.fmj.media.AbstractCodec
              extended by net.sf.fmj.media.codec.audio.RateConverter
All Implemented Interfaces:
Codec, Controls, PlugIn

public class RateConverter
extends AbstractCodec

Converts between different linear audio formats. Able to change signed/unsigned, endian-ness, bits per sample, sample rate, channels. TODO: optimize. TODO: improve quality of conversions. See for example http://www.fmjsoft.com/atquality.html (name fmjsoft is coincidental). TODO: change stereo to mono by averaging, rather than by omission of 2nd channel. TODO: handle data types besides byte arrays This converter has so many formats that it causes a big slowdown in filter graph building, both for FMJ and JMF.

Author:
Ken Larson

Field Summary
protected  Format[] outputFormats
           
 
Fields inherited from class net.sf.fmj.media.AbstractCodec
inputFormat, inputFormats, opened, outputFormat
 
Fields inherited from interface javax.media.PlugIn
BUFFER_PROCESSED_FAILED, BUFFER_PROCESSED_OK, INPUT_BUFFER_NOT_CONSUMED, OUTPUT_BUFFER_NOT_FILLED, PLUGIN_TERMINATED
 
Constructor Summary
RateConverter()
           
 
Method Summary
 void close()
           
 java.lang.String getName()
           
 Format[] getSupportedOutputFormats(Format input)
           
 void open()
           
 int process(Buffer inputBuffer, Buffer outputBuffer)
           
 Format setInputFormat(Format arg0)
           
 Format setOutputFormat(Format arg0)
           
 
Methods inherited from class net.sf.fmj.media.AbstractCodec
checkInputBuffer, dump, getInputFormat, getOutputFormat, getSupportedInputFormats, isEOM, propagateEOM
 
Methods inherited from class net.sf.fmj.media.AbstractPlugIn
reset
 
Methods inherited from class net.sf.fmj.media.AbstractControls
addControl, getControl, getControls, removeControl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.media.PlugIn
reset
 
Methods inherited from interface javax.media.Controls
getControl, getControls
 

Field Detail

outputFormats

protected Format[] outputFormats
Constructor Detail

RateConverter

public RateConverter()
Method Detail

getName

public java.lang.String getName()
Specified by:
getName in interface PlugIn
Overrides:
getName in class AbstractPlugIn

getSupportedOutputFormats

public Format[] getSupportedOutputFormats(Format input)
Specified by:
getSupportedOutputFormats in interface Codec
Specified by:
getSupportedOutputFormats in class AbstractCodec

open

public void open()
Specified by:
open in interface PlugIn
Overrides:
open in class AbstractPlugIn

close

public void close()
Specified by:
close in interface PlugIn
Overrides:
close in class AbstractPlugIn

process

public int process(Buffer inputBuffer,
                   Buffer outputBuffer)
Specified by:
process in interface Codec
Specified by:
process in class AbstractCodec

setInputFormat

public Format setInputFormat(Format arg0)
Specified by:
setInputFormat in interface Codec
Overrides:
setInputFormat in class AbstractCodec

setOutputFormat

public Format setOutputFormat(Format arg0)
Specified by:
setOutputFormat in interface Codec
Overrides:
setOutputFormat in class AbstractCodec