NIST-SIP: The Reference Implementation for JAIN-SIP 1.2

gov.nist.javax.sdp
Class MediaDescriptionImpl

java.lang.Object
  extended by gov.nist.javax.sdp.MediaDescriptionImpl
All Implemented Interfaces:
Serializable, Cloneable, MediaDescription

public class MediaDescriptionImpl
extends Object
implements MediaDescription

Fieldementation of Media Description interface.

Version:
JSR141-PUBLIC-REVIEW (subject to change).
Author:
Olivier Deruelle , M. Ranganathan
See Also:
Serialized Form

Constructor Summary
MediaDescriptionImpl()
           
 
Method Summary
 void addAttribute(AttributeField af)
          Add Media Attribute based on an AttributeField value issued by Miguel Freitas (IT) PTInovacao
 void addBandwidthField(BandwidthField b)
          Set the bandwidthField member
 void addDynamicPayloads(Vector payloadNames, Vector payloadValues)
          Adds dynamic media types to the description.
 String encode()
          Encode to a canonical form.
 String getAttribute(String name)
          Returns the value of the specified attribute.
 Vector getAttributeFields()
           
 Vector getAttributes(boolean create)
          Returns the set of attributes for this Description as a Vector of Attribute objects in the order they were parsed.
 int getBandwidth(String name)
          Returns the integer value of the specified bandwidth name.
 Vector getBandwidths(boolean create)
          Returns the Bandwidth of the specified type.
 Connection getConnection()
          Returns the connection information associated with this object.
 ConnectionField getConnectionField()
           
 Info getInfo()
          Returns value of the info field (i=) of this object.
 InformationField getInformationField()
           
 Key getKey()
          Returns the key data.
 KeyField getKeyField()
           
 Media getMedia()
          Return the Media field of the description.
 MediaField getMediaField()
           
 Vector getMimeParameters()
          Returns a Vector containing a string of parameters for each of the codecs in this description.
 Vector getMimeTypes()
          Returns a Vector containing a string indicating the MIME type for each of the codecs in this description.
 Vector getPreconditionFields()
           Get attribute fields of segmented precondition issued by Miguel Freitas (IT) PTInovacao
 void removeAttribute(String name)
          Removes the attribute specified by the value parameter.
 void removeBandwidth(String name)
          Removes the specified bandwidth type.
 void setAttribute(String name, String value)
          Sets the value of the specified attribute
 void setAttributeFields(Vector a)
          Set the attributeFields member
 void setAttributes(Vector attributes)
          Adds the specified Attribute to this Description object.
 void setBandwidth(String name, int value)
          Sets the value of the specified bandwidth type.
 void setBandwidths(Vector bandwidths)
          set the value of the Bandwidth with the specified type
 void setConnection(Connection conn)
          Set the connection data for this entity
 void setConnectionField(ConnectionField c)
          Set the connectionField member
 void setDuplexity(String duplexity)
           
 void setInfo(Info i)
          Sets the i= field of this object.
 void setInformationField(InformationField i)
          Set the informationField member
 void setKey(Key key)
          Sets encryption key information.
 void setKeyField(KeyField k)
          Set the keyField member
 void setMedia(Media media)
          Set the Media field of the description.
 void setMediaField(MediaField m)
          Set the mediaField member
 void setPreconditionFields(Vector precondition)
           Set the Media Description's Precondition Fields issued by Miguel Freitas (IT) PTInovacao
 void setPreconditions(PreconditionFields precondition)
           Set the Media Description's Precondition Fields issued by Miguel Freitas (IT) PTInovacao
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MediaDescriptionImpl

public MediaDescriptionImpl()
Method Detail

encode

public String encode()
Encode to a canonical form.

Since:
v1.0

toString

public String toString()
Overrides:
toString in class Object

getMediaField

public MediaField getMediaField()

getInformationField

public InformationField getInformationField()

getConnectionField

public ConnectionField getConnectionField()

getKeyField

public KeyField getKeyField()

getAttributeFields

public Vector getAttributeFields()

setMediaField

public void setMediaField(MediaField m)
Set the mediaField member


setInformationField

public void setInformationField(InformationField i)
Set the informationField member


setConnectionField

public void setConnectionField(ConnectionField c)
Set the connectionField member


addBandwidthField

public void addBandwidthField(BandwidthField b)
Set the bandwidthField member


setKeyField

public void setKeyField(KeyField k)
Set the keyField member


setAttributeFields

public void setAttributeFields(Vector a)
Set the attributeFields member


getMedia

public Media getMedia()
Return the Media field of the description.

Specified by:
getMedia in interface MediaDescription
Returns:
the Media field of the description.

addAttribute

public void addAttribute(AttributeField af)
Description copied from interface: MediaDescription

Add Media Attribute based on an AttributeField value

issued by Miguel Freitas (IT) PTInovacao

Specified by:
addAttribute in interface MediaDescription
Parameters:
af - AttributeField

setMedia

public void setMedia(Media media)
              throws SdpException
Set the Media field of the description.

Specified by:
setMedia in interface MediaDescription
Parameters:
media - to set
Throws:
SdpException - if the media field is null

getInfo

public Info getInfo()
Returns value of the info field (i=) of this object.

Specified by:
getInfo in interface MediaDescription
Returns:
value of the info field (i=) of this object.

setInfo

public void setInfo(Info i)
             throws SdpException
Sets the i= field of this object.

Specified by:
setInfo in interface MediaDescription
Parameters:
i - to set
Throws:
SdpException - if the info is null

getConnection

public Connection 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.

Specified by:
getConnection in interface MediaDescription
Returns:
connection

setConnection

public void setConnection(Connection conn)
                   throws SdpException
Set the connection data for this entity

Specified by:
setConnection in interface MediaDescription
Parameters:
conn - to set
Throws:
SdpException - if the connexion is null

getBandwidths

public Vector getBandwidths(boolean create)
Returns the Bandwidth of the specified type.

Specified by:
getBandwidths in interface MediaDescription
Parameters:
create - type of the Bandwidth to return
Returns:
the Bandwidth or null if undefined

setBandwidths

public void setBandwidths(Vector bandwidths)
                   throws SdpException
set the value of the Bandwidth with the specified type

Specified by:
setBandwidths in interface MediaDescription
Parameters:
bandwidths - type of the Bandwidth object whose value is requested
Throws:
SdpException - if vector is null

getBandwidth

public int getBandwidth(String name)
                 throws SdpParseException
Returns the integer value of the specified bandwidth name.

Specified by:
getBandwidth in interface MediaDescription
Parameters:
name - the name of the bandwidth type.
Returns:
the value of the named bandwidth
Throws:
SdpParseException

setBandwidth

public void setBandwidth(String name,
                         int value)
                  throws SdpException
Sets the value of the specified bandwidth type.

Specified by:
setBandwidth in interface MediaDescription
Parameters:
name - the name of the bandwidth type.
value - the value of the named bandwidth type.
Throws:
SdpException - if the name is null

removeBandwidth

public void removeBandwidth(String name)
Removes the specified bandwidth type.

Specified by:
removeBandwidth in interface MediaDescription
Parameters:
name - the name of the bandwidth type.

getKey

public Key getKey()
Returns the key data.

Specified by:
getKey in interface MediaDescription
Returns:
the key data.

setKey

public void setKey(Key key)
            throws SdpException
Sets encryption key information. This consists of a method and an encryption key included inline.

Specified by:
setKey in interface MediaDescription
Parameters:
key - the encryption key data; depending on method may be null
Throws:
SdpException - if the key is null

getAttributes

public Vector getAttributes(boolean create)
Returns the set of attributes for this Description as a Vector of Attribute objects in the order they were parsed.

Specified by:
getAttributes in interface MediaDescription
Parameters:
create - specifies whether to return null or a new empty Vector in case no attributes exists for this Description
Returns:
attributes for this Description

setAttributes

public void setAttributes(Vector attributes)
                   throws SdpException
Adds the specified Attribute to this Description object.

Specified by:
setAttributes in interface MediaDescription
Parameters:
attributes - -- the attribute to add
Throws:
SdpException - -- if the attributes is null

getAttribute

public String getAttribute(String name)
                    throws SdpParseException
Returns the value of the specified attribute.

Specified by:
getAttribute in interface MediaDescription
Parameters:
name - the name of the attribute.
Returns:
the value of the named attribute
Throws:
SdpParseException

setAttribute

public void setAttribute(String name,
                         String value)
                  throws SdpException
Sets the value of the specified attribute

Specified by:
setAttribute in interface MediaDescription
Parameters:
name - the name of the attribute.
value - the value of the named attribute.
Throws:
SdpException - if the parameters are null

setDuplexity

public void setDuplexity(String duplexity)

removeAttribute

public void removeAttribute(String name)
Removes the attribute specified by the value parameter.

Specified by:
removeAttribute in interface MediaDescription
Parameters:
name - the name of the attribute.

getMimeTypes

public Vector getMimeTypes()
                    throws SdpException
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

Specified by:
getMimeTypes in interface MediaDescription
Returns:
a Vector containing a string indicating the MIME type for each of the codecs in this description
Throws:
SdpException - if there is a problem extracting the parameters.

getMimeParameters

public Vector getMimeParameters()
                         throws SdpException
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.

Specified by:
getMimeParameters in interface MediaDescription
Returns:
a Vector containing a string of parameters for each of the codecs in this description.
Throws:
SdpException - if there is a problem extracting the parameters.

addDynamicPayloads

public void addDynamicPayloads(Vector payloadNames,
                               Vector payloadValues)
                        throws SdpException
Adds dynamic media types to the description.

Specified by:
addDynamicPayloads in interface MediaDescription
Parameters:
payloadNames - a Vector of String - each one the name of a dynamic payload to be added (usually an integer larger than SdpConstants.AVP_DYNAMIC_MIN).
payloadValues - a Vector of String - each contains the value describing the correlated dynamic payloads to be added
Throws:
SdpException - if either vector is null or empty. if the vector sizes are unequal.

setPreconditionFields

public void setPreconditionFields(Vector precondition)
                           throws SdpException

Set the Media Description's Precondition Fields

issued by Miguel Freitas (IT) PTInovacao

Specified by:
setPreconditionFields in interface MediaDescription
Parameters:
precondition - Vector containing PreconditionFields
Throws:
SdpException

setPreconditions

public void setPreconditions(PreconditionFields precondition)

Set the Media Description's Precondition Fields

issued by Miguel Freitas (IT) PTInovacao

Specified by:
setPreconditions in interface MediaDescription
Parameters:
precondition - PreconditionFields parameter

getPreconditionFields

public Vector getPreconditionFields()

Get attribute fields of segmented precondition

issued by Miguel Freitas (IT) PTInovacao

Specified by:
getPreconditionFields in interface MediaDescription
Returns:
Vector of attribute fields (segmented precondition)

NIST-SIP: The Reference Implementation for JAIN-SIP 1.2

A product of the NIST/ITL Advanced Networking Technologies Division.
See conditions of use.
Submit a bug report or feature request.