001: /*
002: * MediaDescription.java
003: *
004: * Created on December 19, 2001, 11:17 AM
005: */
006:
007: package javax.sdp;
008:
009: import java.io.*;
010: import java.util.*;
011:
012: // issued by Miguel Freitas - work-around
013: import gov.nist.javax.sdp.fields.PreconditionFields;
014: import gov.nist.javax.sdp.fields.AttributeField;
015:
016: // end //
017:
018: /** A MediaDescription identifies the set of medias that may be received on a specific port or set of ports. It includes:
019: *
020: * a mediaType (e.g., audio, video, etc.)
021: * a port number (or set of ports)
022: * a protocol to be used (e.g., RTP/AVP)
023: * a set of media formats which correspond to Attributes associated with the media description.
024: *
025: * The following is an example
026: *
027: * m=audio 60000 RTP/AVP 0
028: * a=rtpmap:0 PCMU/8000
029: *
030: * This example identifies that the client can receive audio on port 60000 in format 0 which corresponds to PCMU/8000.
031: *
032: * Please refer to IETF RFC 2327 for a description of SDP.
033: *
034: * @author deruelle
035: * @version 1.0
036: */
037: public interface MediaDescription extends Serializable, Cloneable {
038:
039: /** Return the Media field of the description.
040: * @return the Media field of the description.
041: */
042: public Media getMedia();
043:
044: /** Set the Media field of the description.
045: * @param media to set
046: * @throws SdpException if the media field is null
047: */
048: public void setMedia(Media media) throws SdpException;
049:
050: /** Returns value of the info field (i=) of this object.
051: * @return value of the info field (i=) of this object.
052: */
053: public Info getInfo();
054:
055: /** Sets the i= field of this object.
056: * @param i to set
057: * @throws SdpException if the info is null
058: */
059: public void setInfo(Info i) throws SdpException;
060:
061: /** Returns the connection information associated with this object. This may be null for SessionDescriptions if all Media
062: * objects have a connection object and may be null for Media objects if the corresponding session connection is non-null.
063: * @return connection
064: */
065: public Connection getConnection();
066:
067: /** Set the connection data for this entity
068: * @param conn to set
069: * @throws SdpException if the connexion is null
070: */
071: public void setConnection(Connection conn) throws SdpException;
072:
073: /** Returns the Bandwidth of the specified type.
074: * @param create type of the Bandwidth to return
075: * @return the Bandwidth or null if undefined
076: */
077: public Vector getBandwidths(boolean create);
078:
079: /** set the value of the Bandwidth with the specified type
080: * @param bandwidths type of the Bandwidth object whose value is requested
081: * @throws SdpException if vector is null
082: */
083: public void setBandwidths(Vector bandwidths) throws SdpException;
084:
085: /** Returns the integer value of the specified bandwidth name.
086: * @param name the name of the bandwidth type.
087: * @throws SdpParseException
088: * @return the value of the named bandwidth
089: */
090: public int getBandwidth(String name) throws SdpParseException;
091:
092: /** Sets the value of the specified bandwidth type.
093: * @param name the name of the bandwidth type.
094: * @param value the value of the named bandwidth type.
095: * @throws SdpException if the name is null
096: */
097: public void setBandwidth(String name, int value)
098: throws SdpException;
099:
100: /** Removes the specified bandwidth type.
101: * @param name the name of the bandwidth type.
102: */
103: public void removeBandwidth(String name);
104:
105: /** Returns the key data.
106: * @return the key data.
107: */
108: public Key getKey();
109:
110: /** Sets encryption key information. This consists of a method and an encryption key included inline.
111: * @param key the encryption key data; depending on method may be null
112: * @throws SdpException if the key is null
113: */
114: public void setKey(Key key) throws SdpException;
115:
116: /** Returns the set of attributes for this Description as a Vector of Attribute objects in the order they were parsed.
117: * @param create specifies whether to return null or a new empty Vector in case no attributes exists for this Description
118: * @return attributes for this Description
119: */
120: public Vector getAttributes(boolean create);
121:
122: /** Adds the specified Attribute to this Description object.
123: * @param Attributes the attribute to add
124: * @throws SdpException if the attribute is null
125: */
126: public void setAttributes(Vector Attributes) throws SdpException;
127:
128: /** Returns the value of the specified attribute.
129: * @param name the name of the attribute.
130: * @throws SdpParseException
131: * @return the value of the named attribute
132: */
133: public String getAttribute(String name) throws SdpParseException;
134:
135: /** Sets the value of the specified attribute
136: * @param name the name of the attribute.
137: * @param value the value of the named attribute.
138: * @throws SdpException if the parameters are null
139: */
140: public void setAttribute(String name, String value)
141: throws SdpException;
142:
143: /** Removes the attribute specified by the value parameter.
144: * @param name the name of the attribute.
145: */
146: public void removeAttribute(String name);
147:
148: /** Returns a Vector containing a string indicating the MIME type for each of the codecs in this description.
149: *
150: * A MIME value is computed for each codec in the media description.
151: *
152: * The MIME type is computed in the following fashion:
153: * The type is the mediaType from the media field.
154: * The subType is determined by the protocol.
155: *
156: * The result is computed as the string of the form:
157: *
158: * type + '/' + subType
159: *
160: * The subType portion is computed in the following fashion.
161: * RTP/AVP
162: * the subType is returned as the codec name. This will either be extracted from the rtpmap attribute or computed.
163: * other
164: * the protocol is returned as the subType.
165: *
166: * If the protocol is RTP/AVP and the rtpmap attribute for a codec is absent, then the codec name will be computed in the
167: * following fashion.
168: * String indexed in table SdpConstants.avpTypeNames
169: * if the value is an int greater than or equal to 0 and less than AVP_DEFINED_STATIC_MAX, and has been assigned a
170: * value.
171: * SdpConstant.RESERVED
172: * if the value is an int greater than or equal to 0 and less than AVP_DEFINED_STATIC_MAX, and has not been
173: * assigned a value.
174: * SdpConstant.UNASSIGNED
175: * An int greater than or equal to AVP_DEFINED_STATIC_MAX and less than AVP_DYNAMIC_MIN - currently
176: * unassigned.
177: * SdpConstant.DYNAMIC
178: * Any int less than 0 or greater than or equal to AVP_DYNAMIC_MIN
179: * @throws SdpException if there is a problem extracting the parameters.
180: * @return a Vector containing a string indicating the MIME type for each of the codecs in this description
181: */
182: public Vector getMimeTypes() throws SdpException;
183:
184: /** Returns a Vector containing a string of parameters for each of the codecs in this description.
185: *
186: * A parameter string is computed for each codec.
187: *
188: * The parameter string is computed in the following fashion.
189: *
190: * The rate is extracted from the rtpmap or static data.
191: *
192: * The number of channels is extracted from the rtpmap or static data.
193: *
194: * The ptime is extracted from the ptime attribute.
195: *
196: * The maxptime is extracted from the maxptime attribute.
197: *
198: * Any additional parameters are extracted from the ftmp attribute.
199: * @throws SdpException if there is a problem extracting the parameters.
200: * @return a Vector containing a string of parameters for each of the codecs in this description.
201: */
202: public Vector getMimeParameters() throws SdpException;
203:
204: /** Adds dynamic media types to the description.
205: * @param payloadNames a Vector of String - each one the name of a dynamic payload to be added (usually an integer larger
206: * than SdpConstants.AVP_DYNAMIC_MIN).
207: * @param payloadValues a Vector of String - each contains the value describing the correlated dynamic payloads to be added
208: * @throws SdpException if either vector is null or empty.
209: * if the vector sizes are unequal.
210: */
211: public void addDynamicPayloads(Vector payloadNames,
212: Vector payloadValues) throws SdpException;
213:
214: //////////////////////////////////////////////
215: // changes made by PT-INOVACAO
216: //////////////////////////////////////////////
217:
218: /**
219: * <p>Set PreconditionFields for the Media Description</p>
220: *
221: * issued by Miguel Freitas (IT) PTInovacao
222: * @param segPrecondition Vector with values to ser
223: * @throws SdpException
224: */
225: public void setPreconditionFields(Vector segPrecondition)
226: throws SdpException;
227:
228: /**
229: * <p>Set PreconditionFields for the Media Description</p>
230: *
231: * issued by Miguel Freitas (IT) PTInovacao
232: * @param segPrecondition PreconditionFields with values to set
233: */
234: public void setPreconditions(PreconditionFields segPrecondition);
235:
236: /**
237: * <p>Get all Precondition Fields in the Media Descritpion</p>
238: *
239: * issued by Miguel Freitas (IT) PTInovacao
240: * @return Vector precondition fields
241: */
242: public Vector getPreconditionFields();
243:
244: /**
245: * <p>Add Media Attribute based on an AttributeField value</p>
246: *
247: * issued by Miguel Freitas (IT) PTInovacao
248: * @param at AttributeField
249: */
250: public void addAttribute(AttributeField at);
251:
252: }
|