Class VorbisStream
- All Implemented Interfaces:
Closeable,AutoCloseable,AudioStream,Device.Player,PcmWriter
fileEncoder.-
Nested Class Summary
Nested classes/interfaces inherited from interface net.avadeaux.klipspringer.codec.AudioStream
AudioStream.Factory -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Device.BitLayoutThe bit layout for PCM data sent to a Vorbis stream. -
Constructor Summary
ConstructorsConstructorDescriptionVorbisStream(PcmFormat format, float quality, double writeaheadSecs, double timeoutSecs, int holdingBytes, WritableByteChannel channel, Executor keepAlivePool, double keepAliveTimeoutSecs) Creates an Ogg Vorbis stream with the given specifications and destination channel. -
Method Summary
Modifier and TypeMethodDescriptionstatic PcmWriterfileEncoder(String fileName, PcmFormat dataFormat, float quality) Gets a player that encodes to a file rather than a stream.layout()The bit layout for PCM data sent to a Vorbis stream.quality()gets the VBR quality specified for this stream.static PcmFormatselectFormat(AudioFormat fmt) Selects format suitable for Vorbis streaming with the same semantics asPcmFormat.Selector.selectFormat(AudioFormat).Methods inherited from class net.avadeaux.klipspringer.codec.ExternalEncodedStream
close, drain, format, playedMillis, streaming, writeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.avadeaux.klipspringer.codec.Device.Player
bufferedFrames, canPause, pause, unpause
-
Field Details
-
BIT_LAYOUT
The bit layout for PCM data sent to a Vorbis stream.
-
-
Constructor Details
-
VorbisStream
public VorbisStream(PcmFormat format, float quality, double writeaheadSecs, double timeoutSecs, int holdingBytes, WritableByteChannel channel, Executor keepAlivePool, double keepAliveTimeoutSecs) throws IOException Creates an Ogg Vorbis stream with the given specifications and destination channel.The
holdingBytesparameter is used when streaming to recipient that does not begin to process the input until it has accumulated a certain amount of compressed data, causing the recipient to potentially stall when receiving highly compressible sound (such as silence). In particular, web browsers sometimes do this. When streaming to a web browser, a reasonable value to prevent stalling is 49152. When the destination is a file or something else that does not process audio in real time, it can be set to 0.If
keepAliveExecis non-null, it is used byExternalEncodedStream.close()to execute a wait loop that terminates when either the recipient has sent callback notification of having played (almost) all the data it has been sent, or no callback is made forkeepAliveTimeoutSecsseconds. (See alsoExternalEncodedStream.drain().)- Throws:
IOException
-
-
Method Details
-
selectFormat
Selects format suitable for Vorbis streaming with the same semantics asPcmFormat.Selector.selectFormat(AudioFormat).- Throws:
UnsupportedFormatException
-
layout
The bit layout for PCM data sent to a Vorbis stream. -
quality
gets the VBR quality specified for this stream. -
fileEncoder
public static PcmWriter fileEncoder(String fileName, PcmFormat dataFormat, float quality) throws IOException Gets a player that encodes to a file rather than a stream.- Throws:
IOException
-