Changeset 5123
- Timestamp:
- Jul 1, 2015 2:20:12 AM (9 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/swig/pjsua2.i
r5100 r5123 102 102 %template(AudioDevInfoVector) std::vector<pj::AudioDevInfo*>; 103 103 %template(CodecInfoVector) std::vector<pj::CodecInfo*>; 104 %template(VideoDevInfoVector) std::vector<pj::VideoDevInfo*>; 104 105 105 106 /* pj::WindowHandle::setWindow() receives Surface object */ -
pjproject/trunk/pjsip-apps/src/swig/symbols.i
r4968 r5123 49 49 enum pjmedia_vid_dev_std_index {PJMEDIA_VID_DEFAULT_CAPTURE_DEV = -1, PJMEDIA_VID_DEFAULT_RENDER_DEV = -2, PJMEDIA_VID_INVALID_DEV = -3}; 50 50 51 typedef enum pjmedia_vid_dev_cap {PJMEDIA_VID_DEV_CAP_FORMAT = 1, PJMEDIA_VID_DEV_CAP_INPUT_SCALE = 2, PJMEDIA_VID_DEV_CAP_OUTPUT_WINDOW = 4, PJMEDIA_VID_DEV_CAP_OUTPUT_RESIZE = 8, PJMEDIA_VID_DEV_CAP_OUTPUT_POSITION = 16, PJMEDIA_VID_DEV_CAP_OUTPUT_HIDE = 32, PJMEDIA_VID_DEV_CAP_INPUT_PREVIEW = 64, PJMEDIA_VID_DEV_CAP_ORIENTATION = 128, PJMEDIA_VID_DEV_CAP_SWITCH = 256, PJMEDIA_VID_DEV_CAP_OUTPUT_WINDOW_FLAGS = 512, PJMEDIA_VID_DEV_CAP_MAX = 16384} pjmedia_vid_dev_cap; 52 51 53 typedef enum pjmedia_aud_dev_route {PJMEDIA_AUD_DEV_ROUTE_DEFAULT = 0, PJMEDIA_AUD_DEV_ROUTE_LOUDSPEAKER = 1, PJMEDIA_AUD_DEV_ROUTE_EARPIECE = 2, PJMEDIA_AUD_DEV_ROUTE_BLUETOOTH = 4} pjmedia_aud_dev_route; 52 54 … … 92 94 typedef enum pjmedia_tp_proto {PJMEDIA_TP_PROTO_NONE = 0, PJMEDIA_TP_PROTO_RTP_AVP, PJMEDIA_TP_PROTO_RTP_SAVP, PJMEDIA_TP_PROTO_UNKNOWN} pjmedia_tp_proto; 93 95 94 typedef enum pjmedia_format_id {PJMEDIA_FORMAT_L16 = 0, PJMEDIA_FORMAT_PCM = PJMEDIA_FORMAT_L16, PJMEDIA_FORMAT_PCMA = ((('W' << 24) | ('A' << 16)) | ('L' << 8)) | 'A', PJMEDIA_FORMAT_ALAW = PJMEDIA_FORMAT_PCMA, PJMEDIA_FORMAT_PCMU = ((('W' << 24) | ('A' << 16)) | ('L' << 8)) | 'u', PJMEDIA_FORMAT_ULAW = PJMEDIA_FORMAT_PCMU, PJMEDIA_FORMAT_AMR = ((('R' << 24) | ('M' << 16)) | ('A' << 8)) | ' ', PJMEDIA_FORMAT_G729 = ((('9' << 24) | ('2' << 16)) | ('7' << 8)) | 'G', PJMEDIA_FORMAT_ILBC = ((('C' << 24) | ('B' << 16)) | ('L' << 8)) | 'I', PJMEDIA_FORMAT_RGB24 = ((('3' << 24) | ('B' << 16)) | ('G' << 8)) | 'R', PJMEDIA_FORMAT_RGBA = ((('A' << 24) | ('B' << 16)) | ('G' << 8)) | 'R', PJMEDIA_FORMAT_BGRA = ((('A' << 24) | ('R' << 16)) | ('G' << 8)) | 'B', PJMEDIA_FORMAT_RGB32 = PJMEDIA_FORMAT_RGBA, PJMEDIA_FORMAT_DIB = (((' ' << 24) | ('B' << 16)) | ('I' << 8)) | 'D', PJMEDIA_FORMAT_GBRP = ((('P' << 24) | ('R' << 16)) | ('B' << 8)) | 'G', PJMEDIA_FORMAT_AYUV = ((('V' << 24) | ('U' << 16)) | ('Y' << 8)) | 'A', PJMEDIA_FORMAT_YUY2 = ((('2' << 24) | ('Y' << 16)) | ('U' << 8)) | 'Y', PJMEDIA_FORMAT_UYVY = ((('Y' << 24) | ('V' << 16)) | ('Y' << 8)) | 'U', PJMEDIA_FORMAT_YVYU = ((('U' << 24) | ('Y' << 16)) | ('V' << 8)) | 'Y', PJMEDIA_FORMAT_I420 = ((('0' << 24) | ('2' << 16)) | ('4' << 8)) | 'I', PJMEDIA_FORMAT_IYUV = PJMEDIA_FORMAT_I420, PJMEDIA_FORMAT_YV12 = ((('2' << 24) | ('1' << 16)) | ('V' << 8)) | 'Y', PJMEDIA_FORMAT_ I422 = ((('2' << 24) | ('2' << 16)) | ('4' << 8)) | 'I', PJMEDIA_FORMAT_I420JPEG = ((('0' << 24) | ('2' << 16)) | ('4' << 8)) | 'J', PJMEDIA_FORMAT_I422JPEG = ((('2' << 24) | ('2' << 16)) | ('4' << 8)) | 'J', PJMEDIA_FORMAT_H261 = ((('1' << 24) | ('6' << 16)) | ('2' << 8)) | 'H', PJMEDIA_FORMAT_H263 = ((('3' << 24) | ('6' << 16)) | ('2' << 8)) | 'H', PJMEDIA_FORMAT_H263P = ((('3' << 24) | ('6' << 16)) | ('2' << 8)) | 'P', PJMEDIA_FORMAT_H264 = ((('4' << 24) | ('6' << 16)) | ('2' << 8)) | 'H', PJMEDIA_FORMAT_MJPEG = ((('G' << 24) | ('P' << 16)) | ('J' << 8)) | 'M', PJMEDIA_FORMAT_MPEG1VIDEO = ((('V' << 24) | ('1' << 16)) | ('P' << 8)) | 'M', PJMEDIA_FORMAT_MPEG2VIDEO = ((('V' << 24) | ('2' << 16)) | ('P' << 8)) | 'M', PJMEDIA_FORMAT_MPEG4 = ((('4' << 24) | ('G' << 16)) | ('P' << 8)) | 'M'} pjmedia_format_id;96 typedef enum pjmedia_format_id {PJMEDIA_FORMAT_L16 = 0, PJMEDIA_FORMAT_PCM = PJMEDIA_FORMAT_L16, PJMEDIA_FORMAT_PCMA = ((('W' << 24) | ('A' << 16)) | ('L' << 8)) | 'A', PJMEDIA_FORMAT_ALAW = PJMEDIA_FORMAT_PCMA, PJMEDIA_FORMAT_PCMU = ((('W' << 24) | ('A' << 16)) | ('L' << 8)) | 'u', PJMEDIA_FORMAT_ULAW = PJMEDIA_FORMAT_PCMU, PJMEDIA_FORMAT_AMR = ((('R' << 24) | ('M' << 16)) | ('A' << 8)) | ' ', PJMEDIA_FORMAT_G729 = ((('9' << 24) | ('2' << 16)) | ('7' << 8)) | 'G', PJMEDIA_FORMAT_ILBC = ((('C' << 24) | ('B' << 16)) | ('L' << 8)) | 'I', PJMEDIA_FORMAT_RGB24 = ((('3' << 24) | ('B' << 16)) | ('G' << 8)) | 'R', PJMEDIA_FORMAT_RGBA = ((('A' << 24) | ('B' << 16)) | ('G' << 8)) | 'R', PJMEDIA_FORMAT_BGRA = ((('A' << 24) | ('R' << 16)) | ('G' << 8)) | 'B', PJMEDIA_FORMAT_RGB32 = PJMEDIA_FORMAT_RGBA, PJMEDIA_FORMAT_DIB = (((' ' << 24) | ('B' << 16)) | ('I' << 8)) | 'D', PJMEDIA_FORMAT_GBRP = ((('P' << 24) | ('R' << 16)) | ('B' << 8)) | 'G', PJMEDIA_FORMAT_AYUV = ((('V' << 24) | ('U' << 16)) | ('Y' << 8)) | 'A', PJMEDIA_FORMAT_YUY2 = ((('2' << 24) | ('Y' << 16)) | ('U' << 8)) | 'Y', PJMEDIA_FORMAT_UYVY = ((('Y' << 24) | ('V' << 16)) | ('Y' << 8)) | 'U', PJMEDIA_FORMAT_YVYU = ((('U' << 24) | ('Y' << 16)) | ('V' << 8)) | 'Y', PJMEDIA_FORMAT_I420 = ((('0' << 24) | ('2' << 16)) | ('4' << 8)) | 'I', PJMEDIA_FORMAT_IYUV = PJMEDIA_FORMAT_I420, PJMEDIA_FORMAT_YV12 = ((('2' << 24) | ('1' << 16)) | ('V' << 8)) | 'Y', PJMEDIA_FORMAT_NV21 = ((('1' << 24) | ('2' << 16)) | ('V' << 8)) | 'N', PJMEDIA_FORMAT_I422 = ((('2' << 24) | ('2' << 16)) | ('4' << 8)) | 'I', PJMEDIA_FORMAT_I420JPEG = ((('0' << 24) | ('2' << 16)) | ('4' << 8)) | 'J', PJMEDIA_FORMAT_I422JPEG = ((('2' << 24) | ('2' << 16)) | ('4' << 8)) | 'J', PJMEDIA_FORMAT_H261 = ((('1' << 24) | ('6' << 16)) | ('2' << 8)) | 'H', PJMEDIA_FORMAT_H263 = ((('3' << 24) | ('6' << 16)) | ('2' << 8)) | 'H', PJMEDIA_FORMAT_H263P = ((('3' << 24) | ('6' << 16)) | ('2' << 8)) | 'P', PJMEDIA_FORMAT_H264 = ((('4' << 24) | ('6' << 16)) | ('2' << 8)) | 'H', PJMEDIA_FORMAT_MJPEG = ((('G' << 24) | ('P' << 16)) | ('J' << 8)) | 'M', PJMEDIA_FORMAT_MPEG1VIDEO = ((('V' << 24) | ('1' << 16)) | ('P' << 8)) | 'M', PJMEDIA_FORMAT_MPEG2VIDEO = ((('V' << 24) | ('2' << 16)) | ('P' << 8)) | 'M', PJMEDIA_FORMAT_MPEG4 = ((('4' << 24) | ('G' << 16)) | ('P' << 8)) | 'M'} pjmedia_format_id; 95 97 96 98 typedef enum pjsip_cred_data_type {PJSIP_CRED_DATA_PLAIN_PASSWD = 0, PJSIP_CRED_DATA_DIGEST = 1, PJSIP_CRED_DATA_EXT_AKA = 16} pjsip_cred_data_type; … … 156 158 typedef enum pjsua_vid_req_keyframe_method {PJSUA_VID_REQ_KEYFRAME_SIP_INFO = 1, PJSUA_VID_REQ_KEYFRAME_RTCP_PLI = 2} pjsua_vid_req_keyframe_method; 157 159 158 typedef enum pjsua_call_flag {PJSUA_CALL_UNHOLD = 1, PJSUA_CALL_UPDATE_CONTACT = 2, PJSUA_CALL_INCLUDE_DISABLED_MEDIA = 4 } pjsua_call_flag;160 typedef enum pjsua_call_flag {PJSUA_CALL_UNHOLD = 1, PJSUA_CALL_UPDATE_CONTACT = 2, PJSUA_CALL_INCLUDE_DISABLED_MEDIA = 4, PJSUA_CALL_NO_SDP_OFFER = 8} pjsua_call_flag; 159 161 160 162 typedef enum pjsua_create_media_transport_flag {PJSUA_MED_TP_CLOSE_MEMBER = 1} pjsua_create_media_transport_flag; -
pjproject/trunk/pjsip-apps/src/swig/symbols.lst
r4968 r5123 11 11 pjmedia/transport_srtp.h pjmedia_srtp_use 12 12 pjmedia/vid_stream.h pjmedia_vid_stream_rc_method 13 pjmedia-videodev/videodev.h pjmedia_vid_dev_index pjmedia_vid_dev_std_index 13 pjmedia-videodev/videodev.h pjmedia_vid_dev_index pjmedia_vid_dev_std_index pjmedia_vid_dev_cap 14 14 pjmedia-audiodev/audiodev.h pjmedia_aud_dev_route pjmedia_aud_dev_cap 15 15 pjmedia/wav_port.h pjmedia_file_writer_option pjmedia_file_player_option -
pjproject/trunk/pjsip/include/pjsua2/endpoint.hpp
r5120 r5123 1070 1070 AudDevManager &audDevManager(); 1071 1071 1072 /** 1073 * Get the instance of Video Device Manager. 1074 * 1075 * @return The Video Device Manager. 1076 */ 1077 VidDevManager &vidDevManager(); 1078 1072 1079 /************************************************************************* 1073 1080 * Codec management operations … … 1096 1103 * Get codec parameters. 1097 1104 * 1098 * @param codec_id 1099 * 1100 * @return 1101 * 1105 * @param codec_id Codec ID. 1106 * 1107 * @return Codec parameters. If codec is not found, Error 1108 * will be thrown. 1102 1109 * 1103 1110 */ … … 1115 1122 const CodecParam param) throw(Error); 1116 1123 1124 /** 1125 * Enum all supported video codecs in the system. 1126 * 1127 * @return Array of video codec info. 1128 */ 1129 const CodecInfoVector &videoCodecEnum() throw(Error); 1130 1131 /** 1132 * Change video codec priority. 1133 * 1134 * @param codec_id Codec ID, which is a string that uniquely identify 1135 * the codec (such as "H263/90000"). Please see pjsua 1136 * manual or pjmedia codec reference for details. 1137 * @param priority Codec priority, 0-255, where zero means to disable 1138 * the codec. 1139 * 1140 */ 1141 void videoCodecSetPriority(const string &codec_id, 1142 pj_uint8_t priority) throw(Error); 1143 1144 /** 1145 * Get video codec parameters. 1146 * 1147 * @param codec_id Codec ID. 1148 * 1149 * @return Codec parameters. If codec is not found, Error 1150 * will be thrown. 1151 * 1152 */ 1153 CodecParam videoCodecGetParam(const string &codec_id) const throw(Error); 1154 1155 /** 1156 * Set video codec parameters. 1157 * 1158 * @param codec_id Codec ID. 1159 * @param param Codec parameter to set. Set to NULL to reset 1160 * codec parameter to library default settings. 1161 * 1162 */ 1163 void videoCodecSetParam(const string &codec_id, 1164 const CodecParam param) throw(Error); 1117 1165 1118 1166 public: … … 1183 1231 AudioMediaVector mediaList; 1184 1232 AudDevManager audioDevMgr; 1233 VidDevManager videoDevMgr; 1185 1234 CodecInfoVector codecInfoList; 1235 CodecInfoVector videoCodecInfoList; 1186 1236 std::map<pj_thread_t*, pj_thread_desc*> threadDescMap; 1187 1237 … … 1317 1367 1318 1368 private: 1319 void clearCodecInfoList(); 1369 void clearCodecInfoList(CodecInfoVector &codec_list); 1370 void updateCodecInfoList(pjsua_codec_info pj_codec[], unsigned count, 1371 CodecInfoVector &codec_list); 1320 1372 1321 1373 }; -
pjproject/trunk/pjsip/include/pjsua2/media.hpp
r5102 r5123 90 90 struct MediaFormatVideo : public MediaFormat 91 91 { 92 unsigned width; /**< Video width. */93 unsigned height; /**< Video height. 92 unsigned width; /**< Video width. */ 93 unsigned height; /**< Video height. */ 94 94 int fpsNum; /**< Frames per second numerator. */ 95 95 int fpsDenum; /**< Frames per second denumerator. */ 96 96 pj_uint32_t avgBps; /**< Average bitrate. */ 97 97 pj_uint32_t maxBps; /**< Maximum bitrate. */ 98 99 /** 100 * Construct from pjmedia_format. 101 */ 102 void fromPj(const pjmedia_format &format); 103 104 /** 105 * Export to pjmedia_format. 106 */ 107 pjmedia_format toPj() const; 98 108 }; 99 109 … … 1588 1598 }; 1589 1599 1600 /** 1601 * Video device information structure. 1602 */ 1603 struct VideoDevInfo 1604 { 1605 /** 1606 * The device name 1607 */ 1608 string name; 1609 1610 /** 1611 * The underlying driver name 1612 */ 1613 string driver; 1614 1615 /** 1616 * The supported direction of the video device, i.e. whether it supports 1617 * capture only, render only, or both. 1618 */ 1619 pjmedia_dir dir; 1620 1621 /** 1622 * Device capabilities, as bitmask combination of #pjmedia_vid_dev_cap 1623 */ 1624 unsigned caps; 1625 1626 /** 1627 * Array of supported video formats. Some fields in each supported video 1628 * format may be set to zero or of "unknown" value, to indicate that the 1629 * value is unknown or should be ignored. When these value are not set 1630 * to zero, it indicates that the exact format combination is being used. 1631 */ 1632 MediaFormatVector fmt; 1633 1634 /** 1635 * Construct from pjmedia_vid_dev_info. 1636 */ 1637 void fromPj(const pjmedia_vid_dev_info &dev_info); 1638 1639 /** 1640 * Destructor. 1641 */ 1642 ~VideoDevInfo(); 1643 }; 1644 1645 /** Array of video device info */ 1646 typedef std::vector<VideoDevInfo*> VideoDevInfoVector; 1647 1648 /** 1649 * Video device manager. 1650 */ 1651 class VidDevManager { 1652 public: 1653 /** 1654 * Get the number of video devices installed in the system. 1655 * 1656 * @return The number of devices. 1657 */ 1658 unsigned getDevCount(); 1659 1660 /** 1661 * Retrieve the video device info for the specified device index. 1662 * 1663 * @param dev_id The video device id 1664 * 1665 * @return The list of video device info 1666 */ 1667 VideoDevInfo getDevInfo(int dev_id) const throw(Error); 1668 1669 /** 1670 * Enum all video devices installed in the system. 1671 * 1672 * @return The list of video device info 1673 */ 1674 const VideoDevInfoVector &enumDev() throw(Error); 1675 1676 private: 1677 VideoDevInfoVector videoDevList; 1678 1679 void clearVideoDevList(); 1680 1681 /** 1682 * Constructor. 1683 */ 1684 VidDevManager(); 1685 1686 /** 1687 * Destructor. 1688 */ 1689 ~VidDevManager(); 1690 1691 friend class Endpoint; 1692 }; 1693 1694 1590 1695 /************************************************************************* 1591 1696 * Codec management -
pjproject/trunk/pjsip/src/pjsua2/endpoint.cpp
r5121 r5123 388 388 } 389 389 390 clearCodecInfoList(); 390 clearCodecInfoList(codecInfoList); 391 clearCodecInfoList(videoCodecInfoList); 391 392 392 393 try { … … 1619 1620 } 1620 1621 1622 VidDevManager &Endpoint::vidDevManager() 1623 { 1624 return videoDevMgr; 1625 } 1626 1621 1627 /* 1622 1628 * Codec operations. … … 1629 1635 PJSUA2_CHECK_EXPR( pjsua_enum_codecs(pj_codec, &count) ); 1630 1636 1637 updateCodecInfoList(pj_codec, count, codecInfoList); 1638 return codecInfoList; 1639 } 1640 1641 void Endpoint::codecSetPriority(const string &codec_id, 1642 pj_uint8_t priority) throw(Error) 1643 { 1644 pj_str_t codec_str = str2Pj(codec_id); 1645 PJSUA2_CHECK_EXPR( pjsua_codec_set_priority(&codec_str, priority) ); 1646 } 1647 1648 CodecParam Endpoint::codecGetParam(const string &codec_id) const throw(Error) 1649 { 1650 pjmedia_codec_param *pj_param = NULL; 1651 pj_str_t codec_str = str2Pj(codec_id); 1652 1653 PJSUA2_CHECK_EXPR( pjsua_codec_get_param(&codec_str, pj_param) ); 1654 1655 return pj_param; 1656 } 1657 1658 void Endpoint::codecSetParam(const string &codec_id, 1659 const CodecParam param) throw(Error) 1660 { 1661 pj_str_t codec_str = str2Pj(codec_id); 1662 pjmedia_codec_param *pj_param = (pjmedia_codec_param*)param; 1663 1664 PJSUA2_CHECK_EXPR( pjsua_codec_set_param(&codec_str, pj_param) ); 1665 } 1666 1667 void Endpoint::clearCodecInfoList(CodecInfoVector &codec_list) 1668 { 1669 for (unsigned i=0;i<codec_list.size();++i) { 1670 delete codec_list[i]; 1671 } 1672 codec_list.clear(); 1673 } 1674 1675 void Endpoint::updateCodecInfoList(pjsua_codec_info pj_codec[], unsigned count, 1676 CodecInfoVector &codec_list) 1677 { 1631 1678 pj_enter_critical_section(); 1632 clearCodecInfoList( );1633 for (unsigned i =0; i<count; ++i) {1679 clearCodecInfoList(codec_list); 1680 for (unsigned i = 0; i<count; ++i) { 1634 1681 CodecInfo *codec_info = new CodecInfo; 1635 1682 … … 1638 1685 } 1639 1686 pj_leave_critical_section(); 1687 } 1688 1689 const CodecInfoVector &Endpoint::videoCodecEnum() throw(Error) 1690 { 1691 #if PJSUA_HAS_VIDEO 1692 pjsua_codec_info pj_codec[MAX_CODEC_NUM]; 1693 unsigned count = MAX_CODEC_NUM; 1694 1695 PJSUA2_CHECK_EXPR(pjsua_vid_enum_codecs(pj_codec, &count)); 1696 1697 updateCodecInfoList(pj_codec, count, videoCodecInfoList); 1698 #endif 1640 1699 return codecInfoList; 1641 1700 } 1642 1701 1643 void Endpoint::codecSetPriority(const string &codec_id, 1644 pj_uint8_t priority) throw(Error) 1645 { 1702 void Endpoint::videoCodecSetPriority(const string &codec_id, 1703 pj_uint8_t priority) throw(Error) 1704 { 1705 #if PJSUA_HAS_VIDEO 1646 1706 pj_str_t codec_str = str2Pj(codec_id); 1647 PJSUA2_CHECK_EXPR( pjsua_codec_set_priority(&codec_str, priority) ); 1648 } 1649 1650 CodecParam Endpoint::codecGetParam(const string &codec_id) const throw(Error) 1651 { 1652 pjmedia_codec_param *pj_param = NULL; 1707 PJSUA2_CHECK_EXPR(pjsua_vid_codec_set_priority(&codec_str, priority)); 1708 #endif 1709 } 1710 1711 CodecParam Endpoint::videoCodecGetParam(const string &codec_id) const 1712 throw(Error) 1713 { 1714 pjmedia_vid_codec_param *pj_param = NULL; 1715 #if PJSUA_HAS_VIDEO 1653 1716 pj_str_t codec_str = str2Pj(codec_id); 1654 1717 1655 PJSUA2_CHECK_EXPR( pjsua_codec_get_param(&codec_str, pj_param));1656 1718 PJSUA2_CHECK_EXPR(pjsua_vid_codec_get_param(&codec_str, pj_param)); 1719 #endif 1657 1720 return pj_param; 1658 1721 } 1659 1722 1660 void Endpoint::codecSetParam(const string &codec_id, 1661 const CodecParam param) throw(Error) 1662 { 1723 void Endpoint::videoCodecSetParam(const string &codec_id, 1724 const CodecParam param) throw(Error) 1725 { 1726 #if PJSUA_HAS_VIDEO 1663 1727 pj_str_t codec_str = str2Pj(codec_id); 1664 pjmedia_codec_param *pj_param = (pjmedia_codec_param*)param; 1665 1666 PJSUA2_CHECK_EXPR( pjsua_codec_set_param(&codec_str, pj_param) ); 1667 } 1668 1669 void Endpoint::clearCodecInfoList() 1670 { 1671 for (unsigned i=0;i<codecInfoList.size();++i) { 1672 delete codecInfoList[i]; 1673 } 1674 codecInfoList.clear(); 1675 } 1728 pjmedia_vid_codec_param *pj_param = (pjmedia_vid_codec_param*)param; 1729 1730 PJSUA2_CHECK_EXPR(pjsua_vid_codec_set_param(&codec_str, pj_param)); 1731 #endif 1732 } 1733 -
pjproject/trunk/pjsip/src/pjsua2/media.cpp
r5102 r5123 1095 1095 } 1096 1096 /////////////////////////////////////////////////////////////////////////////// 1097 1098 1097 VideoPreviewOpParam::VideoPreviewOpParam() 1099 1098 { … … 1178 1177 1179 1178 /////////////////////////////////////////////////////////////////////////////// 1179 void MediaFormatVideo::fromPj(const pjmedia_format &format) 1180 { 1181 #if PJSUA_HAS_VIDEO 1182 if ((format.type != PJMEDIA_TYPE_VIDEO) && 1183 (format.detail_type != PJMEDIA_FORMAT_DETAIL_VIDEO)) 1184 { 1185 type = PJMEDIA_TYPE_UNKNOWN; 1186 return; 1187 } 1188 1189 id = format.id; 1190 type = format.type; 1191 1192 /* Detail. */ 1193 width = format.det.vid.size.w; 1194 height = format.det.vid.size.h; 1195 fpsNum = format.det.vid.fps.num; 1196 fpsDenum = format.det.vid.fps.denum; 1197 avgBps = format.det.vid.avg_bps; 1198 maxBps = format.det.vid.max_bps; 1199 #else 1200 type = PJMEDIA_TYPE_UNKNOWN; 1201 #endif 1202 } 1203 1204 pjmedia_format MediaFormatVideo::toPj() const 1205 { 1206 pjmedia_format pj_format; 1207 1208 #if PJSUA_HAS_VIDEO 1209 pj_format.id = id; 1210 pj_format.type = type; 1211 1212 pj_format.detail_type = PJMEDIA_FORMAT_DETAIL_VIDEO; 1213 pj_format.det.vid.size.w = width; 1214 pj_format.det.vid.size.h = height; 1215 pj_format.det.vid.fps.num = fpsNum; 1216 pj_format.det.vid.fps.denum = fpsDenum; 1217 pj_format.det.vid.avg_bps = avgBps; 1218 pj_format.det.vid.max_bps = maxBps; 1219 #else 1220 pj_format.type = PJMEDIA_TYPE_UNKNOWN; 1221 #endif 1222 return pj_format; 1223 } 1224 1225 /////////////////////////////////////////////////////////////////////////////// 1226 void VideoDevInfo::fromPj(const pjmedia_vid_dev_info &dev_info) 1227 { 1228 #if PJSUA_HAS_VIDEO 1229 name = dev_info.name; 1230 driver = dev_info.driver; 1231 dir = dev_info.dir; 1232 caps = dev_info.caps; 1233 1234 for (unsigned i = 0; i<dev_info.fmt_cnt;++i) { 1235 MediaFormatVideo *format = new MediaFormatVideo; 1236 1237 format->fromPj(dev_info.fmt[i]); 1238 if (format->type == PJMEDIA_TYPE_VIDEO) 1239 fmt.push_back(format); 1240 } 1241 #else 1242 PJ_UNUSED_ARG(dev_info); 1243 #endif 1244 } 1245 1246 VideoDevInfo::~VideoDevInfo() 1247 { 1248 #if PJSUA_HAS_VIDEO 1249 for (unsigned i = 0;i<fmt.size();++i) { 1250 delete fmt[i]; 1251 } 1252 fmt.clear(); 1253 #endif 1254 } 1255 1256 /////////////////////////////////////////////////////////////////////////////// 1257 unsigned VidDevManager::getDevCount() 1258 { 1259 #if PJSUA_HAS_VIDEO 1260 return pjsua_vid_dev_count(); 1261 #else 1262 return 0; 1263 #endif 1264 } 1265 1266 VideoDevInfo VidDevManager::getDevInfo(int dev_id) const throw(Error) 1267 { 1268 VideoDevInfo dev_info; 1269 #if PJSUA_HAS_VIDEO 1270 pjmedia_vid_dev_info pj_info; 1271 1272 PJSUA2_CHECK_EXPR(pjsua_vid_dev_get_info(dev_id, &pj_info)); 1273 1274 dev_info.fromPj(pj_info); 1275 #endif 1276 return dev_info; 1277 } 1278 1279 const VideoDevInfoVector &VidDevManager::enumDev() throw(Error) 1280 { 1281 #if PJSUA_HAS_VIDEO 1282 pjmedia_vid_dev_info pj_info[MAX_DEV_COUNT]; 1283 unsigned count = MAX_DEV_COUNT; 1284 1285 PJSUA2_CHECK_EXPR(pjsua_vid_enum_devs(pj_info, &count)); 1286 1287 pj_enter_critical_section(); 1288 clearVideoDevList(); 1289 for (unsigned i = 0; i<count;++i) { 1290 VideoDevInfo *dev_info = new VideoDevInfo; 1291 dev_info->fromPj(pj_info[i]); 1292 videoDevList.push_back(dev_info); 1293 } 1294 pj_leave_critical_section(); 1295 #endif 1296 return videoDevList; 1297 } 1298 1299 void VidDevManager::clearVideoDevList() 1300 { 1301 #if PJSUA_HAS_VIDEO 1302 for (unsigned i = 0;i<videoDevList.size();++i) { 1303 delete videoDevList[i]; 1304 } 1305 videoDevList.clear(); 1306 #endif 1307 } 1308 1309 VidDevManager::VidDevManager() 1310 { 1311 } 1312 1313 VidDevManager::~VidDevManager() 1314 { 1315 #if PJSUA_HAS_VIDEO 1316 clearVideoDevList(); 1317 #endif 1318 } 1319 1320 /////////////////////////////////////////////////////////////////////////////// 1180 1321 void CodecInfo::fromPj(const pjsua_codec_info &codec_info) 1181 1322 {
Note: See TracChangeset
for help on using the changeset viewer.