Changeset 3785


Ignore:
Timestamp:
Oct 4, 2011 4:04:49 AM (12 years ago)
Author:
bennylp
Message:

Misc (re #1370): auto arranging of video windows in pjsua

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c

    r3735 r3785  
    27622762} 
    27632763 
     2764/* arrange windows. arg: 
     2765 *   -1:    arrange all windows 
     2766 *   != -1: arrange only this window id 
     2767 */ 
     2768static void arrange_window(pjsua_vid_win_id wid) 
     2769{ 
     2770    pjmedia_coord pos; 
     2771    int i, last; 
     2772 
     2773    pos.x = 0; 
     2774    pos.y = 0; 
     2775    last = (wid == PJSUA_INVALID_ID) ? PJSUA_MAX_VID_WINS : wid; 
     2776 
     2777    for (i=0; i<last; ++i) { 
     2778        pjsua_vid_win_info wi; 
     2779        pj_status_t status; 
     2780 
     2781        status = pjsua_vid_win_get_info(i, &wi); 
     2782        if (status != PJ_SUCCESS) 
     2783            continue; 
     2784 
     2785        if (wid == PJSUA_INVALID_ID) 
     2786            pjsua_vid_win_set_pos(i, &pos); 
     2787 
     2788        pos.y += wi.size.h; 
     2789    } 
     2790 
     2791    if (wid != PJSUA_INVALID_ID) 
     2792        pjsua_vid_win_set_pos(wid, &pos); 
     2793} 
     2794 
    27642795/* Process video media state. "mi" is the media index. */ 
    27652796static void on_call_video_state(pjsua_call_info *ci, unsigned mi, 
    27662797                                pj_bool_t *has_error) 
    27672798{ 
    2768     PJ_UNUSED_ARG(ci); 
    2769     PJ_UNUSED_ARG(mi); 
     2799    if (ci->media_status != PJSUA_CALL_MEDIA_ACTIVE) 
     2800        return; 
     2801 
     2802    arrange_window(ci->media[mi].stream.vid.win_in); 
     2803 
    27702804    PJ_UNUSED_ARG(has_error); 
    27712805} 
     
    38403874                if (on) { 
    38413875                    pjsua_vid_preview_start(dev_id, NULL); 
     3876                    arrange_window(pjsua_vid_preview_get_win(dev_id)); 
    38423877                } else { 
    38433878                    pjsua_vid_preview_stop(dev_id); 
Note: See TracChangeset for help on using the changeset viewer.