Class OpusPackets

java.lang.Object
io.github.kosmx.emotes.common.opus.OpusPackets

public final class OpusPackets extends Object
TOC byte helpers, ported from libopus opus.c.
  • Field Details

  • Method Details

    • samplesPerFrame

      public static int samplesPerFrame(byte toc, int sampleRate)
      opus_packet_get_samples_per_frame
    • stereo

      public static boolean stereo(byte toc)
      Returns:
      whether the TOC byte says the packet carries two channels
    • frameCount

      public static int frameCount(byte[] data, int offset, int length)
      opus_packet_get_nb_frames, or -1 if malformed.
    • sampleCount

      public static int sampleCount(byte[] data, int offset, int length, int sampleRate)
      opus_packet_get_nb_samples, or -1 if malformed.