Class FlacChannelStreamLine
java.lang.Object
net.avadeaux.klipspringer.encoder.PlayerState
net.avadeaux.klipspringer.encoder.ChannelStreamLine
net.avadeaux.klipspringer.encoder.EncoderChannelStreamLine
net.avadeaux.klipspringer.encoder.FlacChannelStreamLine
- All Implemented Interfaces:
AutoCloseable,DataLine,Line,SourceDataLine
Channel stream line for FLAC encoding.
-
Nested Class Summary
Nested classes/interfaces inherited from class net.avadeaux.klipspringer.encoder.EncoderChannelStreamLine
EncoderChannelStreamLine.EncoderFactoryNested classes/interfaces inherited from interface javax.sound.sampled.DataLine
DataLine.Info -
Field Summary
Fields inherited from class net.avadeaux.klipspringer.encoder.EncoderChannelStreamLine
buf -
Constructor Summary
ConstructorsConstructorDescriptionFlacChannelStreamLine(WritableByteChannel bc, AudioFormat format, boolean ogg, int comprLev, long writeAheadMillis, long timeoutMillis, int bufferSamples, int clientbufBytes) Constructs a line for encoding either native FLAC or Ogg FLAC. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidfinish(long handle) protected voidfree(long handle) protected longoutputSamples(long handle) intwrite(byte[] b, int off, int len) protected voidwriteBuffer(long handle, int samples) Methods inherited from class net.avadeaux.klipspringer.encoder.EncoderChannelStreamLine
available, bufferedSamples, close, finish, flush, getBufferSize, outputSamples, writeBufferMethods inherited from class net.avadeaux.klipspringer.encoder.ChannelStreamLine
addLineListener, drain, getControl, getControls, getFormat, getFramePosition, getLevel, getLineInfo, getLongFramePosition, getMicrosecondPosition, isActive, isControlSupported, isRunning, open, open, open, removeLineListener, start, stopMethods inherited from class net.avadeaux.klipspringer.encoder.PlayerState
isOpen, onClose, playedMillis, playedMillis, waitForPlayed
-
Constructor Details
-
FlacChannelStreamLine
public FlacChannelStreamLine(WritableByteChannel bc, AudioFormat format, boolean ogg, int comprLev, long writeAheadMillis, long timeoutMillis, int bufferSamples, int clientbufBytes) throws IOException, UnsupportedAudioFileException Constructs a line for encoding either native FLAC or Ogg FLAC. The clientbufBytes parameter exists because FLAC playing in some web browser stalls if it has less than a certain number of bytes to play, presumably because they wait for a buffer to fill. Recommended value is at least 32000 if the reciever is a web browser, which can corresponds to minutes of audio for highly compressible data (like silence). It can be 0 if receiver is known not to wait for any buffer to fill up.- Parameters:
bc- the channel to stream to, which must be non-blockingformat- audio format of the PCM data written to this lineogg- true for Ogg FLAC, false for native FLACcomprLev- FLAC compression levelwriteAheadMillis- limit for how much to write ahead of what receiver hasplayed; use Long.MAX_VALUE for unlimitedtimeoutMillis- time to wait when when write-ahead limit is reachedbufferSamples- size of line buffer in number of sample framesclientbufBytes- at least the size of any receiver buffer size- Throws:
IOExceptionUnsupportedAudioFileException
-
-
Method Details
-
write
public int write(byte[] b, int off, int len) -
writeBuffer
- Specified by:
writeBufferin classEncoderChannelStreamLine- Throws:
IOException
-
finish
- Specified by:
finishin classEncoderChannelStreamLine- Throws:
IOException
-
free
protected void free(long handle) - Specified by:
freein classEncoderChannelStreamLine
-
outputSamples
protected long outputSamples(long handle) - Specified by:
outputSamplesin classEncoderChannelStreamLine
-