diff options
author | Benny Prijono <bennylp@teluu.com> | 2011-09-19 08:26:35 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2011-09-19 08:26:35 +0000 |
commit | 1e1b229434f1fc558c0aa26746334186c97c80fe (patch) | |
tree | a6bfd3f2b579defcddc18f1f47e2eba20d9ba64e /pjsip/include/pjsua-lib | |
parent | 62bf8d3a35a49a55c97eaf50d71241ee512d1282 (diff) |
Implemented native video preview support. This closes #1340
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3756 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/include/pjsua-lib')
-rw-r--r-- | pjsip/include/pjsua-lib/pjsua.h | 51 | ||||
-rw-r--r-- | pjsip/include/pjsua-lib/pjsua_internal.h | 18 |
2 files changed, 50 insertions, 19 deletions
diff --git a/pjsip/include/pjsua-lib/pjsua.h b/pjsip/include/pjsua-lib/pjsua.h index 2fdea68e..f79de1b9 100644 --- a/pjsip/include/pjsua-lib/pjsua.h +++ b/pjsip/include/pjsua-lib/pjsua.h @@ -4691,6 +4691,18 @@ struct pjsua_media_config * Default : 1 */ int snd_auto_close_time; + + /** + * Specify whether built-in/native preview should be used if available. + * In some systems, video input devices have built-in capability to show + * preview window of the device. Using this built-in preview is preferable + * as it consumes less CPU power. If built-in preview is not available, + * the library will perform software rendering of the input. If this + * field is set to PJ_FALSE, software preview will always be used. + * + * Default: PJ_TRUE + */ + pj_bool_t vid_preview_enable_native; }; @@ -5436,7 +5448,8 @@ typedef struct pjsua_vid_preview_param { /** * Device ID for the video renderer to be used for rendering the - * capture stream for preview. + * capture stream for preview. This parameter is ignored if native + * preview is being used. * * Default: PJMEDIA_VID_DEFAULT_RENDER_DEV */ @@ -5460,6 +5473,18 @@ typedef struct pjsua_vid_preview_param PJ_DECL(void) pjsua_vid_preview_param_default(pjsua_vid_preview_param *p); /** + * 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. + * + * @param id The capture device ID. + * + * @return PJ_TRUE if it has. + */ +PJ_DECL(pj_bool_t) pjsua_vid_preview_has_native(pjmedia_vid_dev_index id); + +/** * Start video preview window for the specified capture device. * * @param id The capture device ID where its preview will be @@ -5503,9 +5528,12 @@ PJ_DECL(pj_status_t) pjsua_vid_preview_stop(pjmedia_vid_dev_index id); typedef struct pjsua_vid_win_info { /** - * Renderer device ID. + * Flag to indicate whether this window is a native window, + * such as created by built-in preview device. If this field is + * PJ_TRUE, only the native window handle field of this + * structure is valid. */ - pjmedia_vid_dev_index rdr_dev; + pj_bool_t is_native; /** * Native window handle. @@ -5513,6 +5541,11 @@ typedef struct pjsua_vid_win_info pjmedia_vid_dev_hwnd hwnd; /** + * Renderer device ID. + */ + pjmedia_vid_dev_index rdr_dev; + + /** * Window show status. The window is hidden if false. */ pj_bool_t show; @@ -5556,7 +5589,9 @@ PJ_DECL(pj_status_t) pjsua_vid_win_get_info(pjsua_vid_win_id wid, pjsua_vid_win_info *wi); /** - * Show or hide window. + * Show or hide window. This operation is not valid for native windows + * (pjsua_vid_win_info.is_native=PJ_TRUE), on which native windowing API + * must be used instead. * * @param wid The video window ID. * @param show Set to PJ_TRUE to show the window, PJ_FALSE to @@ -5568,7 +5603,9 @@ PJ_DECL(pj_status_t) pjsua_vid_win_set_show(pjsua_vid_win_id wid, pj_bool_t show); /** - * Set video window position. + * Set video window position. This operation is not valid for native windows + * (pjsua_vid_win_info.is_native=PJ_TRUE), on which native windowing API + * must be used instead. * * @param wid The video window ID. * @param pos The window position. @@ -5579,7 +5616,9 @@ PJ_DECL(pj_status_t) pjsua_vid_win_set_pos(pjsua_vid_win_id wid, const pjmedia_coord *pos); /** - * Resize window. + * Resize window. This operation is not valid for native windows + * (pjsua_vid_win_info.is_native=PJ_TRUE), on which native windowing API + * must be used instead. * * @param wid The video window ID. * @param size The new window size. diff --git a/pjsip/include/pjsua-lib/pjsua_internal.h b/pjsip/include/pjsua-lib/pjsua_internal.h index ab3d2149..46547eec 100644 --- a/pjsip/include/pjsua-lib/pjsua_internal.h +++ b/pjsip/include/pjsua-lib/pjsua_internal.h @@ -307,6 +307,7 @@ typedef struct pjsua_stun_resolve pj_stun_sock *stun_sock; /**< Testing STUN sock */ } pjsua_stun_resolve; +/* See also pjsua_vid_win_type_name() */ typedef enum pjsua_vid_win_type { PJSUA_WND_TYPE_NONE, @@ -322,7 +323,8 @@ typedef struct pjsua_vid_win pjmedia_vid_port *vp_cap; /**< Capture vidport. */ pjmedia_vid_port *vp_rend; /**< Renderer vidport */ pjmedia_port *tee; /**< Video tee */ - pjmedia_vid_dev_index preview_cap_id;/* Capture dev id */ + pjmedia_vid_dev_index preview_cap_id;/**< Capture dev id */ + pj_bool_t is_native; /**< Preview is by dev */ } pjsua_vid_win; /** @@ -675,21 +677,11 @@ pj_status_t pjsua_vid_subsys_init(void); pj_status_t pjsua_vid_subsys_start(void); pj_status_t pjsua_vid_subsys_destroy(void); -PJ_INLINE(void) pjsua_vid_win_reset(pjsua_vid_win_id wid) -{ #if PJSUA_HAS_VIDEO - pjsua_vid_win *w = &pjsua_var.win[wid]; - pj_pool_t *pool = w->pool; - - pj_bzero(w, sizeof(*w)); - if (pool) pj_pool_reset(pool); - w->ref_cnt = 0; - w->pool = pool; - w->preview_cap_id = PJMEDIA_VID_INVALID_DEV; +PJ_DECL(void) pjsua_vid_win_reset(pjsua_vid_win_id wid); #else - PJ_UNUSED_ARG(wid); +# define pjsua_vid_win_reset(wid) #endif -} PJ_END_DECL |