Exemplo n.º 1
0
  /**
   * Returns SessionName object with the specified name.
   *
   * @param name the string containing the name of the session.
   * @return SessionName
   */
  public SessionName createSessionName(String name) {
    SessionNameField sessionNameImpl = new SessionNameField();
    try {

      sessionNameImpl.setValue(name);

    } catch (SdpException s) {
      s.printStackTrace();
    }
    return sessionNameImpl;
  }
Exemplo n.º 2
0
  /**
   * Returns EMail object with the specified value.
   *
   * @param value the string containing the description.
   * @return EMail
   */
  public EMail createEMail(String value) {
    EmailField emailImpl = new EmailField();
    try {

      emailImpl.setValue(value);

    } catch (SdpException s) {
      s.printStackTrace();
    }
    return emailImpl;
  }
Exemplo n.º 3
0
  /**
   * Returns Phone object with the specified value.
   *
   * @param value the string containing the description.
   * @return Phone
   */
  public Phone createPhone(String value) {
    PhoneField phoneImpl = new PhoneField();
    try {

      phoneImpl.setValue(value);

    } catch (SdpException s) {
      s.printStackTrace();
    }
    return phoneImpl;
  }
Exemplo n.º 4
0
  /**
   * Returns Info object with the specified value.
   *
   * @param value the string containing the description.
   * @return Info
   */
  public Info createInfo(String value) {
    InformationField infoImpl = new InformationField();
    try {

      infoImpl.setValue(value);

    } catch (SdpException s) {
      s.printStackTrace();
    }
    return infoImpl;
  }
Exemplo n.º 5
0
  /**
   * Constructs a timezone adjustment record.
   *
   * @param d the Date at which the adjustment is going to take place.
   * @param offset the adjustment in number of seconds relative to the start time of the
   *     SessionDescription with which this object is associated.
   * @return TimeZoneAdjustment
   */
  public TimeZoneAdjustment createTimeZoneAdjustment(Date d, int offset) {
    ZoneField timeZoneAdjustmentImpl = new ZoneField();
    try {

      Hashtable map = new Hashtable();
      map.put(d, new Integer(offset));
      timeZoneAdjustmentImpl.setZoneAdjustments(map);
    } catch (SdpException s) {
      s.printStackTrace();
    }
    return timeZoneAdjustmentImpl;
  }
Exemplo n.º 6
0
  /**
   * Returns Version object with the specified values.
   *
   * @param value the version number.
   * @return Version
   */
  public Version createVersion(int value) {
    ProtoVersionField protoVersionField = new ProtoVersionField();
    try {

      protoVersionField.setVersion(value);

    } catch (SdpException s) {
      s.printStackTrace();
      return null;
    }
    return protoVersionField;
  }
Exemplo n.º 7
0
  /**
   * Returns Attribute object with the specified values.
   *
   * @param name the namee of the attribute
   * @param value the value of the attribute
   * @return Attribute
   */
  public Attribute createAttribute(String name, String value) {
    AttributeField attributeImpl = new AttributeField();
    try {

      attributeImpl.setName(name);
      attributeImpl.setValue(value);

    } catch (SdpException s) {
      s.printStackTrace();
    }
    return attributeImpl;
  }
Exemplo n.º 8
0
  /**
   * Returns Bandwidth object with the specified values.
   *
   * @param modifier modifier - the bandwidth type
   * @param value the bandwidth value measured in kilobits per second
   * @return bandwidth
   */
  public BandWidth createBandwidth(String modifier, int value) {
    BandwidthField bandWidthImpl = new BandwidthField();
    try {

      bandWidthImpl.setType(modifier);
      bandWidthImpl.setValue(value);

    } catch (SdpException s) {
      s.printStackTrace();
    }
    return bandWidthImpl;
  }
Exemplo n.º 9
0
  /**
   * Returns a RepeatTime object with the specified interval, duration, and time offsets.
   *
   * @param repeatInterval the "repeat interval" in seconds
   * @param activeDuration the "active duration" in seconds
   * @param offsets the list of offsets relative to the start time of the Time object with which the
   *     returned RepeatTime will be associated
   * @return RepeatTime
   */
  public RepeatTime createRepeatTime(int repeatInterval, int activeDuration, int[] offsets) {
    RepeatField repeatTimeField = new RepeatField();
    try {

      repeatTimeField.setRepeatInterval(repeatInterval);
      repeatTimeField.setActiveDuration(activeDuration);
      repeatTimeField.setOffsetArray(offsets);

    } catch (SdpException s) {
      s.printStackTrace();
    }
    return repeatTimeField;
  }
Exemplo n.º 10
0
  /**
   * Returns Key object with the specified value.
   *
   * @param method the string containing the method type.
   * @param key the key to set
   * @return Key
   */
  public Key createKey(String method, String key) {
    KeyField keyImpl = new KeyField();
    try {

      keyImpl.setMethod(method);
      keyImpl.setKey(key);

    } catch (SdpException s) {
      s.printStackTrace();
      return null;
    }
    return keyImpl;
  }
Exemplo n.º 11
0
  /**
   * Returns MediaDescription object with the specified properties. The returned object will respond
   * to Media.getMediaFormats(boolean) with a Vector of String objects specified by the 'formats
   * argument.
   *
   * @param media the media type, eg "audio"
   * @param port port number on which to receive media
   * @param numPorts number of ports used for this media stream
   * @param transport transport type, eg "RTP/AVP"
   * @param formats list of formats which should be specified by the returned MediaDescription
   * @return MediaDescription
   */
  public MediaDescription createMediaDescription(
      String media, int port, int numPorts, String transport, String[] formats) {
    MediaDescriptionImpl mediaDescriptionImpl = new MediaDescriptionImpl();
    try {

      MediaField mediaImpl = new MediaField();
      mediaImpl.setMediaType(media);
      mediaImpl.setMediaPort(port);
      mediaImpl.setPortCount(numPorts);
      mediaImpl.setProtocol(transport);

      Vector formatsV = new Vector(formats.length);
      for (int i = 0; i < formats.length; i++) formatsV.add(formats[i]);
      mediaImpl.setMediaFormats(formatsV);
      mediaDescriptionImpl.setMedia(mediaImpl);
    } catch (SdpException s) {
      s.printStackTrace();
    }
    return mediaDescriptionImpl;
  }