SIP Communicator: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.media.transform
Class TransformOutputStream

java.lang.Object
  extended by net.java.sip.communicator.impl.media.RTPConnectorOutputStream
      extended by net.java.sip.communicator.impl.media.transform.TransformOutputStream
All Implemented Interfaces:
javax.media.rtp.OutputDataStream

public class TransformOutputStream
extends RTPConnectorOutputStream

TransformOutputStream implements OutputDataStream. It is use by RTPManager to send RTP/RTCP packet data out. In this implementation, UDP socket is used to send the data out. When a normal RTP/RTCP packet is passed down from RTPManager, we first transform the packet using user define PacketTransformer and then send it out through network to all the stream targets.

Author:
Bing SU (nova.su@gmail.com), Lubomir Marinov

Field Summary
 
Fields inherited from class net.java.sip.communicator.impl.media.RTPConnectorOutputStream
targets
 
Constructor Summary
TransformOutputStream(DatagramSocket socket, PacketTransformer transformer)
          Construct a TransformOutputStream based on the given UDP socket and PacketTransformer
 
Method Summary
protected  RawPacket createRawPacket(byte[] buffer, int offset, int length)
          Creates a new RawPacket from a specific byte[] buffer in order to have this instance send its packet data through its RTPConnectorOutputStream.write(byte[], int, int) method.
 
Methods inherited from class net.java.sip.communicator.impl.media.RTPConnectorOutputStream
addTarget, removeTarget, removeTargets, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransformOutputStream

public TransformOutputStream(DatagramSocket socket,
                             PacketTransformer transformer)
Construct a TransformOutputStream based on the given UDP socket and PacketTransformer

Parameters:
socket - UDP socket used to send packet data out
transformer - PacketTransformer used to transform RTP/RTCP packets
Method Detail

createRawPacket

protected RawPacket createRawPacket(byte[] buffer,
                                    int offset,
                                    int length)
Description copied from class: RTPConnectorOutputStream
Creates a new RawPacket from a specific byte[] buffer in order to have this instance send its packet data through its RTPConnectorOutputStream.write(byte[], int, int) method. Allows extenders to intercept the packet data and possibly filter and/or modify it.

Overrides:
createRawPacket in class RTPConnectorOutputStream
Parameters:
buffer - the packet data to be sent to the targets of this instance
offset - the offset of the packet data in buffer
length - the length of the packet data in buffer
Returns:
a new RawPacket containing the packet data of the specified byte[] buffer or possibly its modification; null to ignore the packet data of the specified byte[] buffer and not send it to the targets of this instance through its RTPConnectorOutputStream.write(byte[], int, int) method

SIP Communicator: the OpenSource Java VoIP and Instant Messaging client.

SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.