org.lastbamboo.common.sdp.fields
Class MediaField

java.lang.Object
  extended by org.lastbamboo.common.sdp.GenericObject
      extended by org.lastbamboo.common.sdp.fields.SDPObject
          extended by org.lastbamboo.common.sdp.fields.SDPField
              extended by org.lastbamboo.common.sdp.fields.MediaField
All Implemented Interfaces:
Serializable, Cloneable, Field, Media, SDPFieldNames

public class MediaField
extends SDPField
implements Media

Media field SDP header.

Version:
JSR141-PUBLIC-REVIEW (subject to change).
Author:
Olivier Deruelle , M. Ranganathan
This code is in the public domain.
See Also:
Serialized Form

Field Summary
protected  Vector formats
           
protected  String media
           
protected  int nports
           
protected  int port
           
protected  String proto
           
 
Fields inherited from class org.lastbamboo.common.sdp.fields.SDPField
fieldName
 
Fields inherited from class org.lastbamboo.common.sdp.GenericObject
AND, AT, COLON, COMMA, DOT, DOUBLE_QUOTE, EQUALS, GREATER_THAN, HT, immutableClasses, immutableClassNames, indentation, LESS_THAN, LPAREN, matchExpression, NEWLINE, PERCENT, POUND, QUESTION, QUOTE, RETURN, RPAREN, SEMICOLON, SLASH, SP, STAR, stringRepresentation
 
Fields inherited from interface org.lastbamboo.common.sdp.fields.SDPFieldNames
ATTRIBUTE_FIELD, BANDWIDTH_FIELD, CONNECTION_FIELD, EMAIL_FIELD, INFORMATION_FIELD, KEY_FIELD, MEDIA_FIELD, ORIGIN_FIELD, PHONE_FIELD, PROTO_VERSION_FIELD, REPEAT_FIELD, SESSION_NAME_FIELD, TIME_FIELD, URI_FIELD, ZONE_FIELD
 
Constructor Summary
MediaField()
           
 
Method Summary
 Object clone()
          Clones this object.
 String encode()
          Get the string encoded version of this object
 Vector getFormats()
           
 String getMedia()
           
 Vector getMediaFormats(boolean create)
          Returns an Vector of the media formats supported by this description.
 int getMediaPort()
          Returns the port of the media defined by this description
 String getMediaType()
          Returns the type (audio,video etc) of the media defined by this description.
 int getNports()
           
 int getPort()
           
 int getPortCount()
          Returns the number of ports associated with this media description
 String getProto()
           
 String getProtocol()
          Returns the protocol over which this media should be transmitted.
 void setFormats(Vector formats)
          Set the fmt member
 void setMedia(String m)
          Set the media member
 void setMediaFormats(Vector mediaFormats)
          Adds a media format to the media description.
 void setMediaPort(int port)
          Sets the port of the media defined by this description
 void setMediaType(String mediaType)
          Sets the type (audio,video etc) of the media defined by this description.
 void setNports(int n)
          Set the nports member
 void setPort(int p)
          Set the port member
 void setPortCount(int portCount)
          Sets the number of ports associated with this media description.
 void setProto(String p)
          Set the proto member
 void setProtocol(String protocol)
          Sets the protocol over which this media should be transmitted.
 
Methods inherited from class org.lastbamboo.common.sdp.fields.SDPField
getFieldName, getTypeChar, toString
 
Methods inherited from class org.lastbamboo.common.sdp.fields.SDPObject
dbgPrint, debugDump, equals, getStringRepresentation, initSprint, match, merge, replace, replace, replace, replace, sprint
 
Methods inherited from class org.lastbamboo.common.sdp.GenericObject
Assert, dbgPrint, dbgPrint, debugDump, getIndentation, getMatcher, isMySubclass, makeClone, setMatcher, sprint, sprint, sprint, sprint, sprint, sprint, sprint, sprint
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.lastbamboo.common.sdp.api.Media
toString
 
Methods inherited from interface org.lastbamboo.common.sdp.api.Field
getTypeChar
 

Field Detail

media

protected String media

port

protected int port

nports

protected int nports

proto

protected String proto

formats

protected Vector formats
Constructor Detail

MediaField

public MediaField()
Method Detail

getMedia

public String getMedia()

getPort

public int getPort()

getNports

public int getNports()

getProto

public String getProto()

getFormats

public Vector getFormats()

setMedia

public void setMedia(String m)
Set the media member


setPort

public void setPort(int p)
Set the port member


setNports

public void setNports(int n)
Set the nports member


setProto

public void setProto(String p)
Set the proto member


setFormats

public void setFormats(Vector formats)
Set the fmt member


getMediaType

public String getMediaType()
                    throws SdpParseException
Returns the type (audio,video etc) of the media defined by this description.

Specified by:
getMediaType in interface Media
Returns:
the string media type.
Throws:
SdpParseException

setMediaType

public void setMediaType(String mediaType)
                  throws SdpException
Sets the type (audio,video etc) of the media defined by this description.

Specified by:
setMediaType in interface Media
Parameters:
mediaType - to set
Throws:
SdpException - if mediaType is null

getMediaPort

public int getMediaPort()
                 throws SdpParseException
Returns the port of the media defined by this description

Specified by:
getMediaPort in interface Media
Returns:
the integer media port.
Throws:
SdpParseException

setMediaPort

public void setMediaPort(int port)
                  throws SdpException
Sets the port of the media defined by this description

Specified by:
setMediaPort in interface Media
Parameters:
port - to set
Throws:
SdpException

getPortCount

public int getPortCount()
                 throws SdpParseException
Returns the number of ports associated with this media description

Specified by:
getPortCount in interface Media
Returns:
the integer port count.
Throws:
SdpParseException

setPortCount

public void setPortCount(int portCount)
                  throws SdpException
Sets the number of ports associated with this media description.

Specified by:
setPortCount in interface Media
Parameters:
portCount - portCount - the integer port count.
Throws:
SdpException

getProtocol

public String getProtocol()
                   throws SdpParseException
Returns the protocol over which this media should be transmitted.

Specified by:
getProtocol in interface Media
Returns:
the String protocol, e.g. RTP/AVP.
Throws:
SdpParseException

setProtocol

public void setProtocol(String protocol)
                 throws SdpException
Sets the protocol over which this media should be transmitted.

Specified by:
setProtocol in interface Media
Parameters:
protocol - - the String protocol, e.g. RTP/AVP.
Throws:
SdpException - if the protocol is null

getMediaFormats

public Vector getMediaFormats(boolean create)
                       throws SdpParseException
Returns an Vector of the media formats supported by this description. Each element in this Vector will be an String value which matches one of the a=rtpmap: attribute fields of the media description.

Specified by:
getMediaFormats in interface Media
Parameters:
create - to set
Returns:
the Vector.
Throws:
SdpException
SdpParseException

setMediaFormats

public void setMediaFormats(Vector mediaFormats)
                     throws SdpException
Adds a media format to the media description. Each element in this Vector should be an String value which matches one of the a=rtpmap: attribute fields of the media description.

Specified by:
setMediaFormats in interface Media
Parameters:
mediaFormats - the format to add.
Throws:
SdpException - if the vector is null

encode

public String encode()
Get the string encoded version of this object

Specified by:
encode in class SDPField
Since:
v1.0

clone

public Object clone()
Description copied from class: GenericObject
Clones this object.

Specified by:
clone in interface Field
Overrides:
clone in class GenericObject
Returns:
a clone of this field.


Copyright © 2013 LittleShoot. All Rights Reserved.