wms-jlayer

16:54:08.265 INFO  jd.cli.Main - Decompiling wms-jlayer.jar
package javazoom.jl.decoder;

import com.wowza.io.IRandomAccessReader;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;

public final class Bitstream
  implements BitstreamErrors
{
  static byte INITIAL_SYNC = 0;
  static byte STRICT_SYNC = 1;
  private static final int BUFFER_INT_SIZE = 433;
  private final int[] framebuffer = new int['?'];
  public int framesize;
  public byte[] frame_bytes = new byte['?'];
  private int wordpointer;
  private int bitindex;
  private int syncword;
  private int header_pos = 0;
  private int tail_size = 0;
  private boolean single_ch_mode;
  private final int[] bitmask = { 0, 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, 65535, 131071 };
  private final IRandomAccessReader source;
  private final Header header = new Header();
  private final byte[] syncbuf = new byte[4];
  private Crc16[] crc = new Crc16[1];
  private byte[] rawid3v2 = null;
  private boolean firstframe = true;
  
  public Bitstream(IRandomAccessReader paramIRandomAccessReader)
  {
    if (paramIRandomAccessReader == null) {
      throw new NullPointerException("in");
    }
    loadID3v2(paramIRandomAccessReader);
    firstframe = true;
    
    source = paramIRandomAccessReader;
    
    closeFrame();
  }
  
  public void rewind()
  {
    source.seek(0L);
    loadID3v2(source);
    firstframe = true;
    closeFrame();
  }
  
  public int header_pos()
  {
    return header_pos;
  }
  
  public int tail_size()
  {
    return tail_size;
  }
  
  private void loadID3v2(IRandomAccessReader paramIRandomAccessReader)
  {
    int i = -1;
    long l = 0L;
    try
    {
      tail_size = 0;
      if (paramIRandomAccessReader.length() > 128L)
      {
        paramIRandomAccessReader.seek(paramIRandomAccessReader.length() - 128L);
        byte[] arrayOfByte = new byte[3];
        paramIRandomAccessReader.read(arrayOfByte, 0, 3);
        if ((arrayOfByte[0] == 84) && (arrayOfByte[1] == 65) && (arrayOfByte[2] == 71)) {
          tail_size = 128;
        }
      }
    }
    catch (Exception localException1) {}
    try
    {
      paramIRandomAccessReader.seek(0L);
      l = paramIRandomAccessReader.getFilePointer();
      i = readID3v2Header(paramIRandomAccessReader);
      header_pos = i;
      try
      {
        paramIRandomAccessReader.seek(l);
      }
      catch (Exception localException2) {}
      try
      {
        if (i > 0)
        {
          rawid3v2 = new byte[i];
          paramIRandomAccessReader.read(rawid3v2, 0, rawid3v2.length);
        }
      }
      catch (Exception localException4) {}
    }
    catch (IOException localIOException) {}finally
    {
      try
      {
        paramIRandomAccessReader.seek(l);
      }
      catch (Exception localException5) {}
    }
  }
  
  private int readID3v2Header(IRandomAccessReader paramIRandomAccessReader)
    throws IOException
  {
    byte[] arrayOfByte = new byte[4];
    int i = -10;
    paramIRandomAccessReader.read(arrayOfByte, 0, 3);
    if ((arrayOfByte[0] == 73) && (arrayOfByte[1] == 68) && (arrayOfByte[2] == 51))
    {
      paramIRandomAccessReader.read(arrayOfByte, 0, 3);
      int j = arrayOfByte[0];
      int k = arrayOfByte[1];
      paramIRandomAccessReader.read(arrayOfByte, 0, 4);
      i = (arrayOfByte[0] << 21) + (arrayOfByte[1] << 14) + (arrayOfByte[2] << 7) + arrayOfByte[3];
    }
    return i + 10;
  }
  
  public InputStream getRawID3v2()
  {
    if (rawid3v2 == null) {
      return null;
    }
    ByteArrayInputStream localByteArrayInputStream = new ByteArrayInputStream(rawid3v2);
    return localByteArrayInputStream;
  }
  
  public ByteBuffer getRawID3v2ByteBuffer()
  {
    if (rawid3v2 == null) {
      return null;
    }
    return ByteBuffer.wrap(rawid3v2);
  }
  
  public void close()
    throws BitstreamException
  {
    try
    {
      source.close();
    }
    catch (IOException localIOException)
    {
      throw newBitstreamException(258, localIOException);
    }
  }
  
  public Header readFrame()
    throws BitstreamException
  {
    Header localHeader = null;
    try
    {
      localHeader = readNextFrame();
      if (firstframe == true)
      {
        localHeader.parseVBR(frame_bytes);
        firstframe = false;
      }
    }
    catch (BitstreamException localBitstreamException1)
    {
      if (localBitstreamException1.getErrorCode() == 261) {
        try
        {
          closeFrame();
          localHeader = readNextFrame();
        }
        catch (BitstreamException localBitstreamException2)
        {
          if (localBitstreamException2.getErrorCode() != 260) {
            throw newBitstreamException(localBitstreamException2.getErrorCode(), localBitstreamException2);
          }
        }
      } else if (localBitstreamException1.getErrorCode() != 260) {
        throw newBitstreamException(localBitstreamException1.getErrorCode(), localBitstreamException1);
      }
    }
    return localHeader;
  }
  
  private Header readNextFrame()
    throws BitstreamException
  {
    if (framesize == -1) {
      nextFrame();
    }
    return header;
  }
  
  private void nextFrame()
    throws BitstreamException
  {
    header.read_header(this, crc);
  }
  
  public void unreadFrame()
    throws BitstreamException
  {
    if ((wordpointer == -1) && (bitindex == -1) && (framesize > 0)) {
      try
      {
        source.seek(source.getFilePointer() - framesize);
      }
      catch (Exception localException)
      {
        throw newBitstreamException(258);
      }
    }
  }
  
  public void closeFrame()
  {
    framesize = -1;
    wordpointer = -1;
    bitindex = -1;
  }
  
  public boolean isSyncCurrentPosition(int paramInt)
    throws BitstreamException
  {
    int i = readBytes(syncbuf, 0, 4);
    int j = syncbuf[0] << 24 & 0xFF000000 | syncbuf[1] << 16 & 0xFF0000 | syncbuf[2] << 8 & 0xFF00 | syncbuf[3] << 0 & 0xFF;
    try
    {
      source.seek(source.getFilePointer() - i);
    }
    catch (Exception localException) {}
    boolean bool = false;
    switch (i)
    {
    case 0: 
      bool = true;
      break;
    case 4: 
      bool = isSyncMark(j, paramInt, syncword);
    }
    return bool;
  }
  
  public int readBits(int paramInt)
  {
    return get_bits(paramInt);
  }
  
  public int readCheckedBits(int paramInt)
  {
    return get_bits(paramInt);
  }
  
  protected BitstreamException newBitstreamException(int paramInt)
  {
    return new BitstreamException(paramInt, null);
  }
  
  protected BitstreamException newBitstreamException(int paramInt, Throwable paramThrowable)
  {
    return new BitstreamException(paramInt, paramThrowable);
  }
  
  int syncHeader(byte paramByte)
    throws BitstreamException
  {
    int j = readBytes(syncbuf, 0, 3);
    if (j != 3) {
      throw newBitstreamException(260, null);
    }
    int i = syncbuf[0] << 16 & 0xFF0000 | syncbuf[1] << 8 & 0xFF00 | syncbuf[2] << 0 & 0xFF;
    boolean bool;
    do
    {
      i <<= 8;
      if (readBytes(syncbuf, 3, 1) != 1) {
        throw newBitstreamException(260, null);
      }
      i |= syncbuf[3] & 0xFF;
      
      bool = isSyncMark(i, paramByte, syncword);
    } while (!bool);
    return i;
  }
  
  public boolean isSyncMark(int paramInt1, int paramInt2, int paramInt3)
  {
    boolean bool = false;
    if (paramInt2 == INITIAL_SYNC)
    {
      bool = (paramInt1 & 0xFFE00000) == -2097152;
    }
    else
    {
      if ((paramInt1 & 0xFFF80C00) == paramInt3) {}
      bool = ((paramInt1 & 0xC0) == 192) == single_ch_mode;
    }
    if (bool) {
      bool = (paramInt1 >>> 10 & 0x3) != 3;
    }
    if (bool) {
      bool = (paramInt1 >>> 17 & 0x3) != 0;
    }
    if (bool) {
      bool = (paramInt1 >>> 19 & 0x3) != 1;
    }
    return bool;
  }
  
  int read_frame_data(int paramInt)
    throws BitstreamException
  {
    int i = 0;
    i = readFully(frame_bytes, 0, paramInt);
    framesize = paramInt;
    wordpointer = -1;
    bitindex = -1;
    return i;
  }
  
  void parse_frame()
    throws BitstreamException
  {
    int i = 0;
    byte[] arrayOfByte = frame_bytes;
    int j = framesize;
    for (int k = 0; k < j; k += 4)
    {
      int m = 0;
      int n = 0;
      int i1 = 0;
      int i2 = 0;
      int i3 = 0;
      n = arrayOfByte[k];
      if (k + 1 < j) {
        i1 = arrayOfByte[(k + 1)];
      }
      if (k + 2 < j) {
        i2 = arrayOfByte[(k + 2)];
      }
      if (k + 3 < j) {
        i3 = arrayOfByte[(k + 3)];
      }
      framebuffer[(i++)] = (n << 24 & 0xFF000000 | i1 << 16 & 0xFF0000 | i2 << 8 & 0xFF00 | i3 & 0xFF);
    }
    wordpointer = 0;
    bitindex = 0;
  }
  
  public int get_bits(int paramInt)
  {
    int i = 0;
    int j = bitindex + paramInt;
    if (wordpointer < 0) {
      wordpointer = 0;
    }
    if (j <= 32)
    {
      i = framebuffer[wordpointer] >>> 32 - j & bitmask[paramInt];
      if (bitindex += paramInt == 32)
      {
        bitindex = 0;
        wordpointer += 1;
      }
      return i;
    }
    int k = framebuffer[wordpointer] & 0xFFFF;
    wordpointer += 1;
    int m = framebuffer[wordpointer] & 0xFFFF0000;
    i = k << 16 & 0xFFFF0000 | m >>> 16 & 0xFFFF;
    
    i >>>= 48 - j;
    i &= bitmask[paramInt];
    bitindex = (j - 32);
    return i;
  }
  
  void set_syncword(int paramInt)
  {
    syncword = (paramInt & 0xFF3F);
    single_ch_mode = ((paramInt & 0xC0) == 192);
  }
  
  private int readFully(byte[] paramArrayOfByte, int paramInt1, int paramInt2)
    throws BitstreamException
  {
    int i = 0;
    try
    {
      while (paramInt2 > 0)
      {
        int j = source.read(paramArrayOfByte, paramInt1, paramInt2);
        if (j <= 0) {
          while (paramInt2-- > 0) {
            paramArrayOfByte[(paramInt1++)] = 0;
          }
        }
        i += j;
        paramInt1 += j;
        paramInt2 -= j;
      }
    }
    catch (Exception localException)
    {
      throw newBitstreamException(258, localException);
    }
    return i;
  }
  
  private int readBytes(byte[] paramArrayOfByte, int paramInt1, int paramInt2)
    throws BitstreamException
  {
    int i = 0;
    try
    {
      while (paramInt2 > 0)
      {
        int j = source.read(paramArrayOfByte, paramInt1, paramInt2);
        if (j <= 0) {
          break;
        }
        i += j;
        paramInt1 += j;
        paramInt2 -= j;
      }
    }
    catch (Exception localException)
    {
      throw newBitstreamException(258, localException);
    }
    return i;
  }
}

/* Location:
 * Qualified Name:     javazoom.jl.decoder.Bitstream
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package javazoom.jl.decoder;

public abstract interface BitstreamErrors
  extends JavaLayerErrors
{
  public static final int UNKNOWN_ERROR = 256;
  public static final int UNKNOWN_SAMPLE_RATE = 257;
  public static final int STREAM_ERROR = 258;
  public static final int UNEXPECTED_EOF = 259;
  public static final int STREAM_EOF = 260;
  public static final int INVALIDFRAME = 261;
  public static final int BITSTREAM_LAST = 511;
}

/* Location:
 * Qualified Name:     javazoom.jl.decoder.BitstreamErrors
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package javazoom.jl.decoder;

public class BitstreamException
  extends JavaLayerException
  implements BitstreamErrors
{
  private int errorcode = 256;
  
  public BitstreamException(String paramString, Throwable paramThrowable)
  {
    super(paramString, paramThrowable);
  }
  
  public BitstreamException(int paramInt, Throwable paramThrowable)
  {
    this(getErrorString(paramInt), paramThrowable);
  }
  
  public int getErrorCode()
  {
    return errorcode;
  }
  
  public static String getErrorString(int paramInt)
  {
    return "Bitstream errorcode " + Integer.toHexString(paramInt);
  }
}

/* Location:
 * Qualified Name:     javazoom.jl.decoder.BitstreamException
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package javazoom.jl.decoder;

public final class Crc16
{
  private static short polynomial = 32773;
  private short crc;
  
  public Crc16()
  {
    crc = -1;
  }
  
  public void add_bits(int paramInt1, int paramInt2)
  {
    int i = 1 << paramInt2 - 1;
    do
    {
      if ((((crc & 0x8000) == 0 ? 1 : 0) ^ ((paramInt1 & i) == 0 ? 1 : 0)) != 0)
      {
        crc = ((short)(crc << 1));
        crc = ((short)(crc ^ polynomial));
      }
      else
      {
        crc = ((short)(crc << 1));
      }
    } while (i >>>= 1 != 0);
  }
  
  public short checksum()
  {
    short s = crc;
    crc = -1;
    return s;
  }
}

/* Location:
 * Qualified Name:     javazoom.jl.decoder.Crc16
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package javazoom.jl.decoder;

public final class Header
{
  public static final int[][] frequencies = { { 22050, 24000, 16000, 1 }, { 44100, 48000, 32000, 1 }, { 11025, 12000, 8000, 1 } };
  public static final int MPEG2_LSF = 0;
  public static final int MPEG25_LSF = 2;
  public static final int MPEG1 = 1;
  public static final int STEREO = 0;
  public static final int JOINT_STEREO = 1;
  public static final int DUAL_CHANNEL = 2;
  public static final int SINGLE_CHANNEL = 3;
  public static final int FOURTYFOUR_POINT_ONE = 0;
  public static final int FOURTYEIGHT = 1;
  public static final int THIRTYTWO = 2;
  public int h_padding_bit;
  private int h_layer;
  private int h_protection_bit;
  private int h_bitrate_index;
  private int h_mode_extension;
  private int h_version;
  private int h_mode;
  private int h_sample_frequency;
  private int h_number_of_subbands;
  private int h_intensity_stereo_bound;
  private boolean h_copyright;
  private boolean h_original;
  private double[] h_vbr_time_per_frame = { -1.0D, 384.0D, 1152.0D, 1152.0D };
  private int[] h_vbr_samples_per_frame = { -1, 384, 1152, 1152 };
  private boolean h_vbr;
  private int h_vbr_frames;
  private int h_vbr_scale;
  private int h_vbr_bytes;
  private byte[] h_vbr_toc;
  private byte syncmode = Bitstream.INITIAL_SYNC;
  private Crc16 crc;
  public short checksum;
  public int framesize;
  public int nSlots;
  private int _headerstring = -1;
  
  public String toString()
  {
    StringBuffer localStringBuffer = new StringBuffer(200);
    localStringBuffer.append("Layer ");
    localStringBuffer.append(layer_string());
    localStringBuffer.append(" frame ");
    localStringBuffer.append(mode_string());
    localStringBuffer.append(' ');
    localStringBuffer.append(version_string());
    if (!checksums()) {
      localStringBuffer.append(" no");
    }
    localStringBuffer.append(" checksums");
    localStringBuffer.append(' ');
    localStringBuffer.append(sample_frequency_string());
    localStringBuffer.append(',');
    localStringBuffer.append(' ');
    localStringBuffer.append(bitrate_string());
    
    String str = localStringBuffer.toString();
    return str;
  }
  
  void read_header(Bitstream paramBitstream, Crc16[] paramArrayOfCrc16)
    throws BitstreamException
  {
    int k = 0;
    int i;
    do
    {
      i = paramBitstream.syncHeader(syncmode);
      _headerstring = i;
      if (syncmode == Bitstream.INITIAL_SYNC)
      {
        h_version = (i >>> 19 & 0x1);
        if ((i >>> 20 & 0x1) == 0) {
          if (h_version == 0) {
            h_version = 2;
          } else {
            throw paramBitstream.newBitstreamException(256);
          }
        }
        if ((h_sample_frequency = i >>> 10 & 0x3) == 3) {
          throw paramBitstream.newBitstreamException(256);
        }
      }
      h_layer = (4 - (i >>> 17) & 0x3);
      h_protection_bit = (i >>> 16 & 0x1);
      h_bitrate_index = (i >>> 12 & 0xF);
      h_padding_bit = (i >>> 9 & 0x1);
      h_mode = (i >>> 6 & 0x3);
      h_mode_extension = (i >>> 4 & 0x3);
      if (h_mode == 1) {
        h_intensity_stereo_bound = ((h_mode_extension << 2) + 4);
      } else {
        h_intensity_stereo_bound = 0;
      }
      if ((i >>> 3 & 0x1) == 1) {
        h_copyright = true;
      }
      if ((i >>> 2 & 0x1) == 1) {
        h_original = true;
      }
      if (h_layer == 1)
      {
        h_number_of_subbands = 32;
      }
      else
      {
        int j = h_bitrate_index;
        if (h_mode != 3) {
          if (j == 4) {
            j = 1;
          } else {
            j -= 4;
          }
        }
        if ((j == 1) || (j == 2))
        {
          if (h_sample_frequency == 2) {
            h_number_of_subbands = 12;
          } else {
            h_number_of_subbands = 8;
          }
        }
        else if ((h_sample_frequency == 1) || ((j >= 3) && (j <= 5))) {
          h_number_of_subbands = 27;
        } else {
          h_number_of_subbands = 30;
        }
      }
      if (h_intensity_stereo_bound > h_number_of_subbands) {
        h_intensity_stereo_bound = h_number_of_subbands;
      }
      calculate_framesize();
      
      int m = paramBitstream.read_frame_data(framesize);
      if ((framesize >= 0) && (m != framesize)) {
        throw paramBitstream.newBitstreamException(261);
      }
      if (paramBitstream.isSyncCurrentPosition(syncmode))
      {
        if (syncmode == Bitstream.INITIAL_SYNC)
        {
          syncmode = Bitstream.STRICT_SYNC;
          paramBitstream.set_syncword(i & 0xFFF80CC0);
        }
        k = 1;
      }
      else
      {
        paramBitstream.unreadFrame();
      }
    } while (k == 0);
    paramBitstream.parse_frame();
    if (h_protection_bit == 0)
    {
      checksum = ((short)paramBitstream.get_bits(16));
      if (crc == null) {
        crc = new Crc16();
      }
      crc.add_bits(i, 16);
      paramArrayOfCrc16[0] = crc;
    }
    else
    {
      paramArrayOfCrc16[0] = null;
    }
    if (h_sample_frequency == 0) {}
  }
  
  void parseVBR(byte[] paramArrayOfByte)
    throws BitstreamException
  {
    String str1 = "Xing";
    byte[] arrayOfByte1 = new byte[4];
    int i = 0;
    if (h_version == 1)
    {
      if (h_mode == 3) {
        i = 17;
      } else {
        i = 32;
      }
    }
    else if (h_mode == 3) {
      i = 9;
    } else {
      i = 17;
    }
    try
    {
      System.arraycopy(paramArrayOfByte, i, arrayOfByte1, 0, 4);
      if (str1.equals(new String(arrayOfByte1)))
      {
        h_vbr = true;
        h_vbr_frames = -1;
        h_vbr_bytes = -1;
        h_vbr_scale = -1;
        h_vbr_toc = new byte[100];
        
        int j = 4;
        
        byte[] arrayOfByte2 = new byte[4];
        System.arraycopy(paramArrayOfByte, i + j, arrayOfByte2, 0, arrayOfByte2.length);
        j += arrayOfByte2.length;
        if ((arrayOfByte2[3] & 0x1) != 0)
        {
          System.arraycopy(paramArrayOfByte, i + j, arrayOfByte1, 0, arrayOfByte1.length);
          h_vbr_frames = (arrayOfByte1[0] << 24 & 0xFF000000 | arrayOfByte1[1] << 16 & 0xFF0000 | arrayOfByte1[2] << 8 & 0xFF00 | arrayOfByte1[3] & 0xFF);
          j += 4;
        }
        if ((arrayOfByte2[3] & 0x2) != 0)
        {
          System.arraycopy(paramArrayOfByte, i + j, arrayOfByte1, 0, arrayOfByte1.length);
          h_vbr_bytes = (arrayOfByte1[0] << 24 & 0xFF000000 | arrayOfByte1[1] << 16 & 0xFF0000 | arrayOfByte1[2] << 8 & 0xFF00 | arrayOfByte1[3] & 0xFF);
          j += 4;
        }
        if ((arrayOfByte2[3] & 0x4) != 0)
        {
          System.arraycopy(paramArrayOfByte, i + j, h_vbr_toc, 0, h_vbr_toc.length);
          j += h_vbr_toc.length;
        }
        if ((arrayOfByte2[3] & 0x8) != 0)
        {
          System.arraycopy(paramArrayOfByte, i + j, arrayOfByte1, 0, arrayOfByte1.length);
          h_vbr_scale = (arrayOfByte1[0] << 24 & 0xFF000000 | arrayOfByte1[1] << 16 & 0xFF0000 | arrayOfByte1[2] << 8 & 0xFF00 | arrayOfByte1[3] & 0xFF);
          j += 4;
        }
      }
    }
    catch (ArrayIndexOutOfBoundsException localArrayIndexOutOfBoundsException1)
    {
      throw new BitstreamException("XingVBRHeader Corrupted", localArrayIndexOutOfBoundsException1);
    }
    String str2 = "VBRI";
    i = 32;
    try
    {
      System.arraycopy(paramArrayOfByte, i, arrayOfByte1, 0, 4);
      if (str2.equals(new String(arrayOfByte1)))
      {
        h_vbr = true;
        h_vbr_frames = -1;
        h_vbr_bytes = -1;
        h_vbr_scale = -1;
        h_vbr_toc = new byte[100];
        
        int k = 10;
        System.arraycopy(paramArrayOfByte, i + k, arrayOfByte1, 0, arrayOfByte1.length);
        h_vbr_bytes = (arrayOfByte1[0] << 24 & 0xFF000000 | arrayOfByte1[1] << 16 & 0xFF0000 | arrayOfByte1[2] << 8 & 0xFF00 | arrayOfByte1[3] & 0xFF);
        k += 4;
        
        System.arraycopy(paramArrayOfByte, i + k, arrayOfByte1, 0, arrayOfByte1.length);
        h_vbr_frames = (arrayOfByte1[0] << 24 & 0xFF000000 | arrayOfByte1[1] << 16 & 0xFF0000 | arrayOfByte1[2] << 8 & 0xFF00 | arrayOfByte1[3] & 0xFF);
        k += 4;
      }
    }
    catch (ArrayIndexOutOfBoundsException localArrayIndexOutOfBoundsException2)
    {
      throw new BitstreamException("VBRIVBRHeader Corrupted", localArrayIndexOutOfBoundsException2);
    }
  }
  
  public int version()
  {
    return h_version;
  }
  
  public int layer()
  {
    return h_layer;
  }
  
  public int bitrate_index()
  {
    return h_bitrate_index;
  }
  
  public int sample_frequency()
  {
    return h_sample_frequency;
  }
  
  public int frequency()
  {
    return frequencies[h_version][h_sample_frequency];
  }
  
  public int mode()
  {
    return h_mode;
  }
  
  public boolean checksums()
  {
    if (h_protection_bit == 0) {
      return true;
    }
    return false;
  }
  
  public boolean copyright()
  {
    return h_copyright;
  }
  
  public boolean original()
  {
    return h_original;
  }
  
  public boolean vbr()
  {
    return h_vbr;
  }
  
  public int vbr_scale()
  {
    return h_vbr_scale;
  }
  
  public byte[] vbr_toc()
  {
    return h_vbr_toc;
  }
  
  public boolean checksum_ok()
  {
    return checksum == crc.checksum();
  }
  
  public boolean padding()
  {
    if (h_padding_bit == 0) {
      return false;
    }
    return true;
  }
  
  public int slots()
  {
    return nSlots;
  }
  
  public int mode_extension()
  {
    return h_mode_extension;
  }
  
  public static final int[][][] bitrates = { { { 0, 32000, 48000, 56000, 64000, 80000, 96000, 112000, 128000, 144000, 160000, 176000, 192000, 224000, 256000, 0 }, { 0, 8000, 16000, 24000, 32000, 40000, 48000, 56000, 64000, 80000, 96000, 112000, 128000, 144000, 160000, 0 }, { 0, 8000, 16000, 24000, 32000, 40000, 48000, 56000, 64000, 80000, 96000, 112000, 128000, 144000, 160000, 0 } }, { { 0, 32000, 64000, 96000, 128000, 160000, 192000, 224000, 256000, 288000, 320000, 352000, 384000, 416000, 448000, 0 }, { 0, 32000, 48000, 56000, 64000, 80000, 96000, 112000, 128000, 160000, 192000, 224000, 256000, 320000, 384000, 0 }, { 0, 32000, 40000, 48000, 56000, 64000, 80000, 96000, 112000, 128000, 160000, 192000, 224000, 256000, 320000, 0 } }, { { 0, 32000, 48000, 56000, 64000, 80000, 96000, 112000, 128000, 144000, 160000, 176000, 192000, 224000, 256000, 0 }, { 0, 8000, 16000, 24000, 32000, 40000, 48000, 56000, 64000, 80000, 96000, 112000, 128000, 144000, 160000, 0 }, { 0, 8000, 16000, 24000, 32000, 40000, 48000, 56000, 64000, 80000, 96000, 112000, 128000, 144000, 160000, 0 } } };
  
  public int calculate_framesize()
  {
    if (h_layer == 1)
    {
      framesize = (12 * bitrates[h_version][0][h_bitrate_index] / frequencies[h_version][h_sample_frequency]);
      if (h_padding_bit != 0) {
        framesize += 1;
      }
      framesize <<= 2;
      nSlots = 0;
    }
    else
    {
      framesize = (144 * bitrates[h_version][(h_layer - 1)][h_bitrate_index] / frequencies[h_version][h_sample_frequency]);
      if ((h_version == 0) || (h_version == 2)) {
        framesize >>= 1;
      }
      if (h_padding_bit != 0) {
        framesize += 1;
      }
      if (h_layer == 3)
      {
        if (h_version == 1) {
          nSlots = (framesize - (h_mode == 3 ? 17 : 32) - (h_protection_bit != 0 ? 0 : 2) - 4);
        } else {
          nSlots = (framesize - (h_mode == 3 ? 9 : 17) - (h_protection_bit != 0 ? 0 : 2) - 4);
        }
      }
      else {
        nSlots = 0;
      }
    }
    framesize -= 4;
    return framesize;
  }
  
  public int max_number_of_frames(int paramInt)
  {
    if (h_vbr == true) {
      return h_vbr_frames;
    }
    if (framesize + 4 - h_padding_bit == 0) {
      return 0;
    }
    return paramInt / (framesize + 4 - h_padding_bit);
  }
  
  public int min_number_of_frames(int paramInt)
  {
    if (h_vbr == true) {
      return h_vbr_frames;
    }
    if (framesize + 5 - h_padding_bit == 0) {
      return 0;
    }
    return paramInt / (framesize + 5 - h_padding_bit);
  }
  
  public float ms_per_frame()
  {
    if (h_vbr == true)
    {
      double d = h_vbr_time_per_frame[layer()] / frequency();
      if ((h_version == 0) || (h_version == 2)) {
        d /= 2.0D;
      }
      return (float)(d * 1000.0D);
    }
    float[][] arrayOfFloat = { { 8.707483F, 8.0F, 12.0F }, { 26.12245F, 24.0F, 36.0F }, { 26.12245F, 24.0F, 36.0F } };
    
    return arrayOfFloat[(h_layer - 1)][h_sample_frequency];
  }
  
  public int samples_per_frame()
  {
    int i = 0;
    if (h_vbr == true)
    {
      i = h_vbr_samples_per_frame[layer()];
      if ((h_version == 0) || (h_version == 2)) {
        i /= 2;
      }
    }
    else
    {
      int[][] arrayOfInt = { { 384, 1152, 576 }, { 384, 1152, 1152 }, { 384, 1152, 576 } };
      
      i = arrayOfInt[h_version][(h_layer - 1)];
    }
    return i;
  }
  
  public float total_ms(int paramInt)
  {
    return max_number_of_frames(paramInt) * ms_per_frame();
  }
  
  public int getSyncHeader()
  {
    return _headerstring;
  }
  
  public void getSyncHeader(byte[] paramArrayOfByte)
  {
    paramArrayOfByte[3] = ((byte)(0xFF & _headerstring));
    paramArrayOfByte[2] = ((byte)(0xFF & _headerstring >> 8));
    paramArrayOfByte[1] = ((byte)(0xFF & _headerstring >> 16));
    paramArrayOfByte[0] = ((byte)(0xFF & _headerstring >> 24));
  }
  
  public String layer_string()
  {
    switch (h_layer)
    {
    case 1: 
      return "I";
    case 2: 
      return "II";
    case 3: 
      return "III";
    }
    return null;
  }
  
  public static final String[][][] bitrate_str = { { { "free format", "32 kbit/s", "48 kbit/s", "56 kbit/s", "64 kbit/s", "80 kbit/s", "96 kbit/s", "112 kbit/s", "128 kbit/s", "144 kbit/s", "160 kbit/s", "176 kbit/s", "192 kbit/s", "224 kbit/s", "256 kbit/s", "forbidden" }, { "free format", "8 kbit/s", "16 kbit/s", "24 kbit/s", "32 kbit/s", "40 kbit/s", "48 kbit/s", "56 kbit/s", "64 kbit/s", "80 kbit/s", "96 kbit/s", "112 kbit/s", "128 kbit/s", "144 kbit/s", "160 kbit/s", "forbidden" }, { "free format", "8 kbit/s", "16 kbit/s", "24 kbit/s", "32 kbit/s", "40 kbit/s", "48 kbit/s", "56 kbit/s", "64 kbit/s", "80 kbit/s", "96 kbit/s", "112 kbit/s", "128 kbit/s", "144 kbit/s", "160 kbit/s", "forbidden" } }, { { "free format", "32 kbit/s", "64 kbit/s", "96 kbit/s", "128 kbit/s", "160 kbit/s", "192 kbit/s", "224 kbit/s", "256 kbit/s", "288 kbit/s", "320 kbit/s", "352 kbit/s", "384 kbit/s", "416 kbit/s", "448 kbit/s", "forbidden" }, { "free format", "32 kbit/s", "48 kbit/s", "56 kbit/s", "64 kbit/s", "80 kbit/s", "96 kbit/s", "112 kbit/s", "128 kbit/s", "160 kbit/s", "192 kbit/s", "224 kbit/s", "256 kbit/s", "320 kbit/s", "384 kbit/s", "forbidden" }, { "free format", "32 kbit/s", "40 kbit/s", "48 kbit/s", "56 kbit/s", "64 kbit/s", "80 kbit/s", "96 kbit/s", "112 kbit/s", "128 kbit/s", "160 kbit/s", "192 kbit/s", "224 kbit/s", "256 kbit/s", "320 kbit/s", "forbidden" } }, { { "free format", "32 kbit/s", "48 kbit/s", "56 kbit/s", "64 kbit/s", "80 kbit/s", "96 kbit/s", "112 kbit/s", "128 kbit/s", "144 kbit/s", "160 kbit/s", "176 kbit/s", "192 kbit/s", "224 kbit/s", "256 kbit/s", "forbidden" }, { "free format", "8 kbit/s", "16 kbit/s", "24 kbit/s", "32 kbit/s", "40 kbit/s", "48 kbit/s", "56 kbit/s", "64 kbit/s", "80 kbit/s", "96 kbit/s", "112 kbit/s", "128 kbit/s", "144 kbit/s", "160 kbit/s", "forbidden" }, { "free format", "8 kbit/s", "16 kbit/s", "24 kbit/s", "32 kbit/s", "40 kbit/s", "48 kbit/s", "56 kbit/s", "64 kbit/s", "80 kbit/s", "96 kbit/s", "112 kbit/s", "128 kbit/s", "144 kbit/s", "160 kbit/s", "forbidden" } } };
  
  public String bitrate_string()
  {
    if (h_vbr == true) {
      return Integer.toString(bitrate() / 1000) + " kb/s";
    }
    return bitrate_str[h_version][(h_layer - 1)][h_bitrate_index];
  }
  
  public int bitrate()
  {
    if (h_vbr == true) {
      return (int)(h_vbr_bytes * 8 / (ms_per_frame() * h_vbr_frames)) * 1000;
    }
    return bitrates[h_version][(h_layer - 1)][h_bitrate_index];
  }
  
  public int bitrate_instant()
  {
    return bitrates[h_version][(h_layer - 1)][h_bitrate_index];
  }
  
  public String sample_frequency_string()
  {
    switch (h_sample_frequency)
    {
    case 2: 
      if (h_version == 1) {
        return "32 kHz";
      }
      if (h_version == 0) {
        return "16 kHz";
      }
      return "8 kHz";
    case 0: 
      if (h_version == 1) {
        return "44.1 kHz";
      }
      if (h_version == 0) {
        return "22.05 kHz";
      }
      return "11.025 kHz";
    case 1: 
      if (h_version == 1) {
        return "48 kHz";
      }
      if (h_version == 0) {
        return "24 kHz";
      }
      return "12 kHz";
    }
    return null;
  }
  
  public String mode_string()
  {
    switch (h_mode)
    {
    case 0: 
      return "Stereo";
    case 1: 
      return "Joint stereo";
    case 2: 
      return "Dual channel";
    case 3: 
      return "Single channel";
    }
    return null;
  }
  
  public String version_string()
  {
    switch (h_version)
    {
    case 1: 
      return "MPEG-1";
    case 0: 
      return "MPEG-2 LSF";
    case 2: 
      return "MPEG-2.5 LSF";
    }
    return null;
  }
  
  public int number_of_subbands()
  {
    return h_number_of_subbands;
  }
  
  public int intensity_stereo_bound()
  {
    return h_intensity_stereo_bound;
  }
}

/* Location:
 * Qualified Name:     javazoom.jl.decoder.Header
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package javazoom.jl.decoder;

public class JavaLayerError
  extends Error
{}

/* Location:
 * Qualified Name:     javazoom.jl.decoder.JavaLayerError
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package javazoom.jl.decoder;

public abstract interface JavaLayerErrors
{
  public static final int BITSTREAM_ERROR = 256;
  public static final int DECODER_ERROR = 512;
}

/* Location:
 * Qualified Name:     javazoom.jl.decoder.JavaLayerErrors
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package javazoom.jl.decoder;

import java.io.PrintStream;

public class JavaLayerException
  extends Exception
{
  private Throwable exception;
  
  public JavaLayerException() {}
  
  public JavaLayerException(String paramString)
  {
    super(paramString);
  }
  
  public JavaLayerException(String paramString, Throwable paramThrowable)
  {
    super(paramString);
    exception = paramThrowable;
  }
  
  public Throwable getException()
  {
    return exception;
  }
  
  public void printStackTrace()
  {
    printStackTrace(System.err);
  }
  
  public void printStackTrace(PrintStream paramPrintStream)
  {
    if (exception == null) {
      super.printStackTrace(paramPrintStream);
    } else {
      exception.printStackTrace();
    }
  }
}

/* Location:
 * Qualified Name:     javazoom.jl.decoder.JavaLayerException
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package javazoom.jl.decoder;

import java.io.InputStream;

public abstract interface JavaLayerHook
{
  public abstract InputStream getResourceAsStream(String paramString);
}

/* Location:
 * Qualified Name:     javazoom.jl.decoder.JavaLayerHook
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package javazoom.jl.decoder;

import java.io.IOException;
import java.io.InputStream;
import java.io.InvalidClassException;
import java.io.InvalidObjectException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.lang.reflect.Array;

public class JavaLayerUtils
{
  private static JavaLayerHook hook = null;
  
  public static Object deserialize(InputStream paramInputStream, Class paramClass)
    throws IOException
  {
    if (paramClass == null) {
      throw new NullPointerException("cls");
    }
    Object localObject = deserialize(paramInputStream);
    if (!paramClass.isInstance(localObject)) {
      throw new InvalidObjectException("type of deserialized instance not of required class.");
    }
    return localObject;
  }
  
  public static Object deserialize(InputStream paramInputStream)
    throws IOException
  {
    if (paramInputStream == null) {
      throw new NullPointerException("in");
    }
    ObjectInputStream localObjectInputStream = new ObjectInputStream(paramInputStream);
    Object localObject;
    try
    {
      localObject = localObjectInputStream.readObject();
    }
    catch (ClassNotFoundException localClassNotFoundException)
    {
      throw new InvalidClassException(localClassNotFoundException.toString());
    }
    return localObject;
  }
  
  public static Object deserializeArray(InputStream paramInputStream, Class paramClass, int paramInt)
    throws IOException
  {
    if (paramClass == null) {
      throw new NullPointerException("elemType");
    }
    if (paramInt < -1) {
      throw new IllegalArgumentException("length");
    }
    Object localObject = deserialize(paramInputStream);
    
    Class localClass1 = localObject.getClass();
    if (!localClass1.isArray()) {
      throw new InvalidObjectException("object is not an array");
    }
    Class localClass2 = localClass1.getComponentType();
    if (localClass2 != paramClass) {
      throw new InvalidObjectException("unexpected array component type");
    }
    if (paramInt != -1)
    {
      int i = Array.getLength(localObject);
      if (i != paramInt) {
        throw new InvalidObjectException("array length mismatch");
      }
    }
    return localObject;
  }
  
  public static Object deserializeArrayResource(String paramString, Class paramClass, int paramInt)
    throws IOException
  {
    InputStream localInputStream = getResourceAsStream(paramString);
    if (localInputStream == null) {
      throw new IOException("unable to load resource '" + paramString + "'");
    }
    Object localObject = deserializeArray(localInputStream, paramClass, paramInt);
    
    return localObject;
  }
  
  public static void serialize(OutputStream paramOutputStream, Object paramObject)
    throws IOException
  {
    if (paramOutputStream == null) {
      throw new NullPointerException("out");
    }
    if (paramObject == null) {
      throw new NullPointerException("obj");
    }
    ObjectOutputStream localObjectOutputStream = new ObjectOutputStream(paramOutputStream);
    localObjectOutputStream.writeObject(paramObject);
  }
  
  public static synchronized void setHook(JavaLayerHook paramJavaLayerHook)
  {
    hook = paramJavaLayerHook;
  }
  
  public static synchronized JavaLayerHook getHook()
  {
    return hook;
  }
  
  public static synchronized InputStream getResourceAsStream(String paramString)
  {
    InputStream localInputStream = null;
    if (hook != null)
    {
      localInputStream = hook.getResourceAsStream(paramString);
    }
    else
    {
      Class localClass = JavaLayerUtils.class;
      localInputStream = localClass.getResourceAsStream(paramString);
    }
    return localInputStream;
  }
}

/* Location:
 * Qualified Name:     javazoom.jl.decoder.JavaLayerUtils
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package javazoom.jl.decoder.buffered;

import com.wowza.wms.logging.WMSLogger;
import com.wowza.wms.logging.WMSLoggerFactory;

public class MP3BufferedDecoder
{
  public static int frequency(MP3HeaderData paramMP3HeaderData)
  {
    return MP3HeaderData.frequencies[h_version][h_sample_frequency];
  }
  
  public static int samples_per_frame(MP3HeaderData paramMP3HeaderData)
  {
    int i = 0;
    try
    {
      if (h_vbr == true)
      {
        i = h_vbr_samples_per_frame[h_layer];
        if ((h_version == 0) || (h_version == 2)) {
          i /= 2;
        }
      }
      else
      {
        int[][][] arrayOfInt = { { { 192, 192, 192 }, { 576, 576, 576 }, { 576, 576, 576 } }, { { 384, 384, 384 }, { 1152, 1152, 1152 }, { 1152, 1152, 1152 } }, { { 96, 96, 96 }, { 288, 288, 288 }, { 288, 288, 288 } } };
        
        return arrayOfInt[h_version][(h_layer - 1)][h_sample_frequency];
      }
    }
    catch (Exception localException)
    {
      WMSLoggerFactory.getLogger(MP3BufferedDecoder.class).error("MP3BufferedDecoder.samples_per_frame: h_version: " + h_version + " h_layer:" + h_layer + " h_sample_frequency:" + h_sample_frequency + " error ", localException);
    }
    return i;
  }
  
  public static int syncHeader(byte paramByte, byte[] paramArrayOfByte, MP3HeaderData paramMP3HeaderData)
  {
    int i = paramArrayOfByte[0] << 16 & 0xFF0000 | paramArrayOfByte[1] << 8 & 0xFF00 | paramArrayOfByte[2] << 0 & 0xFF;
    i <<= 8;
    i |= paramArrayOfByte[3] & 0xFF;
    
    boolean bool = isSyncMark(i, paramByte, paramMP3HeaderData);
    
    return bool ? i : 0;
  }
  
  public static boolean isSyncMark(int paramInt1, int paramInt2, MP3HeaderData paramMP3HeaderData)
  {
    int i = syncword;
    boolean bool = false;
    if (paramInt2 == 0)
    {
      bool = (paramInt1 & 0xFFE00000) == -2097152;
    }
    else
    {
      if ((paramInt1 & 0xFFF80C00) == i) {}
      bool = ((paramInt1 & 0xC0) == 192) == single_ch_mode;
    }
    if (bool) {
      bool = (paramInt1 >>> 10 & 0x3) != 3;
    }
    if (bool) {
      bool = (paramInt1 >>> 17 & 0x3) != 0;
    }
    if (bool) {
      bool = (paramInt1 >>> 19 & 0x3) != 1;
    }
    return bool;
  }
  
  public static void decodeHeader(int paramInt1, int paramInt2, MP3HeaderData paramMP3HeaderData)
  {
    try
    {
      if (paramInt2 == 0)
      {
        h_version = (paramInt1 >>> 19 & 0x1);
        if (((paramInt1 >>> 20 & 0x1) == 0) && 
          (h_version == 0)) {
          h_version = 2;
        }
        if ((h_sample_frequency = paramInt1 >>> 10 & 0x3) != 3) {}
      }
      h_layer = (4 - (paramInt1 >>> 17) & 0x3);
      h_protection_bit = (paramInt1 >>> 16 & 0x1);
      h_bitrate_index = (paramInt1 >>> 12 & 0xF);
      h_padding_bit = (paramInt1 >>> 9 & 0x1);
      h_mode = (paramInt1 >>> 6 & 0x3);
      h_mode_extension = (paramInt1 >>> 4 & 0x3);
      if (h_mode == 1) {
        h_intensity_stereo_bound = ((h_mode_extension << 2) + 4);
      } else {
        h_intensity_stereo_bound = 0;
      }
      if ((paramInt1 >>> 3 & 0x1) == 1) {
        h_copyright = true;
      }
      if ((paramInt1 >>> 2 & 0x1) == 1) {
        h_original = true;
      }
      if (h_layer == 1)
      {
        h_number_of_subbands = 32;
      }
      else
      {
        int i = h_bitrate_index;
        if (h_mode != 3) {
          if (i == 4) {
            i = 1;
          } else {
            i -= 4;
          }
        }
        if ((i == 1) || (i == 2))
        {
          if (h_sample_frequency == 2) {
            h_number_of_subbands = 12;
          } else {
            h_number_of_subbands = 8;
          }
        }
        else if ((h_sample_frequency == 1) || ((i >= 3) && (i <= 5))) {
          h_number_of_subbands = 27;
        } else {
          h_number_of_subbands = 30;
        }
      }
      if (h_intensity_stereo_bound > h_number_of_subbands) {
        h_intensity_stereo_bound = h_number_of_subbands;
      }
    }
    catch (Exception localException)
    {
      WMSLoggerFactory.getLogger(MP3BufferedDecoder.class).error("MP3BufferedDecoder.decodeHeader ", localException);
    }
  }
  
  public static int calculateFrameSize(MP3HeaderData paramMP3HeaderData)
  {
    int i = 0;
    int j;
    if (h_layer == 1)
    {
      i = 12 * MP3HeaderData.bitrates[h_version][0][h_bitrate_index] / MP3HeaderData.frequencies[h_version][h_samp
1 2

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2019. Infinite Loop Ltd