Package org.openhab.core.audio.utils
Class AudioSinkUtilsImpl
java.lang.Object
org.openhab.core.audio.utils.AudioSinkUtilsImpl
- All Implemented Interfaces:
AudioSinkUtils
Some utility methods for sink
- Author:
- Gwendal Roulleau - Initial contribution
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@Nullable LongtransferAndAnalyzeLength(InputStream in, OutputStream out, AudioFormat audioFormat, boolean flush) Transfers data from an input stream to an output stream and computes on the fly its durationMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.openhab.core.audio.utils.AudioSinkUtils
transferAndAnalyzeLength
-
Constructor Details
-
AudioSinkUtilsImpl
public AudioSinkUtilsImpl()
-
-
Method Details
-
transferAndAnalyzeLength
public @Nullable Long transferAndAnalyzeLength(InputStream in, OutputStream out, AudioFormat audioFormat, boolean flush) throws IOException Description copied from interface:AudioSinkUtilsTransfers data from an input stream to an output stream and computes on the fly its duration- Specified by:
transferAndAnalyzeLengthin interfaceAudioSinkUtils- Parameters:
in- the input stream giving audio data to playout- the output stream receiving data to playaudioFormat- the audio format of the streamflush- whether to immediately flush each written chunk (useful for low-latency live/piped streams)- Returns:
- the timestamp (from System.nanoTime) when the sound should be fully played. Returns null if computing time fails.
- Throws:
IOException- if reading from the stream or writing to the stream failed
-