summaryrefslogtreecommitdiff
path: root/pjsip/include
diff options
context:
space:
mode:
authorLiong Sauw Ming <ming@teluu.com>2015-03-18 08:25:24 +0000
committerLiong Sauw Ming <ming@teluu.com>2015-03-18 08:25:24 +0000
commit18061c77b205207a29aeb61414c1040affeeae3b (patch)
tree51168f9aeb7c4ea275586c7e4c9acbefa571e9aa /pjsip/include
parent0266873461cbbaeac7cc5a210fa90bab6c640b65 (diff)
Re #1823 (PJSUA2 Video API): Add Pjsua2 Video Window API and Pjsua API to set output window
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4996 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/include')
-rw-r--r--pjsip/include/pjsua-lib/pjsua.h14
-rw-r--r--pjsip/include/pjsua2/call.hpp7
-rw-r--r--pjsip/include/pjsua2/media.hpp163
3 files changed, 184 insertions, 0 deletions
diff --git a/pjsip/include/pjsua-lib/pjsua.h b/pjsip/include/pjsua-lib/pjsua.h
index 1ebde412..e730790c 100644
--- a/pjsip/include/pjsua-lib/pjsua.h
+++ b/pjsip/include/pjsua-lib/pjsua.h
@@ -6815,6 +6815,20 @@ PJ_DECL(pj_status_t) pjsua_vid_win_set_size(pjsua_vid_win_id wid,
const pjmedia_rect_size *size);
/**
+ * Set output window. This operation is valid only when the underlying
+ * video device supports PJMEDIA_VIDEO_DEV_CAP_OUTPUT_WINDOW capability AND
+ * allows the output window to be changed on-the-fly. Currently it is only
+ * supported on Android.
+ *
+ * @param wid The video window ID.
+ * @param win The new output window.
+ *
+ * @return PJ_SUCCESS on success, or the appropriate error code.
+ */
+PJ_DECL(pj_status_t) pjsua_vid_win_set_win(pjsua_vid_win_id wid,
+ const pjmedia_vid_dev_hwnd *win);
+
+/**
* Rotate the video window. This function will change the video orientation
* and also possibly the video window size (width and height get swapped).
* This operation is not valid for native windows (pjsua_vid_win_info.is_native
diff --git a/pjsip/include/pjsua2/call.hpp b/pjsip/include/pjsua2/call.hpp
index 510ad64d..0614270e 100644
--- a/pjsip/include/pjsua2/call.hpp
+++ b/pjsip/include/pjsua2/call.hpp
@@ -413,6 +413,13 @@ struct CallMediaInfo
pjsua_vid_win_id videoIncomingWindowId;
/**
+ * The video window instance for incoming video. Only valid if
+ * videoIncomingWindowId is not PJSUA_INVALID_ID and
+ * the media type is video.
+ */
+ VideoWindow videoWindow;
+
+ /**
* The video capture device for outgoing transmission, if any,
* or PJMEDIA_VID_INVALID_DEV. Only valid if the media type is video.
*/
diff --git a/pjsip/include/pjsua2/media.hpp b/pjsip/include/pjsua2/media.hpp
index 99dd532e..181001e4 100644
--- a/pjsip/include/pjsua2/media.hpp
+++ b/pjsip/include/pjsua2/media.hpp
@@ -1325,6 +1325,169 @@ private:
friend class Endpoint;
};
+
+/*************************************************************************
+* Video media
+*/
+
+/**
+ * Representation of media coordinate.
+ */
+struct MediaCoordinate
+{
+ int x; /**< X position of the coordinate */
+ int y; /**< Y position of the coordinate */
+};
+
+/**
+ * Representation of media size.
+ */
+struct MediaSize
+{
+ unsigned w; /**< The width. */
+ unsigned h; /**< The height. */
+};
+
+/**
+ * Window handle.
+ */
+typedef struct WindowHandle {
+ void *window; /**< Window */
+ void *display; /**< Display */
+} WindowHandle;
+
+/**
+ * Video window handle.
+ */
+struct VideoWindowHandle
+{
+ /**
+ * The window handle type.
+ */
+ pjmedia_vid_dev_hwnd_type type;
+
+ /**
+ * The window handle.
+ */
+ WindowHandle handle;
+};
+
+/**
+ * This structure describes video window info.
+ */
+typedef struct VideoWindowInfo
+{
+ /**
+ * Flag to indicate whether this window is a native window,
+ * such as created by built-in preview device. If this field is
+ * true, only the video window handle field of this
+ * structure is valid.
+ */
+ bool isNative;
+
+ /**
+ * Video window handle.
+ */
+ VideoWindowHandle winHandle;
+
+ /**
+ * Renderer device ID.
+ */
+ int renderDeviceId;
+
+ /**
+ * Window show status. The window is hidden if false.
+ */
+ bool show;
+
+ /**
+ * Window position.
+ */
+ MediaCoordinate pos;
+
+ /**
+ * Window size.
+ */
+ MediaSize size;
+
+} VideoWindowInfo;
+
+/**
+ * Video window.
+ */
+class VideoWindow
+{
+public:
+ /**
+ * Constructor
+ */
+ VideoWindow(int win_id);
+
+ /**
+ * Get window info.
+ *
+ * @return video window info.
+ */
+ VideoWindowInfo getInfo() const throw(Error);
+
+ /**
+ * Show or hide window. This operation is not valid for native windows
+ * (VideoWindowInfo.isNative=true), on which native windowing API
+ * must be used instead.
+ *
+ * @param show Set to true to show the window, false to
+ * hide the window.
+ *
+ */
+ void Show(bool show) throw(Error);
+
+ /**
+ * Set video window position. This operation is not valid for native windows
+ * (VideoWindowInfo.isNative=true), on which native windowing API
+ * must be used instead.
+ *
+ * @param pos The window position.
+ *
+ */
+ void setPos(const MediaCoordinate &pos) throw(Error);
+
+ /**
+ * Resize window. This operation is not valid for native windows
+ * (VideoWindowInfo.isNative=true), on which native windowing API
+ * must be used instead.
+ *
+ * @param size The new window size.
+ *
+ */
+ void setSize(const MediaSize &size) throw(Error);
+
+ /**
+ * Rotate the video window. This function will change the video orientation
+ * and also possibly the video window size (width and height get swapped).
+ * This operation is not valid for native windows (VideoWindowInfo.isNative
+ * =true), on which native windowing API must be used instead.
+ *
+ * @param angle The rotation angle in degrees, must be
+ * multiple of 90.
+ * Specify positive value for clockwise rotation or
+ * negative value for counter-clockwise rotation.
+ */
+ void rotate(int angle) throw(Error);
+
+ /**
+ * Set output window. This operation is valid only when the underlying
+ * video device supports PJMEDIA_VIDEO_DEV_CAP_OUTPUT_WINDOW capability AND
+ * allows the output window to be changed on-the-fly, otherwise Error will
+ * be thrown. Currently it is only supported on Android.
+ *
+ * @param win The new output window.
+ */
+ void setWindow(const VideoWindowHandle &win) throw(Error);
+
+private:
+ pjsua_vid_win_id winId;
+};
+
/*************************************************************************
* Codec management
*/