Package com.xuggle.xuggler

Examples of com.xuggle.xuggler.ICodec


    writer.setMaskLateStreamExceptions(true);

    // add the audio stream

    ICodec codec = ICodec.findEncodingCodec(ICodec.ID.CODEC_ID_MP3);
    IContainer container = writer.getContainer();
    IStream stream = container.getStream(
        writer.addAudioStream(audioStreamIndex, audioStreamId,
            codec, channelCount, sampleRate));
    int sampleCount = stream.getStreamCoder().getDefaultAudioFrameSize();
View Full Code Here


    System.out.println();
    System.out.println("Total codecs supported: " + format.getOutputNumCodecsSupported());
    System.out.println("Supported Codecs:");
    for(ID id : codecs) {
      if (id != null) {
        ICodec codec = ICodec.findEncodingCodec(id);
        if (codec != null && codec.canEncode()) {
          System.out.println(codec);
        }
      }
    }   
  }
View Full Code Here

    System.out.println("Container Format: "+format);
    System.out.println();
    System.out.println("Supported Codecs:");
    for(ID id : codecs) {
      if (id != null) {
        ICodec codec = ICodec.findEncodingCodec(id);
        if (codec != null) {
          System.out.println(codec);
        }
      }
    }   
View Full Code Here

  }
  @Test
  public void testGetCodec()
  {
    // First the video stream
    ICodec codec = null;
    ICodec.Type type = null;
    ICodec.ID id = null;

    mCoder = getStreamCoder(sampleFile, 0);
   
    codec = mCoder.getCodec();
    assertTrue(codec != null);
   
    type = mCoder.getCodecType();
    assertTrue(type == codec.getType());
    assertTrue(type == ICodec.Type.CODEC_TYPE_VIDEO);
   
    id = mCoder.getCodecID();
    assertTrue(id == codec.getID());
    log.debug("Video type: {}", id);
    assertTrue(id == ICodec.ID.CODEC_ID_FLV1);
   
    // Then the audio stream.
    mCoder = getStreamCoder(sampleFile, 1);
   
    codec = mCoder.getCodec();
    assertTrue(codec != null);
   
    type = mCoder.getCodecType();
    assertTrue(type == codec.getType());
    assertTrue(type == ICodec.Type.CODEC_TYPE_AUDIO);
   
    id = mCoder.getCodecID();
    assertTrue(id == codec.getID());
    assertTrue(id == ICodec.ID.CODEC_ID_MP3);
  }
View Full Code Here

      format = null;
    }
    String url = getUrl();
    if (format == null && (url == null || url.length()<0))
      throw new IllegalArgumentException("Cannot guess codec without container or url");
    ICodec codec = ICodec.guessEncodingCodec(format,
        null, url, null,
        ICodec.Type.CODEC_TYPE_AUDIO);
    if (codec == null)
      throw new UnsupportedOperationException("could not guess audio codec");
   
    try {
      return addAudioStream(inputIndex, streamId, codec,
          channelCount, sampleRate);
    }
    finally
    {
      if (codec != null)
        codec.delete();
    }
  }
View Full Code Here

  public int addAudioStream(int inputIndex, int streamId,
      ICodec.ID codecId, int channelCount, int sampleRate)
  {
    if (codecId == null)
      throw new IllegalArgumentException("null codecId");
    ICodec codec = ICodec.findEncodingCodec(codecId);
    if (codec == null)
      throw new UnsupportedOperationException("cannot encode with codec: "+
          codecId);
    try
    {
      return addAudioStream(inputIndex, streamId, codec,
          channelCount, sampleRate);
    }
    finally
    {
      codec.delete();
    }
  }
View Full Code Here

      format = null;
    }
    String url = getUrl();
    if (format == null && (url == null || url.length()<0))
      throw new IllegalArgumentException("Cannot guess codec without container or url");
    ICodec codec = ICodec.guessEncodingCodec(format,
        null, url, null,
        ICodec.Type.CODEC_TYPE_VIDEO);
    if (codec == null)
      throw new UnsupportedOperationException("could not guess video codec");
   
    try {
      return addVideoStream(inputIndex, streamId,
          codec, frameRate,
          width, height);
    }
    finally
    {
      if (codec != null)
        codec.delete();
    }   
  }
View Full Code Here

  public int addVideoStream(int inputIndex, int streamId,
      ICodec.ID codecId, IRational frameRate, int width, int height)
  {
    if (codecId == null)
      throw new IllegalArgumentException("null codecId");
    ICodec codec = ICodec.findEncodingCodec(codecId);
    if (codec == null)
      throw new UnsupportedOperationException("cannot encode with codec: "+
          codecId);
    try
    {
      return addVideoStream(inputIndex, streamId, codec,
          frameRate, width, height);
    }
    finally
    {
      codec.delete();
    }
  }
View Full Code Here

    int retval = outContainer.open(outFile, IContainer.Type.WRITE, null);
    if (retval < 0)
      throw new RuntimeException("could not open output file");

    ICodec codec = ICodec.guessEncodingCodec(null, null, outFile, null,
        ICodec.Type.CODEC_TYPE_VIDEO);
    if (codec == null)
      throw new RuntimeException("could not guess a codec");

    outStream = outContainer.addNewStream(codec);
View Full Code Here

TOP

Related Classes of com.xuggle.xuggler.ICodec

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.