Examples of IContainerFormat


Examples of com.xuggle.xuggler.IContainerFormat

  }

  @Test
  public void testCreateSDPData()
  {
    IContainerFormat format = IContainerFormat.make();
    format.setOutputFormat("rtp", null, null);
    IContainer container = IContainer.make();
    container.open("rtp://127.0.0.1:23832", IContainer.Type.WRITE, format);
    IStream stream = container.addNewStream(0);
    IStreamCoder coder = stream.getStreamCoder();
    coder.setCodec(ICodec.ID.CODEC_ID_H263);
View Full Code Here

Examples of com.xuggle.xuggler.IContainerFormat

    }

    protected static IContainerFormat createContainerFormat(
        String containerFormatName) throws EncoderInitializationException {
        int errorNumber;
        IContainerFormat format = IContainerFormat.make();
        if ((errorNumber = format.setOutputFormat(containerFormatName, null,
            null)) < 0)
            throw new EncoderInitializationException(IError.make(errorNumber)
                .getDescription());
        return format;
    }
View Full Code Here

Examples of com.xuggle.xuggler.IContainerFormat

    }

    protected static IContainerFormat createContainerFormat(
        String containerFormatName) throws DecoderInitializationException {
        int errorNumber;
        IContainerFormat format = IContainerFormat.make();
        if ((errorNumber = format.setOutputFormat(containerFormatName, null,
            null)) < 0)
            throw new DecoderInitializationException(IError.make(errorNumber)
                .getDescription());
        return format;
    }
View Full Code Here

Examples of com.xuggle.xuggler.IContainerFormat

            .getLogger(JizzXugglerTrackAudioReaderImpl.class);

    @Override
    public InputStream decode(InputStream encoded, String fileExtension)
            throws IOException, UnsupportedTrackTypeException {
        IContainerFormat format = null;
        if (fileExtension != null) {
            logger.trace("Looking up format based on extension {}",
                    fileExtension);
            findFormat: for (IContainerFormat supported : IContainerFormat
                    .getInstalledInputFormats()) {
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.
     */
    IMetaData parameters = IMetaData.make();
   
    if (isampleRate > 0)
      parameters.setValue("sample_rate", ""+isampleRate);

    if (ichannels > 0)
      parameters.setValue("channels", ""+ichannels);
   
    IMetaData rejectParameters = IMetaData.make();

    retval = mIContainer.open(inputURL, IContainer.Type.READ, iFmt, false, true,
        parameters, rejectParameters);
    if (retval < 0)
      throw new RuntimeException("could not open url: " + inputURL);
    if (rejectParameters.getNumKeys() > 0)
      throw new RuntimeException("some parameters were rejected: " + rejectParameters);
    /**
     * 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

  }

  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

    // Create a Xuggler container object
    IContainer container = IContainer.make();

    // Tell Xuggler about the device format
    IContainerFormat format = IContainerFormat.make();
    if (format.setInputFormat(driverName) < 0)
      throw new IllegalArgumentException("couldn't open webcam device: " + driverName);

    // devices, unlike most files, need to have parameters set in order
    // for Xuggler to know how to configure them, for a webcam, these
    // parameters make sense
View Full Code Here

Examples of com.xuggle.xuggler.IContainerFormat

  private final String sampleFile = "fixtures/testfile.flv";

  @Test
  public void testSetOutputFmt()
  {
    IContainerFormat fmt = IContainerFormat.make();
   
    fmt.setOutputFormat("flv", null, null);
    fmt.setOutputFormat("flv", sampleFile, null);
    fmt.setOutputFormat("flv", "file:"+sampleFile, null);

   
    fmt.setOutputFormat("NotAShortName", null, null);
    fmt.setOutputFormat("NotAShortName", "NotAURL", null);
    fmt.setOutputFormat("NotAShortName", "file:"+"NotAURL", null);
    fmt.setOutputFormat("NotAShortName", "NotAProtocol:"+"NotAURL", null);

   
    assertTrue("got to end of test without coredump.  woo hoo", true);
  }
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.