public class CACodecInputStream extends CANativePeerInputStream
CAFormatConversionProvider
to convert a CAAudioInputStream
(not just
any AudioInputStream
) to another AudioFormat
.
Note that we take a shortcut:
Instead of only relying on the source Java stream, we take advantage of the
CANativePeerInputStream
.
This of course only works, if the stream to convert is also an CAAudioInputStream
.
This needs to be checked in CAFormatConversionProvider
using the CAAudioFormat.PROVIDER
property of the source format.
DEFAULT_BUFFER_SIZE, nativeBuffer, pointer
Constructor and Description |
---|
CACodecInputStream(AudioFormat targetFormat,
CAAudioInputStream stream)
Opens a codec stream with the default buffer size given in
CANativePeerInputStream.DEFAULT_BUFFER_SIZE . |
CACodecInputStream(AudioFormat targetFormat,
CAAudioInputStream stream,
int bufferSize)
Opens a codec stream with the given buffer size.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
protected void |
close(long pointer) |
protected void |
fillNativeBuffer() |
boolean |
isSeekable() |
void |
seek(long time,
TimeUnit timeUnit) |
finalize, isOpen, read, read
available, mark, markSupported, read, reset, skip
public CACodecInputStream(AudioFormat targetFormat, CAAudioInputStream stream) throws IOException, UnsupportedAudioFileException
CANativePeerInputStream.DEFAULT_BUFFER_SIZE
.targetFormat
- target formatstream
- streamIOException
UnsupportedAudioFileException
public CACodecInputStream(AudioFormat targetFormat, CAAudioInputStream stream, int bufferSize) throws IOException, UnsupportedAudioFileException
targetFormat
- target formatstream
- streambufferSize
- buffer size to use when readingIOException
UnsupportedAudioFileException
protected void fillNativeBuffer() throws IOException
fillNativeBuffer
in class CANativePeerInputStream
IOException
public boolean isSeekable()
isSeekable
in class CANativePeerInputStream
CAAudioInputStream.isSeekable()
public void seek(long time, TimeUnit timeUnit) throws UnsupportedOperationException, IOException
seek
in class CANativePeerInputStream
time
- time to seektimeUnit
- unit for the time to seekUnsupportedOperationException
- if not supportedIOException
- if something goes wrongCAAudioInputStream.seek(long, java.util.concurrent.TimeUnit)
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class CANativePeerInputStream
IOException
protected void close(long pointer) throws IOException
close
in class CANativePeerInputStream
IOException
Copyright © 2011–2023 tagtraum industries incorporated. All rights reserved.