- Timestamp:
- Jul 30, 2015 1:42:51 PM (9 years ago)
- Location:
- pjproject/trunk/pjsip
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/include/pjsua2/media.hpp
r5138 r5139 1355 1355 struct MediaSize 1356 1356 { 1357 unsigned w; /**< The width. 1357 unsigned w; /**< The width. */ 1358 1358 unsigned h; /**< The height. */ 1359 1359 }; … … 1604 1604 { 1605 1605 /** 1606 * The device ID 1607 */ 1608 pjmedia_vid_dev_index id; 1609 1610 /** 1606 1611 * The device name 1607 1612 */ … … 1647 1652 1648 1653 /** 1654 * Parameter for switching device with PJMEDIA_VID_DEV_CAP_SWITCH capability. 1655 */ 1656 struct VideoSwitchParam 1657 { 1658 /** 1659 * Target device ID to switch to. Once the switching is successful, the 1660 * video stream will use this device and the old device will be closed. 1661 */ 1662 pjmedia_vid_dev_index target_id; 1663 }; 1664 1665 /** 1649 1666 * Video device manager. 1650 1667 */ 1651 1668 class VidDevManager { 1652 1669 public: 1670 /** 1671 * Refresh the list of video devices installed in the system. This function 1672 * will only refresh the list of video device so all active video streams 1673 * will be unaffected. After refreshing the device list, application MUST 1674 * make sure to update all index references to video devices (i.e. all 1675 * variables of type pjmedia_vid_dev_index) before calling any function 1676 * that accepts video device index as its parameter. 1677 */ 1678 void refreshDevs() throw(Error); 1679 1653 1680 /** 1654 1681 * Get the number of video devices installed in the system. … … 1673 1700 */ 1674 1701 const VideoDevInfoVector &enumDev() throw(Error); 1702 1703 /** 1704 * Lookup device index based on the driver and device name. 1705 * 1706 * @param drv_name The driver name. 1707 * @param dev_name The device name. 1708 * 1709 * @return The device ID. If the device is not found, 1710 * Error will be thrown. 1711 */ 1712 int lookupDev(const string &drv_name, 1713 const string &dev_name) const throw(Error); 1714 1715 /** 1716 * Get string info for the specified capability. 1717 * 1718 * @param cap The capability ID. 1719 * 1720 * @return Capability name. 1721 */ 1722 string capName(pjmedia_vid_dev_cap cap) const; 1723 1724 /** 1725 * This will configure video format capability to the video device. 1726 * If video device is currently active, the method will forward the setting 1727 * to the video device instance to be applied immediately, if it 1728 * supports it. 1729 * 1730 * This method is only valid if the device has 1731 * PJMEDIA_VID_DEV_CAP_FORMAT capability in VideoDevInfo.caps flags, 1732 * otherwise Error will be thrown. 1733 * 1734 * Note that in case the setting is kept for future use, it will be applied 1735 * to any devices, even when application has changed the video device to be 1736 * used. 1737 * 1738 * @param dev_id The video device id. 1739 * @param format The video format. 1740 * @param keep Specify whether the setting is to be kept for 1741 * future use. 1742 */ 1743 void setFormat(int dev_id, 1744 const MediaFormatVideo &format, 1745 bool keep) throw(Error); 1746 1747 /** 1748 * Get the video format capability to the video device. 1749 * If video device is currently active, the method will forward the request 1750 * to the video device. If video device is currently inactive, and if 1751 * application had previously set the setting and mark the setting as kept, 1752 * then that setting will be returned. Otherwise, this method will 1753 * raise error. 1754 * 1755 * This method is only valid if the device has 1756 * PJMEDIA_VID_DEV_CAP_FORMAT capability in VideoDevInfo.caps flags, 1757 * otherwise Error will be thrown. 1758 * 1759 * @param dev_id The video device id. 1760 * @return keep The video format. 1761 */ 1762 MediaFormatVideo getFormat(int dev_id) const throw(Error); 1763 1764 /** 1765 * This will configure video format capability to the video device. 1766 * If video device is currently active, the method will forward the setting 1767 * to the video device instance to be applied immediately, if it 1768 * supports it. 1769 * 1770 * This method is only valid if the device has 1771 * PJMEDIA_VID_DEV_CAP_INPUT_SCALE capability in VideoDevInfo.caps flags, 1772 * otherwise Error will be thrown. 1773 * 1774 * Note that in case the setting is kept for future use, it will be applied 1775 * to any devices, even when application has changed the video device to be 1776 * used. 1777 * 1778 * @param dev_id The video device id. 1779 * @param scale The video scale. 1780 * @param keep Specify whether the setting is to be kept for 1781 * future use. 1782 */ 1783 void setInputScale(int dev_id, 1784 const MediaSize &scale, 1785 bool keep) throw(Error); 1786 1787 /** 1788 * Get the video input scale capability to the video device. 1789 * If video device is currently active, the method will forward the request 1790 * to the video device. If video device is currently inactive, and if 1791 * application had previously set the setting and mark the setting as kept, 1792 * then that setting will be returned. Otherwise, this method will 1793 * raise error. 1794 * 1795 * This method is only valid if the device has 1796 * PJMEDIA_VID_DEV_CAP_FORMAT capability in VideoDevInfo.caps flags, 1797 * otherwise Error will be thrown. 1798 * 1799 * @param dev_id The video device id. 1800 * @return keep The video format. 1801 */ 1802 MediaSize getInputScale(int dev_id) const throw(Error); 1803 1804 /** 1805 * This will configure fast switching to another video device. 1806 * If video device is currently active, the method will forward the setting 1807 * to the video device instance to be applied immediately, if it 1808 * supports it. 1809 * 1810 * This method is only valid if the device has 1811 * PJMEDIA_VID_DEV_CAP_OUTPUT_WINDOW_FLAGS capability in VideoDevInfo.caps 1812 * flags, otherwise Error will be thrown. 1813 * 1814 * Note that in case the setting is kept for future use, it will be applied 1815 * to any devices, even when application has changed the video device to be 1816 * used. 1817 * 1818 * @param dev_id The video device id. 1819 * @param flags The video window flag. 1820 * @param keep Specify whether the setting is to be kept for 1821 * future use. 1822 */ 1823 void setOutputWindowFlags(int dev_id, int flags, bool keep) throw(Error); 1824 1825 /** 1826 * Get the window output flags capability to the video device. 1827 * If video device is currently active, the method will forward the request 1828 * to the video device. If video device is currently inactive, and if 1829 * application had previously set the setting and mark the setting as kept, 1830 * then that setting will be returned. Otherwise, this method will 1831 * raise error. 1832 * 1833 * This method is only valid if the device has 1834 * PJMEDIA_VID_DEV_CAP_OUTPUT_WINDOW_FLAGS capability in VideoDevInfo.caps 1835 * flags, otherwise Error will be thrown. 1836 * 1837 * @param dev_id The video device id. 1838 * @return keep The video format. 1839 */ 1840 int getOutputWindowFlags(int dev_id) throw(Error); 1841 1842 /** 1843 * This will configure fast switching to another video device. 1844 * If video device is currently active, the method will forward the setting 1845 * to the video device instance to be applied immediately, if it 1846 * supports it. 1847 * 1848 * This method is only valid if the device has 1849 * PJMEDIA_VID_DEV_CAP_SWITCH capability in VideoDevInfo.caps flags, 1850 * otherwise Error will be thrown. 1851 * 1852 * @param dev_id The video device id. 1853 * @param param The video switch param. 1854 */ 1855 void switchDev(int dev_id, 1856 const VideoSwitchParam ¶m) throw(Error); 1675 1857 1676 1858 /** -
pjproject/trunk/pjsip/src/pjsua2/endpoint.cpp
r5131 r5139 1708 1708 pj_str_t codec_str = str2Pj(codec_id); 1709 1709 PJSUA2_CHECK_EXPR(pjsua_vid_codec_set_priority(&codec_str, priority)); 1710 #else 1711 PJ_UNUSED_ARG(codec_id); 1712 PJ_UNUSED_ARG(priority); 1710 1713 #endif 1711 1714 } … … 1719 1722 1720 1723 PJSUA2_CHECK_EXPR(pjsua_vid_codec_get_param(&codec_str, pj_param)); 1724 #else 1725 PJ_UNUSED_ARG(codec_id); 1721 1726 #endif 1722 1727 return pj_param; … … 1731 1736 1732 1737 PJSUA2_CHECK_EXPR(pjsua_vid_codec_set_param(&codec_str, pj_param)); 1738 #else 1739 PJ_UNUSED_ARG(codec_id); 1740 PJ_UNUSED_ARG(param); 1733 1741 #endif 1734 1742 } -
pjproject/trunk/pjsip/src/pjsua2/media.cpp
r5138 r5139 1020 1020 { 1021 1021 VideoWindowInfo vwi; 1022 pj_bzero(&vwi, sizeof(vwi)); 1022 1023 #if PJSUA_HAS_VIDEO 1023 1024 pjsua_vid_win_info pj_vwi; … … 1123 1124 { 1124 1125 pjsua_vid_preview_param param; 1126 pj_bzero(¶m, sizeof(param)); 1125 1127 #if PJSUA_HAS_VIDEO 1126 1128 param.rend_id = this->rendId; … … 1198 1200 maxBps = format.det.vid.max_bps; 1199 1201 #else 1202 PJ_UNUSED_ARG(format); 1200 1203 type = PJMEDIA_TYPE_UNKNOWN; 1201 1204 #endif … … 1227 1230 { 1228 1231 #if PJSUA_HAS_VIDEO 1232 id = dev_info.id; 1229 1233 name = dev_info.name; 1230 1234 driver = dev_info.driver; … … 1255 1259 1256 1260 /////////////////////////////////////////////////////////////////////////////// 1261 void VidDevManager::refreshDevs() throw(Error) 1262 { 1263 #if PJSUA_HAS_VIDEO 1264 PJSUA2_CHECK_EXPR(pjmedia_vid_dev_refresh()); 1265 #endif 1266 } 1267 1257 1268 unsigned VidDevManager::getDevCount() 1258 1269 { … … 1273 1284 1274 1285 dev_info.fromPj(pj_info); 1286 #else 1287 PJ_UNUSED_ARG(dev_id); 1275 1288 #endif 1276 1289 return dev_info; … … 1297 1310 } 1298 1311 1312 int VidDevManager::lookupDev(const string &drv_name, 1313 const string &dev_name) const throw(Error) 1314 { 1315 pjmedia_vid_dev_index pj_idx = 0; 1316 #if PJSUA_HAS_VIDEO 1317 PJSUA2_CHECK_EXPR(pjmedia_vid_dev_lookup(drv_name.c_str(), 1318 dev_name.c_str(), 1319 &pj_idx)); 1320 #else 1321 PJ_UNUSED_ARG(drv_name); 1322 PJ_UNUSED_ARG(dev_name); 1323 #endif 1324 return pj_idx; 1325 } 1326 1327 string VidDevManager::capName(pjmedia_vid_dev_cap cap) const 1328 { 1329 string cap_name; 1330 #if PJSUA_HAS_VIDEO 1331 cap_name = pjmedia_vid_dev_cap_name(cap, NULL); 1332 #else 1333 PJ_UNUSED_ARG(cap); 1334 #endif 1335 return cap_name; 1336 } 1337 1338 void VidDevManager::setFormat(int dev_id, 1339 const MediaFormatVideo &format, 1340 bool keep) throw(Error) 1341 { 1342 #if PJSUA_HAS_VIDEO 1343 pjmedia_format pj_format = format.toPj(); 1344 1345 PJSUA2_CHECK_EXPR(pjsua_vid_dev_set_setting(dev_id, 1346 PJMEDIA_VID_DEV_CAP_FORMAT, 1347 &pj_format, 1348 keep)); 1349 #else 1350 PJ_UNUSED_ARG(dev_id); 1351 PJ_UNUSED_ARG(format); 1352 PJ_UNUSED_ARG(keep); 1353 #endif 1354 } 1355 1356 MediaFormatVideo VidDevManager::getFormat(int dev_id) const throw(Error) 1357 { 1358 MediaFormatVideo vid_format; 1359 pj_bzero(&vid_format, sizeof(vid_format)); 1360 #if PJSUA_HAS_VIDEO 1361 pjmedia_format pj_format; 1362 PJSUA2_CHECK_EXPR(pjsua_vid_dev_get_setting(dev_id, 1363 PJMEDIA_VID_DEV_CAP_FORMAT, 1364 &pj_format)); 1365 vid_format.fromPj(pj_format); 1366 #else 1367 PJ_UNUSED_ARG(dev_id); 1368 #endif 1369 return vid_format; 1370 } 1371 1372 void VidDevManager::setInputScale(int dev_id, 1373 const MediaSize &scale, 1374 bool keep) throw(Error) 1375 { 1376 #if PJSUA_HAS_VIDEO 1377 pjmedia_rect_size pj_size; 1378 pj_size.w = scale.w; 1379 pj_size.h = scale.h; 1380 PJSUA2_CHECK_EXPR(pjsua_vid_dev_set_setting(dev_id, 1381 PJMEDIA_VID_DEV_CAP_INPUT_SCALE, 1382 &pj_size, 1383 keep)); 1384 #else 1385 PJ_UNUSED_ARG(dev_id); 1386 PJ_UNUSED_ARG(scale); 1387 PJ_UNUSED_ARG(keep); 1388 #endif 1389 } 1390 1391 MediaSize VidDevManager::getInputScale(int dev_id) const throw(Error) 1392 { 1393 MediaSize scale; 1394 pj_bzero(&scale, sizeof(scale)); 1395 #if PJSUA_HAS_VIDEO 1396 pjmedia_rect_size pj_size; 1397 PJSUA2_CHECK_EXPR(pjsua_vid_dev_get_setting(dev_id, 1398 PJMEDIA_VID_DEV_CAP_INPUT_SCALE, 1399 &pj_size)); 1400 1401 scale.w = pj_size.w; 1402 scale.h = pj_size.h; 1403 #else 1404 PJ_UNUSED_ARG(dev_id); 1405 #endif 1406 return scale; 1407 } 1408 1409 void VidDevManager::setOutputWindowFlags(int dev_id, 1410 int flags, 1411 bool keep) throw(Error) 1412 { 1413 #if PJSUA_HAS_VIDEO 1414 PJSUA2_CHECK_EXPR(pjsua_vid_dev_set_setting(dev_id, 1415 PJMEDIA_VID_DEV_CAP_OUTPUT_WINDOW_FLAGS, 1416 &flags, 1417 keep)); 1418 #else 1419 PJ_UNUSED_ARG(dev_id); 1420 PJ_UNUSED_ARG(flags); 1421 PJ_UNUSED_ARG(keep); 1422 #endif 1423 } 1424 1425 int VidDevManager::getOutputWindowFlags(int dev_id) throw(Error) 1426 { 1427 int flags = 0; 1428 1429 #if PJSUA_HAS_VIDEO 1430 PJSUA2_CHECK_EXPR(pjsua_vid_dev_get_setting(dev_id, 1431 PJMEDIA_VID_DEV_CAP_OUTPUT_WINDOW_FLAGS, 1432 &flags)); 1433 #else 1434 PJ_UNUSED_ARG(dev_id); 1435 #endif 1436 return flags; 1437 } 1438 1439 void VidDevManager::switchDev(int dev_id, 1440 const VideoSwitchParam ¶m) throw(Error) 1441 { 1442 #if PJSUA_HAS_VIDEO 1443 pjmedia_vid_dev_switch_param pj_param; 1444 pj_param.target_id = param.target_id; 1445 PJSUA2_CHECK_EXPR(pjsua_vid_dev_set_setting(dev_id, 1446 PJMEDIA_VID_DEV_CAP_SWITCH, 1447 &pj_param, 1448 PJ_FALSE)); 1449 #else 1450 PJ_UNUSED_ARG(dev_id); 1451 PJ_UNUSED_ARG(param); 1452 #endif 1453 } 1454 1299 1455 void VidDevManager::clearVideoDevList() 1300 1456 { … … 1325 1481 PJSUA2_CHECK_EXPR(pjsua_vid_dev_set_setting(dev_id, 1326 1482 PJMEDIA_VID_DEV_CAP_ORIENTATION, &orient, keep)); 1327 #endif 1328 } 1329 1483 #else 1484 PJ_UNUSED_ARG(dev_id); 1485 PJ_UNUSED_ARG(orient); 1486 PJ_UNUSED_ARG(keep); 1487 #endif 1488 } 1330 1489 1331 1490 VidDevManager::VidDevManager()
Note: See TracChangeset
for help on using the changeset viewer.