From 8c6f78c4426aae98c9d72b14afd010a3458a662d Mon Sep 17 00:00:00 2001 From: Riza Sulistyo Date: Fri, 21 Aug 2015 06:00:46 +0000 Subject: Re #1879: - Implement set video codec param in PJSUA2 API - Fix bug in videoCodecEnum and updateCodecInfoList git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@5165 74dad513-b988-da41-8d7b-12977e46ad98 --- pjsip/include/pjsua2/call.hpp | 6 ----- pjsip/include/pjsua2/endpoint.hpp | 17 ++++++++---- pjsip/include/pjsua2/media.hpp | 57 +++++++++++++++++++++++++++++++++++++-- 3 files changed, 67 insertions(+), 13 deletions(-) (limited to 'pjsip/include') diff --git a/pjsip/include/pjsua2/call.hpp b/pjsip/include/pjsua2/call.hpp index 0614270e..917965e5 100644 --- a/pjsip/include/pjsua2/call.hpp +++ b/pjsip/include/pjsua2/call.hpp @@ -46,12 +46,6 @@ using std::vector; ////////////////////////////////////////////////////////////////////////////// -/** - * Codec parameters, corresponds to pjmedia_codec_param or - * pjmedia_vid_codec_param. - */ -typedef void *CodecParam; - /** * Media stream, corresponds to pjmedia_stream */ diff --git a/pjsip/include/pjsua2/endpoint.hpp b/pjsip/include/pjsua2/endpoint.hpp index ac97ea89..e4039874 100644 --- a/pjsip/include/pjsua2/endpoint.hpp +++ b/pjsip/include/pjsua2/endpoint.hpp @@ -1150,18 +1150,25 @@ public: * will be thrown. * */ - CodecParam videoCodecGetParam(const string &codec_id) const throw(Error); + VidCodecParam getVideoCodecParam(const string &codec_id) const throw(Error); /** * Set video codec parameters. * * @param codec_id Codec ID. - * @param param Codec parameter to set. Set to NULL to reset - * codec parameter to library default settings. + * @param param Codec parameter to set. + * + */ + void setVideoCodecParam(const string &codec_id, + const VidCodecParam ¶m) throw(Error); + + /** + * Reset video codec parameters to library default settings. + * + * @param codec_id Codec ID. * */ - void videoCodecSetParam(const string &codec_id, - const CodecParam param) throw(Error); + void resetVideoCodecParam(const string &codec_id) throw(Error); public: /* diff --git a/pjsip/include/pjsua2/media.hpp b/pjsip/include/pjsua2/media.hpp index 82909165..e642d171 100644 --- a/pjsip/include/pjsua2/media.hpp +++ b/pjsip/include/pjsua2/media.hpp @@ -1941,11 +1941,64 @@ struct CodecInfo typedef std::vector CodecInfoVector; /** - * Codec parameters, corresponds to pjmedia_codec_param or - * pjmedia_vid_codec_param. + * Codec parameters, corresponds to pjmedia_codec_param. */ typedef void *CodecParam; +/** + * Structure of codec specific parameters which contains name=value pairs. + * The codec specific parameters are to be used with SDP according to + * the standards (e.g: RFC 3555) in SDP 'a=fmtp' attribute. + */ +typedef struct CodecFmtp +{ + string name; + string val; +} CodecFmtp; + +/** Array of codec fmtp */ +typedef std::vector CodecFmtpVector; + +/** + * Detailed codec attributes used in configuring a codec and in querying + * the capability of codec factories. + * + * Please note that codec parameter also contains SDP specific setting, + * #decFmtp and #encFmtp, which may need to be set appropriately based on + * the effective setting. See each codec documentation for more detail. + */ +struct VidCodecParam +{ + pjmedia_dir dir; /**< Direction */ + pjmedia_vid_packing packing; /**< Packetization strategy. */ + + struct + MediaFormatVideo encFmt; /**< Encoded format */ + CodecFmtpVector encFmtp; /**< Encoder fmtp params */ + unsigned encMtu; /**< MTU or max payload size setting*/ + + struct + MediaFormatVideo decFmt; /**< Decoded format */ + CodecFmtpVector decFmtp; /**< Decoder fmtp params */ + + bool ignoreFmtp; /**< Ignore fmtp params. If set to + true, the codec will apply + format settings specified in + encFmt and decFmt only. */ + + void fromPj(const pjmedia_vid_codec_param ¶m); + + pjmedia_vid_codec_param toPj() const; + +private: + void setCodecFmtp(const pjmedia_codec_fmtp &in_fmtp, + CodecFmtpVector &out_fmtp); + + void getCodecFmtp(const CodecFmtpVector &in_fmtp, + pjmedia_codec_fmtp &out_fmtp) const; + +}; + /** * @} // PJSUA2_MED -- cgit v1.2.3