diff options
author | Riza Sulistyo <riza@teluu.com> | 2015-05-28 07:14:24 +0000 |
---|---|---|
committer | Riza Sulistyo <riza@teluu.com> | 2015-05-28 07:14:24 +0000 |
commit | 5bb6d872c7bd5a258152fcb57b16acaf3012385f (patch) | |
tree | 15286090bc713fcb91b856059fcc5474517a7a52 /pjsip/include/pjsua2 | |
parent | 1f5cf04d6dad8d08da58b086aad46cee580ea8d3 (diff) |
Re #1855 (Pjsua2 Video Preview API): Add Pjsua2 Preview API and sample usage in pjsua2 app for android.
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@5102 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/include/pjsua2')
-rw-r--r-- | pjsip/include/pjsua2/media.hpp | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/pjsip/include/pjsua2/media.hpp b/pjsip/include/pjsua2/media.hpp index 181001e4..16df4ca5 100644 --- a/pjsip/include/pjsua2/media.hpp +++ b/pjsip/include/pjsua2/media.hpp @@ -1488,6 +1488,105 @@ private: pjsua_vid_win_id winId; }; +/** + * This structure contains parameters for VideoPreview::start() + */ +struct VideoPreviewOpParam { + /** + * Device ID for the video renderer to be used for rendering the + * capture stream for preview. This parameter is ignored if native + * preview is being used. + * + * Default: PJMEDIA_VID_DEFAULT_RENDER_DEV + */ + pjmedia_vid_dev_index rendId; + + /** + * Show window initially. + * + * Default: PJ_TRUE. + */ + bool show; + + /** + * Window flags. The value is a bitmask combination of + * \a pjmedia_vid_dev_wnd_flag. + * + * Default: 0. + */ + unsigned windowFlags; + + /** + * Media format. If left unitialized, this parameter will not be used. + */ + MediaFormat format; + + /** + * Optional output window to be used to display the video preview. + * This parameter will only be used if the video device supports + * PJMEDIA_VID_DEV_CAP_OUTPUT_WINDOW capability and the capability + * is not read-only. + */ + VideoWindowHandle window; + +public: + /** + * Default constructor initializes with default values. + */ + VideoPreviewOpParam(); + + /** + * Convert from pjsip + */ + void fromPj(const pjsua_vid_preview_param &prm); + + /** + * Convert to pjsip + */ + pjsua_vid_preview_param toPj() const; +}; + +/** + * Video Preview + */ +class VideoPreview { +public: + /** + * Constructor + */ + VideoPreview(int dev_id); + + /** + * Determine if the specified video input device has built-in native + * preview capability. This is a convenience function that is equal to + * querying device's capability for PJMEDIA_VID_DEV_CAP_INPUT_PREVIEW + * capability. + * + * @return true if it has. + */ + bool hasNative(); + + /** + * Start video preview window for the specified capture device. + * + * @param p Video preview parameters. + */ + void start(const VideoPreviewOpParam ¶m) throw(Error); + + /** + * Stop video preview. + */ + void stop() throw(Error); + + /* + * Get the preview window handle associated with the capture device,if any. + */ + VideoWindow getVideoWindow(); + +private: + pjmedia_vid_dev_index devId; +}; + /************************************************************************* * Codec management */ |