Package com.xuggle.xuggler

Examples of com.xuggle.xuggler.IContainer


  }

  @Test
  public void testQueryStreamMetaDataFailsIfFileNotOpen()
  {
    IContainer container = IContainer.make();
   
    int retval = -1;
   
    retval = container.queryStreamMetaData();
    assertTrue("could query stream meta data", retval < 0);
   
  }
View Full Code Here



  @Test
  public void testGetDuration()
  {
    IContainer container = IContainer.make();
   
    int retval = -1;
   
    retval = container.open(mSampleFile, IContainer.Type.READ, null);
    assertTrue("could not open file", retval >= 0);
   
    assertEquals("unexpected duration", 149264000.0, container.getDuration(),
        30000); // allow a leeway of at least 30 milliseconds due to some
    // 64 bit issues.
   
  }
View Full Code Here

  }

  @Test
  public void testGetStartTime()
  {
    IContainer container = IContainer.make();
   
    int retval = -1;
   
    retval = container.open(mSampleFile, IContainer.Type.READ, null);
    assertTrue("could not open file", retval >= 0);
   
    assertEquals("unexpected start time", 0, container.getStartTime());
   
  }
View Full Code Here

  }

  @Test
  public void testGetFileSize()
  {
    IContainer container = IContainer.make();
   
    int retval = -1;
   
    retval = container.open(mSampleFile, IContainer.Type.READ, null);
    assertTrue("could not open file", retval >= 0);
   
    assertEquals("unexpected filesize", 4546420, container.getFileSize());
   
  }
View Full Code Here

  }

  @Test
  public void testGetBitRate()
  {
    IContainer container = IContainer.make();
   
    int retval = -1;
   
    retval = container.open("fixtures/testfile.mp3", IContainer.Type.READ, null);
    assertTrue("could not open file", retval >= 0);
   
    assertEquals("unexpected bit rate", 127999, container.getBitRate(), 1000);
   
  }
View Full Code Here

  }
 
  @Test
  public void testReadPackets()
  {
    IContainer container = IContainer.make();
   
    int retval = -1;
    retval = container.open(mSampleFile, IContainer.Type.READ, null);
    assertTrue("could not open file", retval >= 0);

    long packetsRead = 0;
    IPacket packet = IPacket.make();
    while(container.readNextPacket(packet) >= 0)
    {
      if (packet.isComplete())
        ++packetsRead;
    }
    assertEquals("got unexpected number of packets in file", 7950, packetsRead);
View Full Code Here

  }

  @Test
  public void testReadPacketAddsTimeBase()
  {
    IContainer container = IContainer.make();
   
    int retval = -1;
    retval = container.open(mSampleFile, IContainer.Type.READ, null);
    assertTrue("could not open file", retval >= 0);

    IPacket packet = IPacket.make();
   
    // just read the first three packets
    for(int i = 0; i < 3; i++)
    {
      assertTrue(container.readNextPacket(packet) >= 0);
      IRational timebase = packet.getTimeBase();
      assertNotNull(timebase);
      // should be 1/1000 for flv
      assertEquals(1, timebase.getNumerator());
      assertEquals(1000, timebase.getDenominator());
    }
   
    container.close();
  }
View Full Code Here

   * from there.  Should be less than the results of {@link #testReadPackets()}.
   */
  @Test
  public void testSeekKeyFrame()
  {
    IContainer container = IContainer.make();
   
    int retval = -1;
    retval = container.open(mSampleFile, IContainer.Type.READ, null);
    assertTrue("could not open file", retval >= 0);

    // annoyingly we need to make sure that the timestamp is in the time
    // base of the stream we're looking for which can be different for each stream.
    //
    // we happen to know that FLV is in milliseconds (or 1/1000 per second) so
    // we multiply our desired number of seconds by 1,000
    retval = container.seekKeyFrame(0, 20*1000, IURLProtocolHandler.SEEK_CUR);
    assertTrue("could not seek to key frame", retval >=0);
   
    long packetsRead = 0;
    IPacket packet = IPacket.make();
    while(container.readNextPacket(packet) >= 0)
    {
      if (packet.isComplete())
        ++packetsRead;
    }
    assertEquals("got unexpected number of packets in file", 6905, packetsRead);
View Full Code Here

  }

  @Test
  public void testSeekKeyFrame2()
  {
    IContainer container = IContainer.make();
   
    int retval = -1;
    retval = container.open(mSampleFile, IContainer.Type.READ, null);
    assertTrue("could not open file", retval >= 0);

    // annoyingly we need to make sure that the timestamp is in the time
    // base of the stream we're looking for which can be different for each stream.
    //
    // we happen to know that FLV is in milliseconds (or 1/1000 per second) so
    // we multiply our desired number of seconds by 1,000
    retval = container.seekKeyFrame(0, 18*1000, 20*1000, 21*1000,
        0);
    assertTrue("could not seek to key frame", retval >=0);
   
    long packetsRead = 0;
    IPacket packet = IPacket.make();
    while(container.readNextPacket(packet) >= 0)
    {
      if (packet.isComplete())
        ++packetsRead;
    }
    assertEquals("got unexpected number of packets in file", 6905, packetsRead);
View Full Code Here

  }

  @Test
  public void testSeekKeyFrameWithNegativeStream()
  {
    IContainer container = IContainer.make();
   
    int retval = -1;
    retval = container.open(mSampleFile, IContainer.Type.READ, null);
    assertTrue("could not open file", retval >= 0);

    retval = container.seekKeyFrame(-1, 20*1000*1000, IURLProtocolHandler.SEEK_CUR);
    long packetsRead = 0;
    IPacket packet = IPacket.make();
    while(container.readNextPacket(packet) >= 0)
    {
      if (packet.isComplete())
        ++packetsRead;
    }
    assertEquals("got unexpected number of packets in file", 6905, packetsRead);
View Full Code Here

TOP

Related Classes of com.xuggle.xuggler.IContainer

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.