Examples of IPacket


Examples of com.calclab.emite.core.client.packet.IPacket

     * @param nodeName
     * @param text
     */
    protected void setTextToChild(final String nodeName, final String text) {
  if (text != null) {
      IPacket node = getFirstChild(nodeName);
      if (node == NoPacket.INSTANCE) {
    node = this.addChild(nodeName, null);
      }
      node.setText(text);
  } else {
      removeChild(getFirstChild(nodeName));
  }
    }
View Full Code Here

Examples of com.calclab.emite.core.client.packet.IPacket

  onAuthorized.add(listener);
    }

    public void sendAuthorizationRequest(final AuthorizationTransaction authorizationTransaction) {
  this.currentTransaction = authorizationTransaction;
  final IPacket response = isAnonymous(authorizationTransaction) ? createAnonymousAuthorization()
    : createPlainAuthorization(authorizationTransaction);
  connection.send(response);
  currentTransaction.setState(State.waitingForAuthorization);
    }
View Full Code Here

Examples of com.calclab.emite.core.client.packet.IPacket

  connection.send(response);
  currentTransaction.setState(State.waitingForAuthorization);
    }

    private IPacket createAnonymousAuthorization() {
  final IPacket auth = new Packet("auth", XMLNS).With("mechanism", "ANONYMOUS");
  return auth;
    }
View Full Code Here

Examples of com.calclab.emite.core.client.packet.IPacket

  final IPacket auth = new Packet("auth", XMLNS).With("mechanism", "ANONYMOUS");
  return auth;
    }

    private IPacket createPlainAuthorization(final AuthorizationTransaction authorizationTransaction) {
  final IPacket auth = new Packet("auth", XMLNS).With("mechanism", "PLAIN");
  final String encoded = encode(authorizationTransaction.uri.getHost(), authorizationTransaction.uri.getNode(),
    authorizationTransaction.getPassword());
  auth.setText(encoded);
  return auth;
    }
View Full Code Here

Examples of com.calclab.emite.core.client.packet.IPacket

  }
    }

    public void setBody(final String msg) {
  if (msg != null) {
      final IPacket body = addChild("body", null);
      body.setText(msg);
  }
    }
View Full Code Here

Examples of com.calclab.emite.core.client.packet.IPacket

        if (statusCode != 200 && statusCode != 0) {
      running = false;
      onError.fire("Bad status: " + statusCode);
        } else {
      onResponse.fire(content);
      final IPacket response = services.toXML(content);
      if (response != null && "body".equals(response.getName())) {
          handleResponse(response);
      } else {
          onError.fire("Bad response: " + content);
      }
        }
View Full Code Here

Examples of com.calclab.emite.core.client.packet.IPacket

  this(type);
  super.setTo(to);
    }

    public IPacket addQuery(final String xmlns) {
  final IPacket query = addChild("query", xmlns);
  return query;
    }
View Full Code Here

Examples of com.xuggle.xuggler.IPacket

    openJavaSound(audioCoder);
   
    /*
     * Now, we start walking through the container looking at each packet.
     */
    IPacket packet = IPacket.make();
    while(container.readNextPacket(packet) >= 0)
    {
      /*
       * Now we have a packet, let's see if it belongs to our audio stream
       */
      if (packet.getStreamIndex() == audioStreamId)
      {
        /*
         * We allocate a set of samples with the same number of channels as the
         * coder tells us is in this buffer.
         *
         * We also pass in a buffer size (1024 in our example), although Xuggler
         * will probably allocate more space than just the 1024 (it's not important why).
         */
        IAudioSamples samples = IAudioSamples.make(1024, audioCoder.getChannels());
       
        /*
         * A packet can actually contain multiple sets of samples (or frames of samples
         * in audio-decoding speak).  So, we may need to call decode audio multiple
         * times at different offsets in the packet's data.  We capture that here.
         */
        int offset = 0;
       
        /*
         * Keep going until we've processed all data
         */
        while(offset < packet.getSize())
        {
          int bytesDecoded = audioCoder.decodeAudio(samples, packet, offset);
          if (bytesDecoded < 0)
            throw new RuntimeException("got error decoding audio in: " + filename);
          offset += bytesDecoded;
View Full Code Here

Examples of com.xuggle.xuggler.IPacket

      open();

    // if there is an off-nominal result from read packet, return the
    // correct error

    IPacket packet = IPacket.make();
    try
    {
      int rv = getContainer().readNextPacket(packet);
      if (rv < 0)
      {
        IError error = IError.make(rv);

        // if this is an end of file, or unknow, call close

        if (!mCloseOnEofOnly || IError.Type.ERROR_EOF == error.getType())
          close();

        return error;
      }

      // inform listeners that a packet was read

      super.onReadPacket(new ReadPacketEvent(this,packet));

      // get the coder for this packet

      IStreamCoder coder = getStreamCoder(packet.getStreamIndex());
      // decode based on type

      switch (coder.getCodecType())
      {
        // decode audio

        case CODEC_TYPE_AUDIO:
          decodeAudio(coder, packet);
          break;

          // decode video

        case CODEC_TYPE_VIDEO:
          decodeVideo(coder, packet);
          break;

          // all other stream types are currently ignored

        default:
      }

     
    }
    finally
    {
      if (packet != null)
        packet.delete();
    }

    // return true more packets to be read

    return null;
View Full Code Here

Examples of com.xuggle.xuggler.IPacket

    openJavaWindow();

    /*
     * Now, we start walking through the container looking at each packet.
     */
    IPacket packet = IPacket.make();
    while(container.readNextPacket(packet) >= 0)
    {
      /*
       * Now we have a packet, let's see if it belongs to our video stream
       */
      if (packet.getStreamIndex() == videoStreamId)
      {
        /*
         * We allocate a new picture to get the data out of Xuggler
         */
        IVideoPicture picture = IVideoPicture.make(videoCoder.getPixelType(),
            videoCoder.getWidth(), videoCoder.getHeight());

        int offset = 0;
        while(offset < packet.getSize())
        {
          /*
           * Now, we decode the video, checking for any errors.
           *
           */
 
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.