Ignore:
Timestamp:
Jun 25, 2015 8:17:52 AM (7 years ago)
Author:
ming
Message:

Re #1861: Initial implementation of video orientation support

  • Utility to resize and rotate video frame
  • Support for iOS + sample
  • pjsua API to set video device's orientation
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_vid.c

    r5098 r5118  
    3333 
    3434 
     35static pjsua_vid_win_id vid_preview_get_win(pjmedia_vid_dev_index id, 
     36                                            pj_bool_t running_only); 
    3537static void free_vid_win(pjsua_vid_win_id wid); 
    3638 
     
    212214{ 
    213215    return pjmedia_vid_dev_get_info(id, vdi); 
     216} 
     217 
     218/* 
     219 * Check whether the video device is currently active. 
     220 */ 
     221PJ_DEF(pj_bool_t) pjsua_vid_dev_is_active(pjmedia_vid_dev_index id) 
     222{ 
     223    pjsua_vid_win_id wid = vid_preview_get_win(id, PJ_FALSE); 
     224     
     225    return (wid != PJSUA_INVALID_ID? PJ_TRUE: PJ_FALSE); 
     226} 
     227 
     228/* 
     229 * Set the orientation of the video device. 
     230 */ 
     231PJ_DEF(pj_status_t) pjsua_vid_dev_set_orient( pjmedia_vid_dev_index id, 
     232                                              pjmedia_orient orient) 
     233{ 
     234    pjsua_vid_win *w; 
     235    pjmedia_vid_dev_stream *cap_dev; 
     236    pjsua_vid_win_id wid = vid_preview_get_win(id, PJ_FALSE); 
     237     
     238    if (wid == PJSUA_INVALID_ID) { 
     239        PJ_LOG(3, (THIS_FILE, "Unable to set orientation for video dev %d: " 
     240                              "device not active", id)); 
     241        return PJ_ENOTFOUND; 
     242    } 
     243 
     244    w = &pjsua_var.win[wid]; 
     245         
     246    cap_dev = pjmedia_vid_port_get_stream(w->vp_cap); 
     247 
     248    return pjmedia_vid_dev_stream_set_cap(cap_dev, 
     249                                          PJMEDIA_VID_DEV_CAP_ORIENTATION, 
     250                                          &orient); 
    214251} 
    215252 
Note: See TracChangeset for help on using the changeset viewer.