Changeset 5166
- Timestamp:
- Aug 21, 2015 6:46:32 AM (9 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/include/pjmedia/types.h
r3774 r5166 203 203 204 204 /** 205 * Natural orientation, e.g: sky upside on landscape view, head upside206 * on human portrait.205 * Natural orientation, i.e. the original orientation video will be 206 * displayed/captured without rotation. 207 207 */ 208 208 PJMEDIA_ORIENT_NATURAL, … … 210 210 /** 211 211 * Specifies that the video/picture needs to be rotated 90 degrees 212 * clockwise to be displayed in natural orientation. 212 * from its natural orientation in clockwise direction from the user's 213 * perspective. 214 * Note that for devices with back cameras (which faces away 215 * from the user), the video will actually need to be rotated 216 * 270 degrees clockwise instead. 213 217 */ 214 218 PJMEDIA_ORIENT_ROTATE_90DEG, … … 216 220 /** 217 221 * Specifies that the video/picture needs to be rotated 180 degrees 218 * clockwise to be displayed innatural orientation.222 * from its natural orientation. 219 223 */ 220 224 PJMEDIA_ORIENT_ROTATE_180DEG, … … 222 226 /** 223 227 * Specifies that the video/picture needs to be rotated 270 degrees 224 * clockwise to be displayed in natural orientation. 228 * from its natural orientation in clockwise direction from the user's 229 * perspective. 230 * Note that for devices with back cameras (which faces away 231 * from the user), the video will actually need to be rotated 232 * 90 degrees clockwise instead. 225 233 */ 226 234 PJMEDIA_ORIENT_ROTATE_270DEG -
pjproject/trunk/pjmedia/src/pjmedia-videodev/android_dev.c
r5138 r5166 72 72 pjmedia_vid_dev_info info; /**< Base info */ 73 73 unsigned dev_idx; /**< Original dev ID */ 74 pj_bool_t facing; /**< Front/back camera?*/ 74 75 unsigned sup_size_cnt; /**< # of supp'd size */ 75 76 pjmedia_rect_size *sup_size; /**< Supported size */ … … 526 527 /* Set driver & name info */ 527 528 pj_ansi_strncpy(vdi->driver, "Android", sizeof(vdi->driver)); 529 adi->facing = facing; 528 530 if (facing == 0) { 529 531 pj_ansi_strncpy(vdi->name, "Back camera", sizeof(vdi->name)); … … 954 956 } else { 955 957 strm->param.cap_id = p->target_id; 958 959 /* If successful, set the orientation as well */ 960 and_stream_set_cap(s, PJMEDIA_VID_DEV_CAP_ORIENTATION, 961 &strm->param.orient); 956 962 } 957 963 jni_detach_env(with_attach); … … 962 968 { 963 969 pjmedia_orient orient = *(pjmedia_orient *)pval; 970 pjmedia_orient eff_ori; 971 and_dev_info *adi; 964 972 965 973 pj_assert(orient >= PJMEDIA_ORIENT_UNKNOWN && … … 985 993 } 986 994 987 pjmedia_vid_dev_conv_set_rotation(&strm->conv, strm->param.orient); 995 eff_ori = strm->param.orient; 996 adi = &strm->factory->dev_info[strm->param.cap_id]; 997 /* Normalize the orientation for back-facing camera */ 998 if (!adi->facing) { 999 if (eff_ori == PJMEDIA_ORIENT_ROTATE_90DEG) 1000 eff_ori = PJMEDIA_ORIENT_ROTATE_270DEG; 1001 else if (eff_ori == PJMEDIA_ORIENT_ROTATE_270DEG) 1002 eff_ori = PJMEDIA_ORIENT_ROTATE_90DEG; 1003 } 1004 pjmedia_vid_dev_conv_set_rotation(&strm->conv, eff_ori); 988 1005 989 1006 PJ_LOG(4, (THIS_FILE, "Video capture orientation set to %d", -
pjproject/trunk/pjmedia/src/pjmedia-videodev/ios_dev.m
r5138 r5166 963 963 strm->param.cap_id = p->target_id; 964 964 965 /* Set the orientation as well */ 966 ios_stream_set_cap(s, PJMEDIA_VID_DEV_CAP_ORIENTATION, 967 &strm->param.orient); 968 965 969 return PJ_SUCCESS; 966 970 } -
pjproject/trunk/pjsip-apps/src/pjsua/ios/ipjsua/ipjsuaAppDelegate.m
r5125 r5166 181 181 static UIDeviceOrientation prev_ori = 0; 182 182 UIDeviceOrientation dev_ori = [[UIDevice currentDevice] orientation]; 183 int i; 183 184 184 185 if (dev_ori == prev_ori) return; … … 193 194 } 194 195 195 pjsua_vid_dev_set_setting(PJMEDIA_VID_DEFAULT_CAPTURE_DEV, 196 PJMEDIA_VID_DEV_CAP_ORIENTATION, 197 &pj_ori[dev_ori-1], PJ_TRUE); 196 /* Here we set the orientation for all video devices. 197 * This may return failure for renderer devices or for 198 * capture devices which do not support orientation setting, 199 * we can simply ignore them. 200 */ 201 for (i = pjsua_vid_dev_count()-1; i >= 0; i--) { 202 pjsua_vid_dev_set_setting(i, PJMEDIA_VID_DEV_CAP_ORIENTATION, 203 &pj_ori[dev_ori-1], PJ_TRUE); 204 } 198 205 } 199 206 #endif
Note: See TracChangeset
for help on using the changeset viewer.