Changeset 33
- Timestamp:
- 02/10/08 22:18:29
(6 months ago)
- Author:
- sip
- Message:
GUI mosaic positioning implemented
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r27 |
r33 |
|
| 36 | 36 | private Integer compType; |
|---|
| 37 | 37 | private Integer size; |
|---|
| | 38 | private Integer numSlots; |
|---|
| | 39 | private Integer slots[]; |
|---|
| 38 | 40 | private Profile profile; |
|---|
| 39 | 41 | |
|---|
| … | … | |
| 49 | 51 | this.compType = XmlRpcMcuClient.MOSAIC2x2; |
|---|
| 50 | 52 | this.size = XmlRpcMcuClient.CIF; |
|---|
| | 53 | this.numSlots = XmlRpcMcuClient.getMosaicNumSlots(compType); |
|---|
| | 54 | //Create conference slots |
|---|
| | 55 | this.slots = new Integer[numSlots]; |
|---|
| | 56 | //Empty |
|---|
| | 57 | for (int i=0;i<numSlots;i++) |
|---|
| | 58 | //All free |
|---|
| | 59 | slots[i] = 0; |
|---|
| 51 | 60 | //Create the participant map |
|---|
| 52 | 61 | participants = new HashMap<Integer,Participant>(); |
|---|
| … | … | |
| 58 | 67 | |
|---|
| 59 | 68 | public void setCompType(Integer compType) { |
|---|
| | 69 | //Save mosaic info |
|---|
| 60 | 70 | this.compType = compType; |
|---|
| | 71 | |
|---|
| | 72 | //Get new number of slots |
|---|
| | 73 | Integer n = XmlRpcMcuClient.getMosaicNumSlots(compType); |
|---|
| | 74 | //Create new slot array |
|---|
| | 75 | Integer[] s = new Integer[n]; |
|---|
| | 76 | |
|---|
| | 77 | //Copy the old ones into the new one |
|---|
| | 78 | for (int i=0; i<n && i<numSlots; i++) |
|---|
| | 79 | //Copy |
|---|
| | 80 | s[i] = slots[i]; |
|---|
| | 81 | |
|---|
| | 82 | //The rest are empty |
|---|
| | 83 | for (int i=numSlots;i<n;i++) |
|---|
| | 84 | //Free slots |
|---|
| | 85 | s[i] = 0; |
|---|
| | 86 | |
|---|
| | 87 | //Save new slots |
|---|
| | 88 | numSlots = n; |
|---|
| | 89 | slots = s; |
|---|
| 61 | 90 | } |
|---|
| 62 | 91 | |
|---|
| 63 | 92 | public Integer getSize() { |
|---|
| 64 | 93 | return size; |
|---|
| | 94 | } |
|---|
| | 95 | |
|---|
| | 96 | public Integer getNumSlots() { |
|---|
| | 97 | return numSlots; |
|---|
| 65 | 98 | } |
|---|
| 66 | 99 | |
|---|
| … | … | |
| 115 | 148 | participants.remove(id); |
|---|
| 116 | 149 | } |
|---|
| | 150 | |
|---|
| | 151 | public void setMosaicSlot(Integer num, Integer id) { |
|---|
| | 152 | //Set slot |
|---|
| | 153 | slots[num] = id; |
|---|
| | 154 | } |
|---|
| 117 | 155 | |
|---|
| 118 | | |
|---|
| 119 | | |
|---|
| 120 | | |
|---|
| | 156 | public Integer[] getMosaicSlots() { |
|---|
| | 157 | //Return a clone |
|---|
| | 158 | return slots.clone(); |
|---|
| | 159 | } |
|---|
| | 160 | |
|---|
| 121 | 161 | } |
|---|
| r27 |
r33 |
|
| 360 | 360 | conf.setProfile(profile); |
|---|
| 361 | 361 | } |
|---|
| 362 | | |
|---|
| | 362 | |
|---|
| | 363 | void setMosaicSlot(String confId, Integer num, Integer id) { |
|---|
| | 364 | //Get conference |
|---|
| | 365 | Conference conf = conferences.get(confId); |
|---|
| | 366 | //Get Mixer |
|---|
| | 367 | MediaMixer mixer = conf.getMixer(); |
|---|
| | 368 | //Set composition type |
|---|
| | 369 | try { |
|---|
| | 370 | mixer.SetMosaicSlot(conf.getId(), num, id); |
|---|
| | 371 | } catch (XmlRpcException ex) { |
|---|
| | 372 | ex.printStackTrace(); |
|---|
| | 373 | } |
|---|
| | 374 | //Set values in conference |
|---|
| | 375 | conf.setMosaicSlot(num,id); |
|---|
| | 376 | } |
|---|
| | 377 | |
|---|
| 363 | 378 | void setAudioMute(String confId, Integer partId, Boolean flag) { |
|---|
| 364 | 379 | //Get the conference |
|---|
| r27 |
r33 |
|
| 200 | 200 | } else if (method.equals("setCompositionType")) { |
|---|
| 201 | 201 | //Get parameters |
|---|
| 202 | | String confId = request.getParameter("confId"); |
|---|
| | 202 | String uid = request.getParameter("uid"); |
|---|
| 203 | 203 | Integer compType = Integer.parseInt(request.getParameter("compType")); |
|---|
| 204 | 204 | Integer size = Integer.parseInt(request.getParameter("size")); |
|---|
| 205 | 205 | String profileId = request.getParameter("profileId"); |
|---|
| 206 | 206 | //Call |
|---|
| 207 | | setCompositionType(confId,compType,size,profileId); |
|---|
| 208 | | //Redirect |
|---|
| 209 | | response.sendRedirect("/mcuWeb/conference.jsp?uid=" + confId); |
|---|
| | 207 | setCompositionType(uid,compType,size,profileId); |
|---|
| | 208 | //Redirect |
|---|
| | 209 | response.sendRedirect("/mcuWeb/conference.jsp?uid=" + uid); |
|---|
| | 210 | } else if (method.equals("setMosaicSlot")) { |
|---|
| | 211 | //Get parameters |
|---|
| | 212 | String uid = request.getParameter("uid"); |
|---|
| | 213 | Integer num = Integer.parseInt(request.getParameter("num")); |
|---|
| | 214 | Integer id = Integer.parseInt(request.getParameter("id")); |
|---|
| | 215 | //Call |
|---|
| | 216 | setMosaicSlot(uid,num,id); |
|---|
| | 217 | //Set xml response |
|---|
| | 218 | response.getOutputStream().print("<result>1</result>"); |
|---|
| 210 | 219 | } else { |
|---|
| 211 | 220 | response.setContentType("text/html;charset=UTF-8"); |
|---|
| … | … | |
| 264 | 273 | } |
|---|
| 265 | 274 | |
|---|
| 266 | | private Participant joinParticipant(String confId,String dest){ |
|---|
| | 275 | private Participant joinParticipant(String uid,String dest){ |
|---|
| 267 | 276 | Participant part = null; |
|---|
| 268 | 277 | //Create new application session |
|---|
| … | … | |
| 277 | 286 | SipSession session = request.getSession(); |
|---|
| 278 | 287 | //Create participant |
|---|
| 279 | | part = confMngr.createParticipant(confId, session); |
|---|
| | 288 | part = confMngr.createParticipant(uid, session); |
|---|
| 280 | 289 | // create an SDP |
|---|
| 281 | 290 | request.send(); |
|---|
| … | … | |
| 291 | 300 | } |
|---|
| 292 | 301 | |
|---|
| 293 | | private void removeParticipant(String confId, Integer partId) |
|---|
| | 302 | private void removeParticipant(String uid, Integer partId) |
|---|
| 294 | 303 | { |
|---|
| 295 | 304 | //Get the conference and participants |
|---|
| 296 | | Conference conf = confMngr.getConference(confId); |
|---|
| | 305 | Conference conf = confMngr.getConference(uid); |
|---|
| 297 | 306 | Participant part = conf.getParticipant(partId); |
|---|
| 298 | 307 | //Get user session |
|---|
| … | … | |
| 329 | 338 | } |
|---|
| 330 | 339 | |
|---|
| 331 | | private void setCompositionType(String confId, Integer compType, Integer size, String profileId) { |
|---|
| | 340 | private void setCompositionType(String uid, Integer compType, Integer size, String profileId) { |
|---|
| 332 | 341 | //Set composition type |
|---|
| 333 | | confMngr.setCompositionType(confId,compType,size,profileId); |
|---|
| 334 | | } |
|---|
| | 342 | confMngr.setCompositionType(uid,compType,size,profileId); |
|---|
| | 343 | } |
|---|
| | 344 | |
|---|
| | 345 | private void setMosaicSlot(String uid, Integer num, Integer id) { |
|---|
| | 346 | //Set composition type |
|---|
| | 347 | confMngr.setMosaicSlot(uid,num,id); |
|---|
| | 348 | } |
|---|
| 335 | 349 | |
|---|
| 336 | 350 | private void addProfile(String name, Integer videoSize, Integer videoBitrate, Boolean videoBitrateStrict, Integer videoFPS, Integer videoQmin, Integer videoQmax) { |
|---|
| r21 |
r33 |
|
| 10 | 10 | </div> |
|---|
| 11 | 11 | <div id=content> |
|---|
| 12 | | <script> |
|---|
| 13 | | function callController(method,param) |
|---|
| | 12 | <script> |
|---|
| | 13 | |
|---|
| | 14 | var theFrame = null; |
|---|
| | 15 | |
|---|
| | 16 | function callController(method,param) |
|---|
| | 17 | { |
|---|
| | 18 | //Create form |
|---|
| | 19 | var theForm = document.createElement("form"); |
|---|
| | 20 | //Set values |
|---|
| | 21 | theForm.action = "controller/" + method; |
|---|
| | 22 | theForm.method = "POST"; |
|---|
| | 23 | //Populate form |
|---|
| | 24 | for(var i in param) |
|---|
| 14 | 25 | { |
|---|
| 15 | | //Create form |
|---|
| 16 | | var theForm = document.createElement("form"); |
|---|
| | 26 | //Create input |
|---|
| | 27 | var input = document.createElement("input"); |
|---|
| 17 | 28 | //Set values |
|---|
| 18 | | theForm.action = "controller/" + method; |
|---|
| 19 | | theForm.method = "POST"; |
|---|
| 20 | | //Populate form |
|---|
| 21 | | for(var i in param) |
|---|
| 22 | | { |
|---|
| 23 | | //Create input |
|---|
| 24 | | var input = document.createElement("input"); |
|---|
| 25 | | //Set values |
|---|
| 26 | | input.type = "hidden"; |
|---|
| 27 | | input.name = i; |
|---|
| 28 | | input.value = param[i]; |
|---|
| 29 | | //Append to form |
|---|
| 30 | | theForm.appendChild(input); |
|---|
| 31 | | } |
|---|
| 32 | | //Append form |
|---|
| 33 | | document.body.appendChild(theForm); |
|---|
| 34 | | //Submit form |
|---|
| 35 | | theForm.submit(); |
|---|
| | 29 | input.type = "hidden"; |
|---|
| | 30 | input.name = i; |
|---|
| | 31 | input.value = param[i]; |
|---|
| | 32 | //Append to form |
|---|
| | 33 | theForm.appendChild(input); |
|---|
| 36 | 34 | } |
|---|
| 37 | | </script> |
|---|
| | 35 | //Append form |
|---|
| | 36 | document.body.appendChild(theForm); |
|---|
| | 37 | //Submit form |
|---|
| | 38 | theForm.submit(); |
|---|
| | 39 | } |
|---|
| | 40 | |
|---|
| | 41 | function onControllerAsyncLoaded() |
|---|
| | 42 | { |
|---|
| | 43 | alert("done"); |
|---|
| | 44 | } |
|---|
| | 45 | |
|---|
| | 46 | function callControllerAsync(method,param) |
|---|
| | 47 | { |
|---|
| | 48 | //If we don't have iframe |
|---|
| | 49 | if (theFrame==null) |
|---|
| | 50 | { |
|---|
| | 51 | //Create iframe |
|---|
| | 52 | theFrame = document.createElement("iframe"); |
|---|
| | 53 | //Set name |
|---|
| | 54 | theFrame.name = "callControllerAsyncIFrame"; |
|---|
| | 55 | //Append the iframe |
|---|
| | 56 | document.body.appendChild(theFrame); |
|---|
| | 57 | } |
|---|
| | 58 | |
|---|
| | 59 | //Set callback |
|---|
| | 60 | theFrame.onload = onControllerAsyncLoaded; |
|---|
| | 61 | |
|---|
| | 62 | //Create form |
|---|
| | 63 | var theForm = document.createElement("form"); |
|---|
| | 64 | //Set values |
|---|
| | 65 | theForm.action = "controller/" + method; |
|---|
| | 66 | theForm.method = "POST"; |
|---|
| | 67 | theForm.target = theFrame.name; |
|---|
| | 68 | //Populate form |
|---|
| | 69 | for(var i in param) |
|---|
| | 70 | { |
|---|
| | 71 | //Create input |
|---|
| | 72 | var input = document.createElement("input"); |
|---|
| | 73 | //Set values |
|---|
| | 74 | input.type = "hidden"; |
|---|
| | 75 | input.name = i; |
|---|
| | 76 | input.value = param[i]; |
|---|
| | 77 | //Append to form |
|---|
| | 78 | theForm.appendChild(input); |
|---|
| | 79 | } |
|---|
| | 80 | //Append form |
|---|
| | 81 | document.body.appendChild(theForm); |
|---|
| | 82 | //Submit form |
|---|
| | 83 | theForm.submit(); |
|---|
| | 84 | } |
|---|
| | 85 | </script> |
|---|
| r27 |
r33 |
|
| 10 | 10 | //Get participant iterator |
|---|
| 11 | 11 | Iterator<org.murillo.mcuWeb.Participant> itPart = null; |
|---|
| 12 | | |
|---|
| 13 | 12 | %> |
|---|
| 14 | 13 | <script> |
|---|
| … | … | |
| 29 | 28 | return callController("setAudioMute",param); |
|---|
| 30 | 29 | } |
|---|
| | 30 | function setMosaicSlot(num, id) |
|---|
| | 31 | { |
|---|
| | 32 | var param = {uid:uid, num:num, id:id }; |
|---|
| | 33 | return callControllerAsync("setMosaicSlot",param); |
|---|
| | 34 | } |
|---|
| 31 | 35 | </script> |
|---|
| 32 | 36 | <fieldset style="width:48%;float:right"> |
|---|
| 33 | 37 | <legend><img src="icons/application_view_tile.png"> Mosaic</legend> |
|---|
| 34 | 38 | <img src="icons/mosaic<%=conf.getCompType()%>.png" style="float:right"> |
|---|
| 35 | | <table class="form" method="POST" action="controller/setCompositionType"> |
|---|
| 36 | | <form> |
|---|
| | 39 | <table class="form"> |
|---|
| | 40 | <form onSumbit="return false;"> |
|---|
| 37 | 41 | <% |
|---|
| 38 | | //Get iterator |
|---|
| 39 | | itPart = conf.getParticipants().values().iterator(); |
|---|
| 40 | | //Options strign |
|---|
| 41 | | String options = new String(); |
|---|
| 42 | | //Loop |
|---|
| 43 | | while(itPart.hasNext()) { |
|---|
| 44 | | // Get mixer |
|---|
| 45 | | org.murillo.mcuWeb.Participant part = itPart.next(); |
|---|
| 46 | | //Apend |
|---|
| 47 | | options += "<option value=\"" + part.getId() +"\">" + part.getName(); |
|---|
| 48 | | } |
|---|
| 49 | | for(int i=0;i<9;i++) |
|---|
| | 42 | //Get vector with slots positions |
|---|
| | 43 | Integer[] slots = conf.getMosaicSlots(); |
|---|
| | 44 | |
|---|
| | 45 | //Print it |
|---|
| | 46 | for(int i=0;i<conf.getNumSlots();i++) |
|---|
| 50 | 47 | { |
|---|
| 51 | 48 | %> |
|---|
| 52 | 49 | <tr> |
|---|
| 53 | 50 | <td>Position <%=i+1%>:</td> |
|---|
| 54 | | <td><select name="pos"> |
|---|
| 55 | | <option value="0">Free |
|---|
| 56 | | <option value="-1">Lock |
|---|
| 57 | | <%=options%> |
|---|
| | 51 | <td><select name="pos" onchange="setMosaicSlot(<%=i%>,this.value);"> |
|---|
| | 52 | <option value="0" <%=slots[i].equals(0)?"selected":""%>>Free |
|---|
| | 53 | <option value="-1" <%=slots[i].equals(-1)?"selected":""%>>Lock |
|---|
| | 54 | <% |
|---|
| | 55 | //Get iterator |
|---|
| | 56 | itPart = conf.getParticipants().values().iterator(); |
|---|
| | 57 | //Options strign |
|---|
| | 58 | String options = new String(); |
|---|
| | 59 | //Loop |
|---|
| | 60 | while(itPart.hasNext()) |
|---|
| | 61 | { |
|---|
| | 62 | // Get mixer |
|---|
| | 63 | org.murillo.mcuWeb.Participant part = itPart.next(); |
|---|
| | 64 | //Print it |
|---|
| | 65 | %><option value="<%=part.getId()%>" <%=slots[i].equals(part.getId())?"selected":""%>><%=part.getName()%><% |
|---|
| | 66 | } |
|---|
| | 67 | %> |
|---|
| 58 | 68 | </select> |
|---|
| 59 | 69 | </td> |
|---|
| … | … | |
| 62 | 72 | } |
|---|
| 63 | 73 | %> |
|---|
| 64 | | <tr> |
|---|
| 65 | | <td colspan=2> |
|---|
| 66 | | <input class="accept" type="submit" value="Change"> |
|---|
| 67 | | </td> |
|---|
| 68 | | </tr> |
|---|
| 69 | 74 | </form> |
|---|
| 70 | 75 | </table> |
|---|
| … | … | |
| 75 | 80 | <table class="form"> |
|---|
| 76 | 81 | <form method="POST" action="controller/setCompositionType"> |
|---|
| 77 | | <input type="hidden" name="confId" value="<%=conf.getUID()%>"> |
|---|
| | 82 | <input type="hidden" name="uid" value="<%=conf.getUID()%>"> |
|---|
| 78 | 83 | <tr> |
|---|
| 79 | 84 | <td>Name:</td> |
|---|
Download in other formats:
|
|