net.sf.fmj.media.codec
Class JavaSoundCodec
java.lang.Object
net.sf.fmj.media.AbstractControls
net.sf.fmj.media.AbstractPlugIn
net.sf.fmj.media.AbstractCodec
net.sf.fmj.media.codec.JavaSoundCodec
- All Implemented Interfaces:
- Codec, Controls, PlugIn
public class JavaSoundCodec
- extends AbstractCodec
Converts formats that JavaSound can convert.
This has to do some tricks because of the delay in getting data from the converted audio output stream.
The streams are designed as streams, not buffer-based, so all our threading and buffer queue tricks
mean that we don't get an output buffer right away for an input one. The missing output buffers build up.
And then we get EOM, and if the graph processing isn't done right, most of the output buffers never make it to the renderer.
TODO: if this is put ahead of com.ibm.media.codec.audio.PCMToPCM in the registry, there are problems playing the safexmas movie.
TODO: this should perhaps be in the net.sf.fmj.media.codec.audio package.
- Author:
- Ken Larson
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
JavaSoundCodec
public JavaSoundCodec()
getSupportedOutputFormats
public Format[] getSupportedOutputFormats(Format input)
- Specified by:
getSupportedOutputFormats
in interface Codec
- Specified by:
getSupportedOutputFormats
in class AbstractCodec
open
public void open()
throws ResourceUnavailableException
- Specified by:
open
in interface PlugIn
- Overrides:
open
in class AbstractPlugIn
- Throws:
ResourceUnavailableException
process
public int process(Buffer input,
Buffer output)
- Specified by:
process
in interface Codec
- Specified by:
process
in class AbstractCodec
createWavHeader
public static byte[] createWavHeader(javax.sound.sampled.AudioFormat f)
- See http://ccrma.stanford.edu/courses/422/projects/WaveFormat/.
- Parameters:
f
-
- Returns:
- the header for the wav
encodeShortLE
public static void encodeShortLE(short value,
byte[] ba,
int offset)
encodeShortBE
public static void encodeShortBE(short value,
byte[] ba,
int offset)