import jagtheora.ogg.OggPacket;
import jagtheora.ogg.OggStreamState;
import jagtheora.theora.DecoderContext;
import jagtheora.theora.Frame;
import jagtheora.theora.GranulePos;
import jagtheora.theora.SetupInfo;
import jagtheora.theora.TheoraComment;
import jagtheora.theora.TheoraInfo;

public class Class225_Sub45_Sub3 extends Class225_Sub45 {

   double aDouble10451;
   static final int anInt10452 = 1024;
   boolean aBool10453;
   TheoraInfo aTheoraInfo10454 = new TheoraInfo();
   static final int anInt10455 = 2048;
   DecoderContext aDecoderContext10456;
   GranulePos aGranulePos10457;
   SetupInfo aSetupInfo10458 = new SetupInfo();
   Frame aFrame10459;
   long aLong10460;
   boolean aBool10461;
   boolean aBool10462;
   int anInt10463;
   int anInt10464;
   TheoraComment aTheoraComment10465 = new TheoraComment();
   Object anObject10466;
   boolean aBool10467;


   float method16075(short var1) {
      return this.aBool10461 && !this.aTheoraInfo10454.method6700()?(float)this.aTheoraInfo10454.fpsNumerator / (float)this.aTheoraInfo10454.fpsDenominator:0.0F;
   }

   boolean method16076() {
      return this.aBool10461;
   }

   void method16077(int var1, int var2) {
      this.anInt10464 = -221034017 * var1;
      if(this.aBool10461) {
         if(1016312351 * this.anInt10464 > -129084421 * this.anInt10463) {
            this.anInt10464 = 537836197 * this.anInt10463;
         }

         if(1016312351 * this.anInt10464 < 0) {
            this.anInt10464 = 0;
         }

         this.aDecoderContext10456.setPostProcessingLevel(this.anInt10464 * 1016312351);
      }

   }

   Class225_Sub45_Sub3(OggStreamState var1) {
      super(var1);
   }

   double method16078(int var1) {
      return this.aDouble10451;
   }

   void method14171(OggPacket var1) {
      int var2;
      if(!this.aBool10461) {
         var2 = this.aSetupInfo10458.decodeHeader(this.aTheoraInfo10454, this.aTheoraComment10465, var1);
         if(0 == var2) {
            this.aBool10461 = true;
            if(this.aTheoraInfo10454.frameWidth > 2048 || this.aTheoraInfo10454.frameHeight > 1024) {
               throw new IllegalStateException();
            }

            this.aDecoderContext10456 = new DecoderContext(this.aTheoraInfo10454, this.aSetupInfo10458);
            this.aGranulePos10457 = new GranulePos();
            this.aFrame10459 = new Frame(this.aTheoraInfo10454.frameWidth, this.aTheoraInfo10454.frameHeight);
            this.anInt10463 = this.aDecoderContext10456.getMaxPostProcessingLevel() * -1113080013;
            this.method16077(1016312351 * this.anInt10464, 341207745);
         } else if(var2 < 0) {
            throw new IllegalStateException("" + var2);
         }
      } else {
         this.aLong10460 = Class339.method6240(1742861582) * -2162309434894296671L;
         var2 = this.aDecoderContext10456.decodePacketIn(var1, this.aGranulePos10457);
         if(var2 < 0) {
            throw new IllegalStateException("" + var2);
         }

         this.aDecoderContext10456.granuleFrame(this.aGranulePos10457);
         this.aDouble10451 = this.aDecoderContext10456.granuleTime(this.aGranulePos10457);
         if(this.aBool10453) {
            boolean var3 = var1.isKeyFrame() == 1;
            if(!var3) {
               return;
            }

            this.aBool10453 = false;
         }

         if(!this.aBool10462 || var1.isKeyFrame() == 1) {
            if(this.aDecoderContext10456.decodeFrame(this.aFrame10459) != 0) {
               throw new IllegalStateException("" + var2);
            }

            this.aBool10467 = true;
         }
      }

   }

   boolean method16079(byte var1) {
      return this.aBool10461;
   }

   void method14175(int var1) {
      if(this.aFrame10459 != null) {
         this.aFrame10459.method6701();
      }

      if(this.aDecoderContext10456 != null) {
         this.aDecoderContext10456.method6701();
         this.aDecoderContext10456 = null;
      }

      if(null != this.aGranulePos10457) {
         this.aGranulePos10457.method6701();
         this.aGranulePos10457 = null;
      }

      this.aTheoraInfo10454.method6701();
      this.aTheoraComment10465.method6701();
      this.aSetupInfo10458.method6701();
   }

   long method16080(int var1) {
      return this.aLong10460 * -4257011924595651999L;
   }

   long method16081() {
      return this.aLong10460 * -4257011924595651999L;
   }

   void method14173(OggPacket var1) {
      int var2;
      if(!this.aBool10461) {
         var2 = this.aSetupInfo10458.decodeHeader(this.aTheoraInfo10454, this.aTheoraComment10465, var1);
         if(0 == var2) {
            this.aBool10461 = true;
            if(this.aTheoraInfo10454.frameWidth > 2048 || this.aTheoraInfo10454.frameHeight > 1024) {
               throw new IllegalStateException();
            }

            this.aDecoderContext10456 = new DecoderContext(this.aTheoraInfo10454, this.aSetupInfo10458);
            this.aGranulePos10457 = new GranulePos();
            this.aFrame10459 = new Frame(this.aTheoraInfo10454.frameWidth, this.aTheoraInfo10454.frameHeight);
            this.anInt10463 = this.aDecoderContext10456.getMaxPostProcessingLevel() * -1113080013;
            this.method16077(1016312351 * this.anInt10464, 60696105);
         } else if(var2 < 0) {
            throw new IllegalStateException("" + var2);
         }
      } else {
         this.aLong10460 = Class339.method6240(1345168955) * -2162309434894296671L;
         var2 = this.aDecoderContext10456.decodePacketIn(var1, this.aGranulePos10457);
         if(var2 < 0) {
            throw new IllegalStateException("" + var2);
         }

         this.aDecoderContext10456.granuleFrame(this.aGranulePos10457);
         this.aDouble10451 = this.aDecoderContext10456.granuleTime(this.aGranulePos10457);
         if(this.aBool10453) {
            boolean var3 = var1.isKeyFrame() == 1;
            if(!var3) {
               return;
            }

            this.aBool10453 = false;
         }

         if(!this.aBool10462 || var1.isKeyFrame() == 1) {
            if(this.aDecoderContext10456.decodeFrame(this.aFrame10459) != 0) {
               throw new IllegalStateException("" + var2);
            }

            this.aBool10467 = true;
         }
      }

   }

   void method14172(OggPacket var1) {
      int var2;
      if(!this.aBool10461) {
         var2 = this.aSetupInfo10458.decodeHeader(this.aTheoraInfo10454, this.aTheoraComment10465, var1);
         if(0 == var2) {
            this.aBool10461 = true;
            if(this.aTheoraInfo10454.frameWidth > 2048 || this.aTheoraInfo10454.frameHeight > 1024) {
               throw new IllegalStateException();
            }

            this.aDecoderContext10456 = new DecoderContext(this.aTheoraInfo10454, this.aSetupInfo10458);
            this.aGranulePos10457 = new GranulePos();
            this.aFrame10459 = new Frame(this.aTheoraInfo10454.frameWidth, this.aTheoraInfo10454.frameHeight);
            this.anInt10463 = this.aDecoderContext10456.getMaxPostProcessingLevel() * -1113080013;
            this.method16077(1016312351 * this.anInt10464, 1882338677);
         } else if(var2 < 0) {
            throw new IllegalStateException("" + var2);
         }
      } else {
         this.aLong10460 = Class339.method6240(833578680) * -2162309434894296671L;
         var2 = this.aDecoderContext10456.decodePacketIn(var1, this.aGranulePos10457);
         if(var2 < 0) {
            throw new IllegalStateException("" + var2);
         }

         this.aDecoderContext10456.granuleFrame(this.aGranulePos10457);
         this.aDouble10451 = this.aDecoderContext10456.granuleTime(this.aGranulePos10457);
         if(this.aBool10453) {
            boolean var3 = var1.isKeyFrame() == 1;
            if(!var3) {
               return;
            }

            this.aBool10453 = false;
         }

         if(!this.aBool10462 || var1.isKeyFrame() == 1) {
            if(this.aDecoderContext10456.decodeFrame(this.aFrame10459) != 0) {
               throw new IllegalStateException("" + var2);
            }

            this.aBool10467 = true;
         }
      }

   }

   void method16082(int var1) {
      this.anInt10464 = -221034017 * var1;
      if(this.aBool10461) {
         if(1016312351 * this.anInt10464 > -129084421 * this.anInt10463) {
            this.anInt10464 = 537836197 * this.anInt10463;
         }

         if(1016312351 * this.anInt10464 < 0) {
            this.anInt10464 = 0;
         }

         this.aDecoderContext10456.setPostProcessingLevel(this.anInt10464 * 1016312351);
      }

   }

   public Object method16083(Interface21 var1, short var2) {
      if(this.aFrame10459 == null) {
         return null;
      } else if(!this.aBool10467 && null != this.anObject10466) {
         return this.anObject10466;
      } else {
         this.anObject10466 = var1.method105(this.aFrame10459.pixels, 0, this.aFrame10459.anInt9002 * -1870856071, this.aFrame10459.anInt9002 * -1870856071, 249623869 * this.aFrame10459.anInt9003, false, 1597897158);
         this.aBool10467 = false;
         return this.anObject10466;
      }
   }

   void method14167() {
      if(this.aFrame10459 != null) {
         this.aFrame10459.method6701();
      }

      if(this.aDecoderContext10456 != null) {
         this.aDecoderContext10456.method6701();
         this.aDecoderContext10456 = null;
      }

      if(null != this.aGranulePos10457) {
         this.aGranulePos10457.method6701();
         this.aGranulePos10457 = null;
      }

      this.aTheoraInfo10454.method6701();
      this.aTheoraComment10465.method6701();
      this.aSetupInfo10458.method6701();
   }

   void method14168(OggPacket var1, byte var2) {
      int var3;
      if(!this.aBool10461) {
         var3 = this.aSetupInfo10458.decodeHeader(this.aTheoraInfo10454, this.aTheoraComment10465, var1);
         if(0 == var3) {
            this.aBool10461 = true;
            if(this.aTheoraInfo10454.frameWidth > 2048 || this.aTheoraInfo10454.frameHeight > 1024) {
               throw new IllegalStateException();
            }

            this.aDecoderContext10456 = new DecoderContext(this.aTheoraInfo10454, this.aSetupInfo10458);
            this.aGranulePos10457 = new GranulePos();
            this.aFrame10459 = new Frame(this.aTheoraInfo10454.frameWidth, this.aTheoraInfo10454.frameHeight);
            this.anInt10463 = this.aDecoderContext10456.getMaxPostProcessingLevel() * -1113080013;
            this.method16077(1016312351 * this.anInt10464, 54914645);
         } else if(var3 < 0) {
            throw new IllegalStateException("" + var3);
         }
      } else {
         this.aLong10460 = Class339.method6240(365174681) * -2162309434894296671L;
         var3 = this.aDecoderContext10456.decodePacketIn(var1, this.aGranulePos10457);
         if(var3 < 0) {
            throw new IllegalStateException("" + var3);
         }

         this.aDecoderContext10456.granuleFrame(this.aGranulePos10457);
         this.aDouble10451 = this.aDecoderContext10456.granuleTime(this.aGranulePos10457);
         if(this.aBool10453) {
            boolean var4 = var1.isKeyFrame() == 1;
            if(!var4) {
               return;
            }

            this.aBool10453 = false;
         }

         if(!this.aBool10462 || var1.isKeyFrame() == 1) {
            if(this.aDecoderContext10456.decodeFrame(this.aFrame10459) != 0) {
               throw new IllegalStateException("" + var3);
            }

            this.aBool10467 = true;
         }
      }

   }

   void method16084(int var1) {
      this.anInt10464 = -221034017 * var1;
      if(this.aBool10461) {
         if(1016312351 * this.anInt10464 > -129084421 * this.anInt10463) {
            this.anInt10464 = 537836197 * this.anInt10463;
         }

         if(1016312351 * this.anInt10464 < 0) {
            this.anInt10464 = 0;
         }

         this.aDecoderContext10456.setPostProcessingLevel(this.anInt10464 * 1016312351);
      }

   }

   float method16085() {
      return this.aBool10461 && !this.aTheoraInfo10454.method6700()?(float)this.aTheoraInfo10454.fpsNumerator / (float)this.aTheoraInfo10454.fpsDenominator:0.0F;
   }

   double method16086() {
      return this.aDouble10451;
   }

   double method16087() {
      return this.aDouble10451;
   }

   double method16088() {
      return this.aDouble10451;
   }

   void method14174() {
      if(this.aFrame10459 != null) {
         this.aFrame10459.method6701();
      }

      if(this.aDecoderContext10456 != null) {
         this.aDecoderContext10456.method6701();
         this.aDecoderContext10456 = null;
      }

      if(null != this.aGranulePos10457) {
         this.aGranulePos10457.method6701();
         this.aGranulePos10457 = null;
      }

      this.aTheoraInfo10454.method6701();
      this.aTheoraComment10465.method6701();
      this.aSetupInfo10458.method6701();
   }

   long method16089() {
      return this.aLong10460 * -4257011924595651999L;
   }

   void method14166(OggPacket var1) {
      int var2;
      if(!this.aBool10461) {
         var2 = this.aSetupInfo10458.decodeHeader(this.aTheoraInfo10454, this.aTheoraComment10465, var1);
         if(0 == var2) {
            this.aBool10461 = true;
            if(this.aTheoraInfo10454.frameWidth > 2048 || this.aTheoraInfo10454.frameHeight > 1024) {
               throw new IllegalStateException();
            }

            this.aDecoderContext10456 = new DecoderContext(this.aTheoraInfo10454, this.aSetupInfo10458);
            this.aGranulePos10457 = new GranulePos();
            this.aFrame10459 = new Frame(this.aTheoraInfo10454.frameWidth, this.aTheoraInfo10454.frameHeight);
            this.anInt10463 = this.aDecoderContext10456.getMaxPostProcessingLevel() * -1113080013;
            this.method16077(1016312351 * this.anInt10464, 567987683);
         } else if(var2 < 0) {
            throw new IllegalStateException("" + var2);
         }
      } else {
         this.aLong10460 = Class339.method6240(-893564964) * -2162309434894296671L;
         var2 = this.aDecoderContext10456.decodePacketIn(var1, this.aGranulePos10457);
         if(var2 < 0) {
            throw new IllegalStateException("" + var2);
         }

         this.aDecoderContext10456.granuleFrame(this.aGranulePos10457);
         this.aDouble10451 = this.aDecoderContext10456.granuleTime(this.aGranulePos10457);
         if(this.aBool10453) {
            boolean var3 = var1.isKeyFrame() == 1;
            if(!var3) {
               return;
            }

            this.aBool10453 = false;
         }

         if(!this.aBool10462 || var1.isKeyFrame() == 1) {
            if(this.aDecoderContext10456.decodeFrame(this.aFrame10459) != 0) {
               throw new IllegalStateException("" + var2);
            }

            this.aBool10467 = true;
         }
      }

   }

   public Object method16090(Interface21 var1) {
      if(this.aFrame10459 == null) {
         return null;
      } else if(!this.aBool10467 && null != this.anObject10466) {
         return this.anObject10466;
      } else {
         this.anObject10466 = var1.method105(this.aFrame10459.pixels, 0, this.aFrame10459.anInt9002 * -1870856071, this.aFrame10459.anInt9002 * -1870856071, 249623869 * this.aFrame10459.anInt9003, false, 1597897158);
         this.aBool10467 = false;
         return this.anObject10466;
      }
   }

   public Object method16091(Interface21 var1) {
      if(this.aFrame10459 == null) {
         return null;
      } else if(!this.aBool10467 && null != this.anObject10466) {
         return this.anObject10466;
      } else {
         this.anObject10466 = var1.method105(this.aFrame10459.pixels, 0, this.aFrame10459.anInt9002 * -1870856071, this.aFrame10459.anInt9002 * -1870856071, 249623869 * this.aFrame10459.anInt9003, false, 1597897158);
         this.aBool10467 = false;
         return this.anObject10466;
      }
   }

   static final void method16092(Class508 var0, int var1) {
      int var2 = var0.anIntArray6027[(var0.anInt6003 -= 98312473) * -937710807];
      var0.anObjectArray6004[(var0.anInt6005 += -46848683) * 639741949 - 1] = Class255.aClass434_3029.method7328(var2, -1292348107).method15609((short)-6836);
   }
}
