summaryrefslogtreecommitdiff
path: root/pjmedia
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2011-09-19 08:26:35 +0000
committerBenny Prijono <bennylp@teluu.com>2011-09-19 08:26:35 +0000
commit1e1b229434f1fc558c0aa26746334186c97c80fe (patch)
treea6bfd3f2b579defcddc18f1f47e2eba20d9ba64e /pjmedia
parent62bf8d3a35a49a55c97eaf50d71241ee512d1282 (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 'pjmedia')
-rw-r--r--pjmedia/include/pjmedia-videodev/videodev.h32
-rw-r--r--pjmedia/src/pjmedia-videodev/videodev.c6
-rw-r--r--pjmedia/src/pjmedia/vid_tee.c6
3 files changed, 38 insertions, 6 deletions
diff --git a/pjmedia/include/pjmedia-videodev/videodev.h b/pjmedia/include/pjmedia-videodev/videodev.h
index 6aed18ef..30a9750b 100644
--- a/pjmedia/include/pjmedia-videodev/videodev.h
+++ b/pjmedia/include/pjmedia-videodev/videodev.h
@@ -149,8 +149,14 @@ typedef enum pjmedia_vid_dev_cap
PJMEDIA_VID_DEV_CAP_INPUT_SCALE = 2,
/**
- * The application can provide a window for the renderer to
- * display the video.
+ * Support for returning the native window handle of the video window.
+ * For renderer, this means the window handle of the renderer window,
+ * while for capture, this means the window handle of the native preview,
+ * only if the device supports PJMEDIA_VID_DEV_CAP_INPUT_PREVIEW
+ * capability.
+ *
+ * The value of this capability is pointer to pjmedia_vid_dev_hwnd
+ * structure.
*/
PJMEDIA_VID_DEV_CAP_OUTPUT_WINDOW = 4,
@@ -175,7 +181,20 @@ typedef enum pjmedia_vid_dev_cap
PJMEDIA_VID_DEV_CAP_OUTPUT_HIDE = 32,
/**
- * End of capability
+ * Support for native preview capability in capture devices. Value is
+ * pj_bool_t. With native preview, capture device can be instructed to
+ * show or hide a preview window showing video directly from the camera
+ * by setting this capability to PJ_TRUE or PJ_FALSE. Once the preview
+ * is started, application may use PJMEDIA_VID_DEV_CAP_OUTPUT_WINDOW
+ * capability to query the vidow window.
+ *
+ * The value of this capability is a pj_bool_t containing boolean
+ * PJ_TRUE or PJ_FALSE.
+ */
+ PJMEDIA_VID_DEV_CAP_INPUT_PREVIEW = 64,
+
+ /**
+ * End of standard capability
*/
PJMEDIA_VID_DEV_CAP_MAX = 16384
@@ -337,6 +356,13 @@ typedef struct pjmedia_vid_dev_param
*/
pj_bool_t window_hide;
+ /**
+ * Enable built-in preview. This setting is optional and is only used
+ * if PJMEDIA_VID_DEV_CAP_INPUT_PREVIEW capability is supported and
+ * set in the flags.
+ */
+ pj_bool_t native_preview;
+
} pjmedia_vid_dev_param;
diff --git a/pjmedia/src/pjmedia-videodev/videodev.c b/pjmedia/src/pjmedia-videodev/videodev.c
index e06152fc..a88e91c4 100644
--- a/pjmedia/src/pjmedia-videodev/videodev.c
+++ b/pjmedia/src/pjmedia-videodev/videodev.c
@@ -40,10 +40,11 @@ static struct cap_info
{
DEFINE_CAP("format", "Video format"),
DEFINE_CAP("scale", "Input dimension"),
- DEFINE_CAP("window", "Renderer window"),
+ DEFINE_CAP("window", "Window handle"),
DEFINE_CAP("resize", "Renderer resize"),
DEFINE_CAP("position", "Renderer position"),
DEFINE_CAP("hide", "Renderer hide"),
+ DEFINE_CAP("preview", "Input preview"),
};
@@ -175,6 +176,9 @@ static pj_status_t get_cap_pointer(const pjmedia_vid_dev_param *param,
case PJMEDIA_VID_DEV_CAP_OUTPUT_HIDE:
FIELD_INFO(window_hide);
break;
+ case PJMEDIA_VID_DEV_CAP_INPUT_PREVIEW:
+ FIELD_INFO(native_preview);
+ break;
default:
return PJMEDIA_EVID_INVCAP;
}
diff --git a/pjmedia/src/pjmedia/vid_tee.c b/pjmedia/src/pjmedia/vid_tee.c
index 21d0cec5..9df31d8a 100644
--- a/pjmedia/src/pjmedia/vid_tee.c
+++ b/pjmedia/src/pjmedia/vid_tee.c
@@ -30,6 +30,7 @@
#define TEE_PORT_NAME "vid_tee"
#define TEE_PORT_SIGN PJMEDIA_SIG_PORT_VID_TEE
+#define THIS_FILE "vid_tee.c"
typedef struct vid_tee_dst_port
{
@@ -316,8 +317,9 @@ static pj_status_t tee_put_frame(pjmedia_port *port, pjmedia_frame *frame)
status = pjmedia_converter_convert(tee->tee_conv[i].conv,
frame, &frame_);
if (status != PJ_SUCCESS) {
- PJ_LOG(3, ("", "Failed to convert frame for destination"
- "port %d (%.*s)", i,
+ PJ_LOG(3, (THIS_FILE,
+ "Failed to convert frame for destination"
+ " port %d (%.*s)", i,
tee->dst_ports[i].dst->info.name.slen,
tee->dst_ports[i].dst->info.name.ptr));
continue;