Changeset 33

Show
Ignore:
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
  • mcuWeb/src/java/org/murillo/mcuWeb/Conference.java

    r27 r33  
    3636    private Integer compType; 
    3737    private Integer size; 
     38    private Integer numSlots; 
     39    private Integer slots[]; 
    3840    private Profile profile; 
    3941 
     
    4951        this.compType = XmlRpcMcuClient.MOSAIC2x2; 
    5052        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; 
    5160        //Create the participant map 
    5261        participants = new HashMap<Integer,Participant>(); 
     
    5867 
    5968    public void setCompType(Integer compType) { 
     69        //Save mosaic info 
    6070        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; 
    6190    } 
    6291 
    6392    public Integer getSize() { 
    6493        return size; 
     94    } 
     95     
     96    public Integer getNumSlots() { 
     97        return numSlots; 
    6598    } 
    6699 
     
    115148        participants.remove(id); 
    116149    } 
     150 
     151    public void setMosaicSlot(Integer num, Integer id) { 
     152        //Set slot 
     153        slots[num] = id; 
     154    } 
    117155     
    118      
    119              
    120      
     156    public Integer[] getMosaicSlots() { 
     157        //Return a clone 
     158        return slots.clone(); 
     159    } 
     160  
    121161} 
  • mcuWeb/src/java/org/murillo/mcuWeb/ConferenceMngr.java

    r27 r33  
    360360        conf.setProfile(profile); 
    361361    } 
    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     
    363378    void setAudioMute(String confId, Integer partId, Boolean flag) { 
    364379        //Get the conference 
  • mcuWeb/src/java/org/murillo/mcuWeb/MCUHttpServlet.java

    r27 r33  
    200200         } else if (method.equals("setCompositionType")) { 
    201201            //Get parameters 
    202             String  confId = request.getParameter("confId"); 
     202            String  uid = request.getParameter("uid"); 
    203203            Integer compType  = Integer.parseInt(request.getParameter("compType")); 
    204204            Integer size = Integer.parseInt(request.getParameter("size")); 
    205205            String  profileId = request.getParameter("profileId"); 
    206206            //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>"); 
    210219        } else { 
    211220            response.setContentType("text/html;charset=UTF-8"); 
     
    264273    } 
    265274 
    266     private Participant joinParticipant(String confId,String dest){ 
     275    private Participant joinParticipant(String uid,String dest){ 
    267276        Participant part = null; 
    268277        //Create new application session 
     
    277286            SipSession session = request.getSession(); 
    278287            //Create participant 
    279             part = confMngr.createParticipant(confId, session); 
     288            part = confMngr.createParticipant(uid, session); 
    280289            // create an SDP             
    281290            request.send(); 
     
    291300    } 
    292301     
    293     private void removeParticipant(String confId, Integer partId) 
     302    private void removeParticipant(String uid, Integer partId) 
    294303    {     
    295304        //Get the conference and participants 
    296         Conference conf = confMngr.getConference(confId); 
     305        Conference conf = confMngr.getConference(uid); 
    297306        Participant part = conf.getParticipant(partId); 
    298307        //Get user session 
     
    329338    } 
    330339  
    331     private void setCompositionType(String confId, Integer compType, Integer size, String profileId) { 
     340    private void setCompositionType(String uid, Integer compType, Integer size, String profileId) { 
    332341       //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    }     
    335349     
    336350    private void addProfile(String name, Integer videoSize, Integer videoBitrate, Boolean videoBitrateStrict, Integer videoFPS, Integer videoQmin, Integer videoQmax) { 
  • mcuWeb/web/WEB-INF/jspf/header.jspf

    r21 r33  
    1010    </div> 
    1111    <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) 
    1425        { 
    15             //Create form 
    16             var theForm = document.createElement("form"); 
     26            //Create input 
     27            var input = document.createElement("input"); 
    1728            //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); 
    3634        } 
    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> 
  • mcuWeb/web/conference.jsp

    r27 r33  
    1010    //Get participant iterator 
    1111   Iterator<org.murillo.mcuWeb.Participant> itPart = null; 
    12     
    1312%> 
    1413<script> 
     
    2928        return callController("setAudioMute",param); 
    3029    } 
     30    function setMosaicSlot(num, id) 
     31    { 
     32        var param = {uid:uid, num:num, id:id }; 
     33        return callControllerAsync("setMosaicSlot",param); 
     34    } 
    3135</script> 
    3236<fieldset style="width:48%;float:right"> 
    3337    <legend><img src="icons/application_view_tile.png"> Mosaic</legend> 
    3438     <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;"
    3741            <%  
    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++) 
    5047                { 
    5148            %> 
    5249            <tr> 
    5350                <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                %> 
    5868                    </select> 
    5969                </td>      
     
    6272                } 
    6373            %> 
    64             <tr> 
    65                <td colspan=2> 
    66                <input class="accept" type="submit" value="Change"> 
    67                </td> 
    68             </tr> 
    6974            </form> 
    7075        </table> 
     
    7580        <table class="form"> 
    7681            <form method="POST" action="controller/setCompositionType"> 
    77             <input type="hidden" name="confId" value="<%=conf.getUID()%>"> 
     82            <input type="hidden" name="uid" value="<%=conf.getUID()%>"> 
    7883            <tr> 
    7984                <td>Name:</td> 
Copyright 2006 - Sergio García Murillo
Powered by Trac - Edgewall Software