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;
}

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 ; }
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 .
