Changeset 3774
- Timestamp:
- Sep 27, 2011 5:24:06 AM (13 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/include/pjmedia-videodev/videodev.h
r3758 r3774 193 193 */ 194 194 PJMEDIA_VID_DEV_CAP_INPUT_PREVIEW = 64, 195 196 /** 197 * Support for changing video orientation in renderer and querying 198 * video orientation info in capture. Changing video orientation in 199 * a renderer will potentially affect the size of render window, 200 * i.e: width and height swap. When a capture device supports this 201 * capability, it will generate event PJMEDIA_EVENT_ORIENT_CHANGED 202 * (see #pjmedia_event) everytime the capture orientation is changed. 203 * 204 * The value of this capability is pjmedia_orient. 205 */ 206 PJMEDIA_VID_DEV_CAP_ORIENTATION = 128, 195 207 196 208 /** … … 370 382 pj_bool_t native_preview; 371 383 384 /** 385 * Video orientation. This setting is optional and is only used if 386 * PJMEDIA_VID_DEV_CAP_ORIENTATION capability is supported and is 387 * set in the flags. 388 */ 389 pjmedia_orient orient; 390 372 391 } pjmedia_vid_dev_param; 373 392 -
pjproject/trunk/pjmedia/include/pjmedia/event.h
r3664 r3774 79 79 * Video decoding error due to missing key frame event. 80 80 */ 81 PJMEDIA_EVENT_KEY_FRAME_MISSING = PJMEDIA_FOURCC('I', 'F', 'R', 'M') 81 PJMEDIA_EVENT_KEY_FRAME_MISSING = PJMEDIA_FOURCC('I', 'F', 'R', 'M'), 82 83 /** 84 * Video orientation has been changed event. 85 */ 86 PJMEDIA_EVENT_ORIENT_CHANGED = PJMEDIA_FOURCC('O', 'R', 'N', 'T') 82 87 83 88 } pjmedia_event_type; -
pjproject/trunk/pjmedia/include/pjmedia/types.h
r3664 r3774 191 191 pjmedia_rect_size size; /**< The size. */ 192 192 } pjmedia_rect; 193 194 /** 195 * Enumeration for video/picture orientation. 196 */ 197 typedef enum pjmedia_orient 198 { 199 /** 200 * Unknown orientation. 201 */ 202 PJMEDIA_ORIENT_UNKNOWN, 203 204 /** 205 * Natural orientation, e.g: sky upside on landscape view, head upside 206 * on human portrait. 207 */ 208 PJMEDIA_ORIENT_NATURAL, 209 210 /** 211 * Specifies that the video/picture needs to be rotated 90 degrees 212 * clockwise to be displayed in natural orientation. 213 */ 214 PJMEDIA_ORIENT_ROTATE_90DEG, 215 216 /** 217 * Specifies that the video/picture needs to be rotated 180 degrees 218 * clockwise to be displayed in natural orientation. 219 */ 220 PJMEDIA_ORIENT_ROTATE_180DEG, 221 222 /** 223 * Specifies that the video/picture needs to be rotated 270 degrees 224 * clockwise to be displayed in natural orientation. 225 */ 226 PJMEDIA_ORIENT_ROTATE_270DEG 227 228 } pjmedia_orient; 229 193 230 194 231 /** -
pjproject/trunk/pjmedia/src/pjmedia-videodev/videodev.c
r3758 r3774 46 46 DEFINE_CAP("hide", "Renderer hide"), 47 47 DEFINE_CAP("preview", "Input preview"), 48 DEFINE_CAP("orientation", "Video orientation") 48 49 }; 49 50 … … 180 181 FIELD_INFO(native_preview); 181 182 break; 183 case PJMEDIA_VID_DEV_CAP_ORIENTATION: 184 FIELD_INFO(orient); 185 break; 182 186 default: 183 187 return PJMEDIA_EVID_INVCAP; -
pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h
r3763 r3774 5719 5719 const pjmedia_rect_size *size); 5720 5720 5721 /** 5722 * Rotate the video window. This function will change the video orientation 5723 * and also possibly the video window size (width and height get swapped). 5724 * This operation is not valid for native windows (pjsua_vid_win_info.is_native 5725 * =PJ_TRUE), on which native windowing API must be used instead. 5726 * 5727 * @param wid The video window ID. 5728 * @param angle The rotation angle in degrees, must be multiple of 90. 5729 * Specify positive value for clockwise rotation or 5730 * negative value for counter-clockwise rotation. 5731 * 5732 * @return PJ_SUCCESS on success, or the appropriate error code. 5733 */ 5734 PJ_DECL(pj_status_t) pjsua_vid_win_rotate(pjsua_vid_win_id wid, 5735 int angle); 5721 5736 5722 5737 -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_vid.c
r3772 r3774 1358 1358 status = pjmedia_vid_dev_stream_set_cap(s, 1359 1359 PJMEDIA_VID_DEV_CAP_OUTPUT_RESIZE, size); 1360 1361 PJSUA_UNLOCK(); 1362 1363 return status; 1364 } 1365 1366 /* 1367 * Set video orientation. 1368 */ 1369 PJ_DEF(pj_status_t) pjsua_vid_win_rotate( pjsua_vid_win_id wid, 1370 int angle) 1371 { 1372 pjsua_vid_win *w; 1373 pjmedia_vid_dev_stream *s; 1374 pjmedia_orient orient; 1375 pj_status_t status; 1376 1377 PJ_ASSERT_RETURN(wid >= 0 && wid < PJSUA_MAX_VID_WINS, PJ_EINVAL); 1378 PJ_ASSERT_RETURN((angle % 90) == 0, PJ_EINVAL); 1379 1380 /* Normalize angle, so it must be 0, 90, 180, or 270. */ 1381 angle %= 360; 1382 if (angle < 0) 1383 angle += 360; 1384 1385 /* Convert angle to pjmedia_orient */ 1386 switch(angle) { 1387 case 0: 1388 /* No rotation */ 1389 return PJ_SUCCESS; 1390 case 90: 1391 orient = PJMEDIA_ORIENT_ROTATE_90DEG; 1392 break; 1393 case 180: 1394 orient = PJMEDIA_ORIENT_ROTATE_180DEG; 1395 break; 1396 case 270: 1397 orient = PJMEDIA_ORIENT_ROTATE_270DEG; 1398 break; 1399 default: 1400 pj_assert(!"Angle must have been validated"); 1401 return PJ_EBUG; 1402 } 1403 1404 PJSUA_LOCK(); 1405 w = &pjsua_var.win[wid]; 1406 if (w->vp_rend == NULL) { 1407 /* Native window */ 1408 PJSUA_UNLOCK(); 1409 return PJ_EINVAL; 1410 } 1411 1412 s = pjmedia_vid_port_get_stream(w->vp_rend); 1413 if (s == NULL) { 1414 PJSUA_UNLOCK(); 1415 return PJ_EINVAL; 1416 } 1417 1418 status = pjmedia_vid_dev_stream_set_cap(s, 1419 PJMEDIA_VID_DEV_CAP_ORIENTATION, &orient); 1360 1420 1361 1421 PJSUA_UNLOCK();
Note: See TracChangeset
for help on using the changeset viewer.