Class OggOpusReader

All Implemented Interfaces:
Closeable, AutoCloseable

public class OggOpusReader extends LittleEndianInputStream
Pulls Opus packets out of an Ogg stream. Page boundaries and packet boundaries are unrelated: a packet is a run of segments ending at the first one shorter than 255, and it may cross pages.
  • Constructor Details

  • Method Details

    • markSupported

      public boolean markSupported()
      Rewinding the bytes would leave the page and packet state pointing at the wrong ones.
      Overrides:
      markSupported in class FilterInputStream
    • mark

      public void mark(int limit)
      Overrides:
      mark in class FilterInputStream
    • reset

      public void reset() throws IOException
      Overrides:
      reset in class FilterInputStream
      Throws:
      IOException
    • channelCount

      public int channelCount()
    • preSkip

      public int preSkip()
    • outputGain

      public int outputGain()
    • trackGain

      @Nullable public @Nullable Integer trackGain()
    • loopStart

      @Nullable public @Nullable Integer loopStart()
      Returns:
      the LOOPSTART tag in samples, null when the track is not meant to loop
    • endTrim

      public int endTrim()
      The last page a packet ended on keeps only what its granule position gained over the one before it.
      Returns:
      the padding at the end, in samples, final once the last packet has been read
    • readPacket

      public byte @Nullable [] readPacket() throws IOException
      Returns:
      the next audio packet, or null once the stream is over
      Throws:
      IOException