summaryrefslogtreecommitdiff
path: root/pjsip
diff options
context:
space:
mode:
authorLiong Sauw Ming <ming@teluu.com>2015-06-25 08:17:52 +0000
committerLiong Sauw Ming <ming@teluu.com>2015-06-25 08:17:52 +0000
commit97f362db7fa1fad9a0258bdb5e218b80dab93031 (patch)
tree135ac5d783604db13ee17e6d78551851c4020b1d /pjsip
parent6138b1938ddf639566e8cdccb016ad6be1da39fb (diff)
Re #1861: Initial implementation of video orientation support
- Utility to resize and rotate video frame - Support for iOS + sample - pjsua API to set video device's orientation git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@5118 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip')
-rw-r--r--pjsip/include/pjsua-lib/pjsua.h26
-rw-r--r--pjsip/src/pjsua-lib/pjsua_vid.c37
2 files changed, 63 insertions, 0 deletions
diff --git a/pjsip/include/pjsua-lib/pjsua.h b/pjsip/include/pjsua-lib/pjsua.h
index 56c3c82a..8cc91f28 100644
--- a/pjsip/include/pjsua-lib/pjsua.h
+++ b/pjsip/include/pjsua-lib/pjsua.h
@@ -6600,6 +6600,32 @@ PJ_DECL(pj_status_t) pjsua_vid_dev_get_info(pjmedia_vid_dev_index id,
pjmedia_vid_dev_info *vdi);
/**
+ * Check whether the video capture device is currently active, i.e. if
+ * a video preview has been started or there is a video call using
+ * the device. This function will return PJ_FALSE for video renderer device.
+ *
+ * @param id The video device index.
+ *
+ * @return PJ_TRUE if active, PJ_FALSE otherwise.
+ */
+PJ_DECL(pj_bool_t) pjsua_vid_dev_is_active(pjmedia_vid_dev_index id);
+
+/**
+ * Set the orientation of the video device. The function only works
+ * for video capture device and if the device is currently active (i.e.
+ * a video preview has been started or there is a video call using the device).
+ * Application can check if a video device is active by calling
+ * #pjsua_vid_dev_is_active().
+ *
+ * @param id The video device index.
+ * @param orient Video device orientation.
+ *
+ * @return PJ_SUCCESS on success, or the appropriate error code.
+ */
+PJ_DECL(pj_status_t) pjsua_vid_dev_set_orient(pjmedia_vid_dev_index id,
+ pjmedia_orient orient);
+
+/**
* Enum all video devices installed in the system.
*
* @param info Array of info to be initialized.
diff --git a/pjsip/src/pjsua-lib/pjsua_vid.c b/pjsip/src/pjsua-lib/pjsua_vid.c
index e2bbab40..54d23ad2 100644
--- a/pjsip/src/pjsua-lib/pjsua_vid.c
+++ b/pjsip/src/pjsua-lib/pjsua_vid.c
@@ -32,6 +32,8 @@
#define PJSUA_HIDE_WINDOW 0
+static pjsua_vid_win_id vid_preview_get_win(pjmedia_vid_dev_index id,
+ pj_bool_t running_only);
static void free_vid_win(pjsua_vid_win_id wid);
/*****************************************************************************
@@ -214,6 +216,41 @@ PJ_DEF(pj_status_t) pjsua_vid_dev_get_info(pjmedia_vid_dev_index id,
}
/*
+ * Check whether the video device is currently active.
+ */
+PJ_DEF(pj_bool_t) pjsua_vid_dev_is_active(pjmedia_vid_dev_index id)
+{
+ pjsua_vid_win_id wid = vid_preview_get_win(id, PJ_FALSE);
+
+ return (wid != PJSUA_INVALID_ID? PJ_TRUE: PJ_FALSE);
+}
+
+/*
+ * Set the orientation of the video device.
+ */
+PJ_DEF(pj_status_t) pjsua_vid_dev_set_orient( pjmedia_vid_dev_index id,
+ pjmedia_orient orient)
+{
+ pjsua_vid_win *w;
+ pjmedia_vid_dev_stream *cap_dev;
+ pjsua_vid_win_id wid = vid_preview_get_win(id, PJ_FALSE);
+
+ if (wid == PJSUA_INVALID_ID) {
+ PJ_LOG(3, (THIS_FILE, "Unable to set orientation for video dev %d: "
+ "device not active", id));
+ return PJ_ENOTFOUND;
+ }
+
+ w = &pjsua_var.win[wid];
+
+ cap_dev = pjmedia_vid_port_get_stream(w->vp_cap);
+
+ return pjmedia_vid_dev_stream_set_cap(cap_dev,
+ PJMEDIA_VID_DEV_CAP_ORIENTATION,
+ &orient);
+}
+
+/*
* Enum all video devices installed in the system.
*/
PJ_DEF(pj_status_t) pjsua_vid_enum_devs(pjmedia_vid_dev_info info[],