Package ej.audio.oggvorbis
Class OggVorbisParser
java.lang.Object
ej.audio.oggvorbis.OggVorbisParser
Parses the Ogg container header to extract Vorbis stream parameters.
An Ogg Vorbis stream begins with an Ogg page whose first packet is the Vorbis identification header. This class reads just enough of that header to determine the sample rate and channel count without consuming the stream.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classImmutable holder for Ogg Vorbis stream parameters extracted from the identification header. -
Method Summary
Modifier and TypeMethodDescriptiongetFormatParameters(InputStream inputStream) Extracts audio format parameters from the Ogg Vorbis identification header of the given stream.
-
Method Details
-
getFormatParameters
public static OggVorbisParser.OggVorbisParameters getFormatParameters(InputStream inputStream) throws ej.audio.AudioException, IOException Extracts audio format parameters from the Ogg Vorbis identification header of the given stream.The stream position is restored to its original position after this call, so the same stream can be used for subsequent playback. The stream must support mark/reset.
- Parameters:
inputStream- the Ogg Vorbis input stream; must support mark/reset.- Returns:
- an
OggVorbisParser.OggVorbisParameterscontaining the sample rate and channel count. - Throws:
ej.audio.AudioException- if the stream is not a valid Ogg Vorbis stream or the format is not recognized.IOException- if the stream cannot be read.- Since:
- 3.0.0
-