Class OggVorbisParser


  • public class OggVorbisParser
    extends Object
    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.

    • Method Detail

      • getFormatParameters

        public static OggVorbisParser.OggVorbisParameters getFormatParameters​(InputStream inputStream)
                                                                       throws 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.OggVorbisParameters containing the sample rate and channel count.
        Throws:
        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