net.sf.fmj.media.multiplexer.audio
Class JavaSoundMux

java.lang.Object
  extended by net.sf.fmj.media.AbstractControls
      extended by net.sf.fmj.media.AbstractPlugIn
          extended by net.sf.fmj.media.AbstractMultiplexer
              extended by net.sf.fmj.media.multiplexer.AbstractStreamCopyMux
                  extended by net.sf.fmj.media.multiplexer.audio.JavaSoundMux
All Implemented Interfaces:
Controls, Multiplexer, PlugIn
Direct Known Subclasses:
AIFFMux, AUMux, WAVMux

public abstract class JavaSoundMux
extends AbstractStreamCopyMux

Audio multiplexer base class implemented using JavaSound. This mux has the job of taking buffers passed in to process, and converting them to a stream to be read by Javasound, and then converting the stream written by Javasound into something that can be read as a track of a datasource. TODO: size is written to file headers as Integer.MAXINT, because the seeking back to the beginning and rewriting of the header is not yet implemented. JMF appears to do this with a hack, casting the SourceTransferHandler to a Seekable, and seeking the output, then rewriting. TODO: not so sure of all the open/close/connect/disconnect and which should call what when.

Author:
Ken Larson

Field Summary
 
Fields inherited from class net.sf.fmj.media.AbstractMultiplexer
inputFormats, numTracks, outputContentDescriptor
 
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
JavaSoundMux(FileTypeDescriptor fileTypeDescriptor, javax.sound.sampled.AudioFileFormat.Type audioFileFormatType)
           
 
Method Summary
protected  StreamCopyPushDataSource createInputStreamPushDataSource(ContentDescriptor outputContentDescriptor, int numTracks, java.io.InputStream[] inputStreams, Format[] inputFormats)
           
 Format[] getSupportedInputFormats()
           
 int setNumTracks(int numTracks)
           
protected  void write(java.io.InputStream in, java.io.OutputStream out, javax.sound.sampled.AudioFormat javaSoundFormat)
           
 
Methods inherited from class net.sf.fmj.media.multiplexer.AbstractStreamCopyMux
close, getDataOutput, getSupportedOutputContentDescriptors, open, process
 
Methods inherited from class net.sf.fmj.media.AbstractMultiplexer
setContentDescriptor, setInputFormat
 
Methods inherited from class net.sf.fmj.media.AbstractPlugIn
getName, 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
getName, reset
 
Methods inherited from interface javax.media.Controls
getControl, getControls
 

Constructor Detail

JavaSoundMux

public JavaSoundMux(FileTypeDescriptor fileTypeDescriptor,
                    javax.sound.sampled.AudioFileFormat.Type audioFileFormatType)
Method Detail

setNumTracks

public int setNumTracks(int numTracks)
Specified by:
setNumTracks in interface Multiplexer
Overrides:
setNumTracks in class AbstractStreamCopyMux

createInputStreamPushDataSource

protected StreamCopyPushDataSource createInputStreamPushDataSource(ContentDescriptor outputContentDescriptor,
                                                                   int numTracks,
                                                                   java.io.InputStream[] inputStreams,
                                                                   Format[] inputFormats)
Overrides:
createInputStreamPushDataSource in class AbstractStreamCopyMux

getSupportedInputFormats

public Format[] getSupportedInputFormats()
Specified by:
getSupportedInputFormats in interface Multiplexer
Specified by:
getSupportedInputFormats in class AbstractStreamCopyMux

write

protected void write(java.io.InputStream in,
                     java.io.OutputStream out,
                     javax.sound.sampled.AudioFormat javaSoundFormat)
              throws java.io.IOException
Throws:
java.io.IOException