Examples of IContainerFormat


Examples of com.xuggle.xuggler.IContainerFormat

  }
 
  @Test
  public void testIssue200()
  {
    IContainerFormat format = IContainerFormat.make();
    format.setOutputFormat("flv", null, null);

    List<ID> codecs = format.getOutputCodecsSupported();
    // now let's make sure there are no dups
    Set<ID> uniqueCodecs = new HashSet<ID>();
    for(ID id : codecs) {
      assertFalse("id not unique: "+id, uniqueCodecs.contains(id));
      uniqueCodecs.add(id);
View Full Code Here

Examples of com.xuggle.xuggler.IContainerFormat

   * Make sure the first video codec returned for FLV is FLV1.
   */
  @Test
  public void testIssue201()
  {
    IContainerFormat format = IContainerFormat.make();
    format.setOutputFormat("flv", null, null);

    List<ID> codecs = format.getOutputCodecsSupported();
    for(ID id : codecs) {
      ICodec codec = ICodec.findEncodingCodec(id);
      assertNotNull(codec);
      if (codec.getType() == ICodec.Type.CODEC_TYPE_VIDEO) {
        assertEquals(ICodec.ID.CODEC_ID_FLV1, id);
View Full Code Here

Examples of com.xuggle.xuggler.IContainerFormat

  }

  public int addAudioStream(int inputIndex, int streamId,
      int channelCount, int sampleRate)
  {
    IContainerFormat format = null;
    if (getContainer() != null)
      format = getContainer().getContainerFormat();
    if (format != null && !format.isOutput())
    {
      format.delete();
      format = null;
    }
    String url = getUrl();
    if (format == null && (url == null || url.length()<0))
      throw new IllegalArgumentException("Cannot guess codec without container or url");
View Full Code Here

Examples of com.xuggle.xuggler.IContainerFormat

 
  public int addVideoStream(int inputIndex, int streamId,
      IRational frameRate,
      int width, int height)
  {
    IContainerFormat format = null;
    if (getContainer() != null)
      format = getContainer().getContainerFormat();
    if (format != null && !format.isOutput())
    {
      format.delete();
      format = null;
    }
    String url = getUrl();
    if (format == null && (url == null || url.length()<0))
      throw new IllegalArgumentException("Cannot guess codec without container or url");
View Full Code Here

Examples of com.xuggle.xuggler.IContainerFormat

    // if this stream is not a supported type, indicate failure

    if (!isSupportedCodecType(inputType))
      return false;

    IContainerFormat format = getContainer().getContainerFormat();
   
    switch(inputType)
    {
      case CODEC_TYPE_AUDIO:
        addAudioStream(inputStream.getIndex(),
            inputStream.getId(),
            format.establishOutputCodecId(inputID),
            inputCoder.getChannels(),
            inputCoder.getSampleRate());
        break;
      case CODEC_TYPE_VIDEO:
        addVideoStream(inputStream.getIndex(),
            inputStream.getId(),
            format.establishOutputCodecId(inputID),
            inputCoder.getFrameRate(),
            inputCoder.getWidth(),
            inputCoder.getHeight());
        break;
      default:
View Full Code Here

Examples of com.xuggle.xuggler.IContainerFormat

   
    // and finally, we set these parameters on the container before opening
    container.setParameters(params);
   
    // Tell Xuggler about the device format
    IContainerFormat format = IContainerFormat.make();
    if (format.setInputFormat(driverName) < 0)
      throw new IllegalArgumentException("couldn't open webcam device: " + driverName);
   
    // Open up the container
    int retval = container.open(deviceName, IContainer.Type.READ, format);
    if (retval < 0)
View Full Code Here

Examples of com.xuggle.xuggler.IContainerFormat

    container.setParameters(params);
   
    // tell Xuggler about the device format

    IContainerFormat format = IContainerFormat.make();
    if (format.setInputFormat(driverName) < 0)
      throw new IllegalArgumentException(
        "couldn't open webcam device: " + driverName);
   
    // open the container
View Full Code Here

Examples of com.xuggle.xuggler.IContainerFormat

   
    String cpreset = cmdLine.getOptionValue("cpreset");
    if (cpreset != null)
      Configuration.configure(cpreset, mOContainer);
   
    IContainerFormat iFmt = null;
    IContainerFormat oFmt = null;

   
    // override input format
    if (icontainerFormat != null)
    {
      iFmt = IContainerFormat.make();
    
      /**
       * Try to find an output format based on what the user specified, or
       * failing that, based on the outputURL (e.g. if it ends in .flv, we'll
       * guess FLV).
       */
      retval = iFmt.setInputFormat(icontainerFormat);
      if (retval < 0)
        throw new RuntimeException("could not find input container format: "
            + icontainerFormat);
    }   
   
    // override the input codec
    if (iacodec != null)
    {
      ICodec codec = null;
      /**
       * Looks like they did specify one; let's look it up by name.
       */
      codec = ICodec.findDecodingCodecByName(iacodec);
      if (codec == null || codec.getType() != ICodec.Type.CODEC_TYPE_AUDIO)
        throw new RuntimeException("could not find decoder: " + iacodec);
      /**
       * Now, tell the output stream coder that it's to use that codec.
       */
      mIContainer.setForcedAudioCodec(codec.getID());
    }
   

    /**
     * Open the input container for Reading.
     */
    IContainerParameters parameters = IContainerParameters.make();
    if (isampleRate > 0)
      parameters.setAudioSampleRate(isampleRate);
    if (ichannels > 0)
      parameters.setAudioChannels(ichannels);
    mIContainer.setParameters(parameters);

    retval = mIContainer.open(inputURL, IContainer.Type.READ, iFmt);
    if (retval < 0)
      throw new RuntimeException("could not open url: " + inputURL);

    /**
     * If the user EXPLICITLY asked for a output container format, we'll try to
     * honor their request here.
     */
    if (containerFormat != null)
    {
      oFmt = IContainerFormat.make();
      /**
       * Try to find an output format based on what the user specified, or
       * failing that, based on the outputURL (e.g. if it ends in .flv, we'll
       * guess FLV).
       */
      retval = oFmt.setOutputFormat(containerFormat, outputURL, null);
      if (retval < 0)
        throw new RuntimeException("could not find output container format: "
            + containerFormat);
    }
      
View Full Code Here

Examples of com.xuggle.xuggler.IContainerFormat

    // maximize FFmpeg logging
    log.debug("About to change logging level");
    Global.setFFmpegLoggingLevel(50);
    // Try getting a new Container
    IContainer container = null;
    IContainerFormat fmt = null;   
    int retval = -1;

    container = IContainer.make();
    fmt = IContainerFormat.make();
   
    // try opening a container format
   
    retval = fmt.setInputFormat("flv");
    assertTrue("could not set input format", retval >= 0);
   
    retval = fmt.setOutputFormat("flv", null, null);
    assertTrue("could not set output format", retval >= 0);
   
    // force collection of native resources.
    container.delete();
    container = null;
View Full Code Here

Examples of com.xuggle.xuggler.IContainerFormat

 
  @Test
  public void testOpenFileSetsInputContainer()
  {
    IContainer container = null;
    IContainerFormat fmt = null;   
    int retval = -1;

    container = IContainer.make();
   
    // now, try opening a container.
    retval = container.open("file:"+this.getClass().getName()+"_"+this.getName()+".flv",
        IContainer.Type.WRITE, null);
    assertTrue("could not open file for writing", retval >= 0);
   
    fmt = container.getContainerFormat();
    assertNotNull(fmt);
    assertEquals("flv", fmt.getOutputFormatShortName());

    retval = container.close();
    assertTrue("could not close file", retval >= 0);
   
    retval = container.open("file:"+mSampleFile,
        IContainer.Type.READ, fmt);
    assertTrue("could not open file for writing", retval >= 0);

    fmt = container.getContainerFormat();
    assertNotNull(fmt);
    assertEquals("flv", fmt.getInputFormatShortName());


    retval = container.close();
    assertTrue("could not close file", retval >= 0);
   
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.