Methods Summary |
---|
protected void | addAttribute(AttributeField af)Adds a new attirbute to the list.
this.attributeFields.addElement(af);
|
public void | addBandwidthField(BandwidthField b)Sets the bandwidth field member.
bandwidthFields.addElement(b);
|
public void | addDynamicPayloads(java.util.Vector payloadNames, java.util.Vector payloadValues)Adds dynamic media types to the description.
MediaField mediaField = (MediaField)getMedia();
if (payloadNames == null || payloadValues == null)
throw new SdpException(" The vectors are null");
else {
if (payloadNames.isEmpty() || payloadValues.isEmpty())
throw new SdpException(" The vectors are empty");
else {
if (payloadNames.size() != payloadValues.size())
throw new SdpException(" The vector sizes are unequal");
else {
for (int i = 0; i < payloadNames.size(); i++) {
String name = (String)payloadNames.elementAt(i);
String value = (String)payloadValues.elementAt(i);
setAttribute(name, value);
}
}
}
}
|
public java.lang.String | encode()Encodes to a canonical form.
StringBuffer retval = new StringBuffer();
if (mediaField != null)
retval.append(mediaField.encode());
if (informationField != null)
retval.append(informationField.encode());
if (connectionField != null)
retval.append(connectionField.encode());
if (bandwidthFields != null) {
for (int i = 0; i < bandwidthFields.size(); i++) {
BandwidthField bandwidthField =
(BandwidthField) bandwidthFields.elementAt(i);
retval.append(bandwidthField.encode());
}
}
if (keyField != null)
retval.append(keyField.encode());
if (attributeFields != null) {
for (int i = 0; i < attributeFields.size(); i++)
retval.append(((SDPField)attributeFields.elementAt(i)).
encode());
}
return retval.toString();
|
public java.lang.String | getAttribute(java.lang.String name)Returns the value of the specified attribute.
if (name != null) {
for (int i = 0; i < this.attributeFields.size(); i++) {
AttributeField af = (AttributeField)
this.attributeFields.elementAt(i);
if (name.equals(af.getAttribute().getName()))
return (String) af.getAttribute().getValue();
}
return null;
} else throw new NullPointerException("null arg!");
|
public java.util.Vector | getAttributeFields()Gets the attributes filed.
return attributeFields;
|
public java.util.Vector | getAttributes(boolean create)Returns the set of attributes for this Description as a
Vector of Attribute objects in the order they were parsed.
return attributeFields;
|
public int | getBandwidth(java.lang.String name)Returns the integer value of the specified bandwidth name.
if (name == null)
throw new NullPointerException("null parameter");
if (bandwidthFields == null)
return -1;
else {
for (int i = 0; i < bandwidthFields.size(); i++) {
BandwidthField bandwidthField = (BandwidthField)
bandwidthFields.elementAt(i);
String type = bandwidthField.getBwtype();
if (type != null &&
type.equals(name))
return bandwidthField.getBandwidth();
}
return -1;
}
|
public java.util.Vector | getBandwidths(boolean create)Returns the Bandwidth of the specified type.
return bandwidthFields;
|
public ConnectionField | getConnection()Returns the connection information associated with this object. This may
be null for SessionDescriptions if all Media
objects have a connection object and may be null for Media
objects if the corresponding session connection is non-null.
return connectionField;
|
public ConnectionField | getConnectionField()Gets the connection filed
return connectionField;
|
public InformationField | getInfo()Returns value of the info field (i=) of this object.
return informationField;
|
public InformationField | getInformationField()Gets the information field.
return informationField;
|
public KeyField | getKey()Returns the key data.
return keyField;
|
public KeyField | getKeyField()Gets the key field.
return keyField;
|
public MediaField | getMedia()Returns the Media field of the description.
return mediaField;
|
public MediaField | getMediaField()Gets the media field
return mediaField;
|
public java.util.Vector | getMimeParameters()Returns a Vector containing a string of parameters for each of
the codecs in this description.
A parameter string is computed for each codec.
The parameter string is computed in the following fashion.
The rate is extracted from the rtpmap or static data.
The number of channels is extracted from the rtpmap or static data.
The ptime is extracted from the ptime attribute.
The maxptime is extracted from the maxptime attribute.
Any additional parameters are extracted from the ftmp attribute.
String rate = getAttribute("rate");
String ptime = getAttribute("ptime");
String maxptime = getAttribute("maxptime");
String ftmp = getAttribute("ftmp");
Vector result = new Vector();
result.addElement(rate);
result.addElement(ptime);
result.addElement(maxptime);
result.addElement(ftmp);
return result;
|
public java.util.Vector | getMimeTypes()Returns a Vector containing a string indicating the MIME type
for each of the codecs in this description.
A MIME value is computed for each codec in the media description.
The MIME type is computed in the following fashion:
The type is the mediaType from the media field.
The subType is determined by the protocol.
The result is computed as the string of the form:
type + '/' + subType
The subType portion is computed in the following fashion.
RTP/AVP
the subType is returned as the codec name. This will either
be extracted from the rtpmap attribute or computed.
other
the protocol is returned as the subType.
If the protocol is RTP/AVP and the rtpmap attribute for a
codec is absent, then the codec name will be computed in the
following fashion.
String indexed in table SdpConstants.avpTypeNames
if the value is an int greater than or equal to 0 and less than
AVP_DEFINED_STATIC_MAX, and has been assigned a
value.
SdpConstant.RESERVED
if the value is an int greater than or equal to 0 and less than
AVP_DEFINED_STATIC_MAX, and has not been
assigned a value.
SdpConstant.UNASSIGNED
An int greater than or equal to AVP_DEFINED_STATIC_MAX
and less than
AVP_DYNAMIC_MIN - currently
unassigned.
SdpConstant.DYNAMIC
Any int less than 0 or greater than or equal to AVP_DYNAMIC_MIN
MediaField mediaField = (MediaField)getMedia();
String type = mediaField.getMediaType();
String protocol = mediaField.getProtocol();
Vector formats = mediaField.getMediaFormats(false);
Vector v = new Vector();
for (int i = 0; i < formats.size(); i++) {
String result = null;
if (protocol.equals("RTP/AVP")) {
if (getAttribute(SdpConstants.RTPMAP) != null)
result = type + "/"+protocol;
else {
}
} else
result = type + "/" + protocol;
v.addElement(result);
}
return v;
|
protected boolean | hasAttribute(java.lang.String name)Checks if named attribute exists.
for (int i = 0; i < this.attributeFields.size(); i++) {
AttributeField af =
(AttributeField) this.attributeFields.elementAt(i);
if (af.getAttribute().getName().equals(name))
return true;
}
return false;
|
public void | removeAttribute(java.lang.String name)Removes the attribute specified by the value parameter.
if (name == null)
throw new NullPointerException("null arg!");
if (name != null) {
int i = 0;
for (i = 0; i < this.attributeFields.size(); i++) {
AttributeField af = (AttributeField)
this.attributeFields.elementAt(i);
if (af.getAttribute().getName().equals(name)) break;
}
if (i < attributeFields.size())
attributeFields.removeElementAt(i);
}
|
public void | removeBandwidth(java.lang.String name)Removes the specified bandwidth type.
if (name == null) {
throw new NullPointerException("null bandwidth type");
} else {
int i = 0;
for (i = 0; i < bandwidthFields.size(); i++) {
BandwidthField bandwidthField = (BandwidthField)
bandwidthFields.elementAt(i);
String type = bandwidthField.getBwtype();
if (type != null &&
type.equals(name))
break;
}
if (i < bandwidthFields.size())
bandwidthFields.removeElementAt(i);
}
|
public void | setAttribute(java.lang.String name, java.lang.String value)Sets the value of the specified attribute
if (name == null)
throw new SdpException("The parameters are null");
else {
int i = 0;
for (i = 0; i < this.attributeFields.size(); i++) {
AttributeField af = (AttributeField)
this.attributeFields.elementAt(i);
if (af.getAttribute().getName().equals(name)) {
NameValue nv = af.getAttribute();
nv.setValue(value);
break;
}
}
if (i == this.attributeFields.size()) {
AttributeField af = new AttributeField();
NameValue nv = new NameValue(name, value);
af.setAttribute(nv);
this.attributeFields.addElement(af);
}
}
|
public void | setAttributeFields(java.util.Vector a)Sets the attribute fields member.
attributeFields = a;
|
public void | setAttributes(java.util.Vector attributes)Adds the specified Attribute to this Description object.
this.attributeFields = attributes;
|
public void | setBandwidth(java.lang.String name, int value)Sets the value of the specified bandwidth type.
if (name == null)
throw new SdpException("The name is null");
else {
for (int i = 0; i < bandwidthFields.size(); i++) {
BandwidthField bandwidthField = (BandwidthField)
bandwidthFields.elementAt(i);
String type = bandwidthField.getBwtype();
if (type != null &&
type.equals(name))
bandwidthField.setBandwidth(value);
}
}
|
public void | setBandwidths(java.util.Vector bandwidths)Sets the value of the Bandwidth with the specified type.
if (bandwidths == null)
throw new SdpException("The vector bandwidths is null");
this.bandwidthFields = bandwidths;
|
public void | setConnection(ConnectionField conn)Sets the connection data for this entity.
if (conn == null)
throw new SdpException("The conn is null");
connectionField = conn;
|
public void | setConnectionField(ConnectionField c)Sets the connection field member.
connectionField = c;
|
public void | setInfo(InformationField i)Sets the i= field of this object.
if (i == null)
throw new SdpException("The info is null");
this.informationField = i;
|
public void | setInformationField(InformationField i)Sets the information field member.
informationField = i;
|
public void | setKey(KeyField key)Sets encryption key information. This consists of a method and an
encryption key included inline.
if (key == null)
throw new SdpException("The key is null");
setKeyField(key);
|
public void | setKeyField(KeyField k)Sets the key field member.
keyField = k;
|
public void | setMedia(MediaField media)Sets the Media field of the description.
if (media == null)
throw new SdpException("The media is null");
mediaField = media;
|
public void | setMediaField(MediaField m)Sets the media field member.
mediaField = m;
|
public java.lang.String | toString()Returns encoded text.
return this.encode();
|