Package com.xuggle.xuggler

Examples of com.xuggle.xuggler.IRational


        // get streams coder
        IStreamCoder coder = stream.getStreamCoder();
        // set codec for the stream
        coder.setCodec(videoFormat);
        // framerate
        IRational fps = IRational.make(framerate);
        // timebase = 1/fps
        coder.setTimeBase(IRational.make(fps.getDenominator(), fps
            .getNumerator()));
        coder.setPixelType(pixelformat);
        // set resolution
        coder.setHeight(height);
        coder.setWidth(width);
View Full Code Here


         *
         * But take my word that time stamps are tricky, and this only touches
         * the envelope. The good news is, it's easier in Xuggler than some
         * other systems.
         */
        IRational num = null;
        num = ic.getFrameRate();
        oc.setFrameRate(num);
        oc.setTimeBase(IRational.make(num.getDenominator(), num
                .getNumerator()));
        num = null;

        /**
         * And allocate buffers for us to store decoded and resample video
View Full Code Here

      IStream stream = mIContainer.getStream(i);
      long tsOffset = 0;
      if (stream.getStartTime() != Global.NO_PTS && stream.getStartTime() > 0
          && stream.getTimeBase() != null)
      {
        IRational defTimeBase = IRational.make(1,
            (int) Global.DEFAULT_PTS_PER_SECOND);
        tsOffset = defTimeBase.rescale(stream.getStartTime(), stream
            .getTimeBase());
      }
      /**
       * And look up the appropriate objects that are working on that stream.
       */
 
View Full Code Here

   * @param oPacket the packet about to be written.
   */
  private void delayForRealTime(IPacket oPacket)
  {
    // convert packet timestamp to microseconds
    final IRational timeBase = oPacket.getTimeBase();
    if (timeBase == null || timeBase.getNumerator() == 0 ||
        timeBase.getDenominator() == 0)
      return;
    long dts = oPacket.getDts();
    if (dts == Global.NO_PTS)
      return;
   
    final long currStreamTime = IRational.rescale(dts,
        1,
        1000000,
        timeBase.getNumerator(),
        timeBase.getDenominator(),
        IRational.Rounding.ROUND_NEAR_INF);
    if (mStartStreamTime == null)
      mStartStreamTime = currStreamTime;

    // convert now to microseconds
View Full Code Here

  }
 
  @Test
  public void testVideoFrameRate()
  {
    IRational val=IRational.make(30, 1);
    ISimpleMediaFile obj = new SimpleMediaFile();
    assertNull(obj.getVideoFrameRate());
    obj.setVideoFrameRate(val);
    assertEquals("set method failed", val.getNumerator(), obj.getVideoFrameRate().getNumerator());
    assertEquals("set method failed", val.getDenominator(), obj.getVideoFrameRate().getDenominator());
  }
View Full Code Here

 
  @Test
  public void testCompareTo()
  {
    int retval = -1;
    IRational otherRational = IRational.make(5);
    mRational = IRational.make(4);

    retval = mRational.compareTo(otherRational);
    assertTrue(retval <0);
    retval = otherRational.compareTo(mRational);
    assertTrue(retval >0);
    retval = mRational.compareTo(mRational);
    assertTrue(retval == 0);
    retval = IRational.sCompareTo(mRational, otherRational);
    assertTrue(retval < 0);
View Full Code Here

  }
 
  @Test
  public void testMultiply()
  {
    IRational a = IRational.make(12);
    IRational b = IRational.make(3);
   
    mRational = IRational.sMultiply(a, b);
    assertTrue(mRational.getDouble() == 36);
  }
View Full Code Here

  }

  @Test
  public void testAdd()
  {
    IRational a = IRational.make(12);
    IRational b = IRational.make(3);
   
    mRational = IRational.sAdd(a, b);
    assertTrue(mRational.getDouble() == 15);
 
View Full Code Here

 

  @Test
  public void testSubtract()
  {
    IRational a = IRational.make(12);
    IRational b = IRational.make(3);
   
    mRational = IRational.sSubtract(a, b);
    assertTrue(mRational.getDouble() == 9);
  }
View Full Code Here

  }
 
  @Test
  public void testDivision()
  {
    IRational a = IRational.make(12);
    IRational b = IRational.make(3);
   
    mRational = IRational.sDivide(a, b);
    assertTrue(mRational.getDouble() == 4);
   
    mRational = IRational.sDivide(
View Full Code Here

TOP

Related Classes of com.xuggle.xuggler.IRational

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.