Changeset 4996
- Timestamp:
- Mar 18, 2015 8:25:24 AM (9 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/swig/java/Makefile
r4759 r4996 138 138 ifeq ($(OS),android) 139 139 MY_JNI_CFLAGS+= -D__ANDROID__ 140 SWIG_FLAGS+= -D__ANDROID__ 140 141 endif 141 142 endif -
pjproject/trunk/pjsip-apps/src/swig/pjsua2.i
r4906 r4996 103 103 104 104 %include "pjsua2/media.hpp" 105 // Create an interface for android_opengl_get_surface() 106 #if defined(SWIGJAVA) && defined(__ANDROID__) 107 %inline %{ 108 extern "C" { 109 void* android_opengl_get_surface(jobject surface); 110 } 111 %} 112 #endif 113 105 114 %include "pjsua2/presence.hpp" 106 115 %include "pjsua2/account.hpp" -
pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h
r4995 r4996 6816 6816 6817 6817 /** 6818 * Set output window. This operation is valid only when the underlying 6819 * video device supports PJMEDIA_VIDEO_DEV_CAP_OUTPUT_WINDOW capability AND 6820 * allows the output window to be changed on-the-fly. Currently it is only 6821 * supported on Android. 6822 * 6823 * @param wid The video window ID. 6824 * @param win The new output window. 6825 * 6826 * @return PJ_SUCCESS on success, or the appropriate error code. 6827 */ 6828 PJ_DECL(pj_status_t) pjsua_vid_win_set_win(pjsua_vid_win_id wid, 6829 const pjmedia_vid_dev_hwnd *win); 6830 6831 /** 6818 6832 * Rotate the video window. This function will change the video orientation 6819 6833 * and also possibly the video window size (width and height get swapped). -
pjproject/trunk/pjsip/include/pjsua2/call.hpp
r4919 r4996 412 412 */ 413 413 pjsua_vid_win_id videoIncomingWindowId; 414 415 /** 416 * The video window instance for incoming video. Only valid if 417 * videoIncomingWindowId is not PJSUA_INVALID_ID and 418 * the media type is video. 419 */ 420 VideoWindow videoWindow; 414 421 415 422 /** -
pjproject/trunk/pjsip/include/pjsua2/media.hpp
r4845 r4996 1326 1326 }; 1327 1327 1328 1329 /************************************************************************* 1330 * Video media 1331 */ 1332 1333 /** 1334 * Representation of media coordinate. 1335 */ 1336 struct MediaCoordinate 1337 { 1338 int x; /**< X position of the coordinate */ 1339 int y; /**< Y position of the coordinate */ 1340 }; 1341 1342 /** 1343 * Representation of media size. 1344 */ 1345 struct MediaSize 1346 { 1347 unsigned w; /**< The width. */ 1348 unsigned h; /**< The height. */ 1349 }; 1350 1351 /** 1352 * Window handle. 1353 */ 1354 typedef struct WindowHandle { 1355 void *window; /**< Window */ 1356 void *display; /**< Display */ 1357 } WindowHandle; 1358 1359 /** 1360 * Video window handle. 1361 */ 1362 struct VideoWindowHandle 1363 { 1364 /** 1365 * The window handle type. 1366 */ 1367 pjmedia_vid_dev_hwnd_type type; 1368 1369 /** 1370 * The window handle. 1371 */ 1372 WindowHandle handle; 1373 }; 1374 1375 /** 1376 * This structure describes video window info. 1377 */ 1378 typedef struct VideoWindowInfo 1379 { 1380 /** 1381 * Flag to indicate whether this window is a native window, 1382 * such as created by built-in preview device. If this field is 1383 * true, only the video window handle field of this 1384 * structure is valid. 1385 */ 1386 bool isNative; 1387 1388 /** 1389 * Video window handle. 1390 */ 1391 VideoWindowHandle winHandle; 1392 1393 /** 1394 * Renderer device ID. 1395 */ 1396 int renderDeviceId; 1397 1398 /** 1399 * Window show status. The window is hidden if false. 1400 */ 1401 bool show; 1402 1403 /** 1404 * Window position. 1405 */ 1406 MediaCoordinate pos; 1407 1408 /** 1409 * Window size. 1410 */ 1411 MediaSize size; 1412 1413 } VideoWindowInfo; 1414 1415 /** 1416 * Video window. 1417 */ 1418 class VideoWindow 1419 { 1420 public: 1421 /** 1422 * Constructor 1423 */ 1424 VideoWindow(int win_id); 1425 1426 /** 1427 * Get window info. 1428 * 1429 * @return video window info. 1430 */ 1431 VideoWindowInfo getInfo() const throw(Error); 1432 1433 /** 1434 * Show or hide window. This operation is not valid for native windows 1435 * (VideoWindowInfo.isNative=true), on which native windowing API 1436 * must be used instead. 1437 * 1438 * @param show Set to true to show the window, false to 1439 * hide the window. 1440 * 1441 */ 1442 void Show(bool show) throw(Error); 1443 1444 /** 1445 * Set video window position. This operation is not valid for native windows 1446 * (VideoWindowInfo.isNative=true), on which native windowing API 1447 * must be used instead. 1448 * 1449 * @param pos The window position. 1450 * 1451 */ 1452 void setPos(const MediaCoordinate &pos) throw(Error); 1453 1454 /** 1455 * Resize window. This operation is not valid for native windows 1456 * (VideoWindowInfo.isNative=true), on which native windowing API 1457 * must be used instead. 1458 * 1459 * @param size The new window size. 1460 * 1461 */ 1462 void setSize(const MediaSize &size) throw(Error); 1463 1464 /** 1465 * Rotate the video window. This function will change the video orientation 1466 * and also possibly the video window size (width and height get swapped). 1467 * This operation is not valid for native windows (VideoWindowInfo.isNative 1468 * =true), on which native windowing API must be used instead. 1469 * 1470 * @param angle The rotation angle in degrees, must be 1471 * multiple of 90. 1472 * Specify positive value for clockwise rotation or 1473 * negative value for counter-clockwise rotation. 1474 */ 1475 void rotate(int angle) throw(Error); 1476 1477 /** 1478 * Set output window. This operation is valid only when the underlying 1479 * video device supports PJMEDIA_VIDEO_DEV_CAP_OUTPUT_WINDOW capability AND 1480 * allows the output window to be changed on-the-fly, otherwise Error will 1481 * be thrown. Currently it is only supported on Android. 1482 * 1483 * @param win The new output window. 1484 */ 1485 void setWindow(const VideoWindowHandle &win) throw(Error); 1486 1487 private: 1488 pjsua_vid_win_id winId; 1489 }; 1490 1328 1491 /************************************************************************* 1329 1492 * Codec management -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_vid.c
r4995 r4996 1399 1399 status = pjmedia_vid_dev_stream_set_cap(s, 1400 1400 PJMEDIA_VID_DEV_CAP_OUTPUT_RESIZE, size); 1401 1402 PJSUA_UNLOCK(); 1403 1404 return status; 1405 } 1406 1407 /* 1408 * Set output window. 1409 */ 1410 PJ_DEF(pj_status_t) pjsua_vid_win_set_win( pjsua_vid_win_id wid, 1411 const pjmedia_vid_dev_hwnd *win) 1412 { 1413 pjsua_vid_win *w; 1414 pjmedia_vid_dev_stream *s; 1415 pj_status_t status; 1416 1417 PJ_ASSERT_RETURN(wid >= 0 && wid < PJSUA_MAX_VID_WINS && win, PJ_EINVAL); 1418 1419 PJSUA_LOCK(); 1420 w = &pjsua_var.win[wid]; 1421 if (w->vp_rend == NULL) { 1422 /* Native window */ 1423 PJSUA_UNLOCK(); 1424 return PJ_EINVAL; 1425 } 1426 1427 s = pjmedia_vid_port_get_stream(w->vp_rend); 1428 if (s == NULL) { 1429 PJSUA_UNLOCK(); 1430 return PJ_EINVAL; 1431 } 1432 1433 status = pjmedia_vid_dev_stream_set_cap(s, 1434 PJMEDIA_VID_DEV_CAP_OUTPUT_WINDOW, win); 1401 1435 1402 1436 PJSUA_UNLOCK(); -
pjproject/trunk/pjsip/src/pjsua2/call.cpp
r4919 r4996 225 225 226 226 CallMediaInfo::CallMediaInfo() 227 : videoWindow(PJSUA_INVALID_ID) 227 228 { 228 229 } … … 238 239 } else if (this->type == PJMEDIA_TYPE_VIDEO) { 239 240 this->videoIncomingWindowId = prm.stream.vid.win_in; 241 this->videoWindow = VideoWindow(prm.stream.vid.win_in); 240 242 this->videoCapDev = prm.stream.vid.cap_dev; 241 243 } -
pjproject/trunk/pjsip/src/pjsua2/media.cpp
r4950 r4996 1008 1008 1009 1009 /////////////////////////////////////////////////////////////////////////////// 1010 VideoWindow::VideoWindow(pjsua_vid_win_id win_id) 1011 : winId(win_id) 1012 { 1013 } 1014 1015 VideoWindowInfo VideoWindow::getInfo() const throw(Error) 1016 { 1017 VideoWindowInfo vwi; 1018 pjsua_vid_win_info pj_vwi; 1019 1020 PJSUA2_CHECK_EXPR( pjsua_vid_win_get_info(winId, &pj_vwi) ); 1021 vwi.isNative = pj_vwi.is_native; 1022 vwi.winHandle.type = pj_vwi.hwnd.type; 1023 vwi.winHandle.handle.window = pj_vwi.hwnd.info.window; 1024 vwi.renderDeviceId = pj_vwi.rdr_dev; 1025 vwi.show = pj_vwi.show; 1026 vwi.pos.x = pj_vwi.pos.x; 1027 vwi.pos.y = pj_vwi.pos.y; 1028 vwi.size.w = pj_vwi.size.w; 1029 vwi.size.h = pj_vwi.size.h; 1030 1031 return vwi; 1032 } 1033 1034 void VideoWindow::Show(bool show) throw(Error) 1035 { 1036 PJSUA2_CHECK_EXPR( pjsua_vid_win_set_show(winId, show) ); 1037 } 1038 1039 void VideoWindow::setPos(const MediaCoordinate &pos) throw(Error) 1040 { 1041 pjmedia_coord pj_pos; 1042 1043 pj_pos.x = pos.x; 1044 pj_pos.y = pos.y; 1045 PJSUA2_CHECK_EXPR( pjsua_vid_win_set_pos(winId, &pj_pos) ); 1046 } 1047 1048 void VideoWindow::setSize(const MediaSize &size) throw(Error) 1049 { 1050 pjmedia_rect_size pj_size; 1051 1052 pj_size.w = size.w; 1053 pj_size.h = size.h; 1054 PJSUA2_CHECK_EXPR( pjsua_vid_win_set_size(winId, &pj_size) ); 1055 } 1056 1057 void VideoWindow::rotate(int angle) throw(Error) 1058 { 1059 PJSUA2_CHECK_EXPR( pjsua_vid_win_rotate(winId, angle) ); 1060 } 1061 1062 void VideoWindow::setWindow(const VideoWindowHandle &win) throw(Error) 1063 { 1064 pjmedia_vid_dev_hwnd vhwnd; 1065 1066 vhwnd.type = win.type; 1067 vhwnd.info.window = win.handle.window; 1068 PJSUA2_CHECK_EXPR( pjsua_vid_win_set_win(winId, &vhwnd) ); 1069 } 1070 1071 /////////////////////////////////////////////////////////////////////////////// 1010 1072 void CodecInfo::fromPj(const pjsua_codec_info &codec_info) 1011 1073 {
Note: See TracChangeset
for help on using the changeset viewer.