{
PROP_0,
PROP_MONITOR,
+ PROP_SHOW_CURSOR,
PROP_X_POS,
PROP_Y_POS,
PROP_WIDTH,
"Which monitor to use (0 = 1st monitor and default)",
0, G_MAXINT, 0, G_PARAM_READWRITE));
+ g_object_class_install_property (go_class, PROP_SHOW_CURSOR,
+ g_param_spec_boolean ("cursor", "Show mouse cursor",
+ "Whether to show mouse cursor (default off)",
+ FALSE, G_PARAM_READWRITE));
+
g_object_class_install_property (go_class, PROP_X_POS,
g_param_spec_int ("x", "X",
"Horizontal coordinate of top left corner for the screen capture "
src->capture_h = 0;
src->monitor = 0;
+ src->show_cursor = FALSE;
+ src->monitor_info.cbSize = sizeof(MONITORINFO);
gst_base_src_set_format (GST_BASE_SRC (src), GST_FORMAT_TIME);
gst_base_src_set_live (GST_BASE_SRC (src), TRUE);
case PROP_MONITOR:
src->monitor = g_value_get_int (value);
break;
+ case PROP_SHOW_CURSOR:
+ src->show_cursor = g_value_get_boolean (value);
+ break;
case PROP_X_POS:
src->capture_x = g_value_get_int (value);
break;
case PROP_MONITOR:
g_value_set_int (value, src->monitor);
break;
+ case PROP_SHOW_CURSOR:
+ g_value_set_boolean (value, src->show_cursor);
+ break;
case PROP_X_POS:
g_value_set_int (value, src->capture_x);
break;
{
GstDX9ScreenCapSrc *src = GST_DX9SCREENCAPSRC (bsrc);
D3DPRESENT_PARAMETERS d3dpp;
+ HMONITOR monitor;
HRESULT res;
src->frame_number = -1;
if (FAILED (res))
return FALSE;
+ monitor = IDirect3D9_GetAdapterMonitor (g_d3d9, src->monitor);
+ GetMonitorInfo (monitor, &src->monitor_info);
+
return
SUCCEEDED (IDirect3DDevice9_CreateOffscreenPlainSurface (src->d3d9_device,
src->disp_mode.Width, src->disp_mode.Height, D3DFMT_A8R8G8B8,
return GST_FLOW_ERROR;
}
+ if (src->show_cursor) {
+ CURSORINFO ci;
+
+ ci.cbSize = sizeof (CURSORINFO);
+ GetCursorInfo (&ci);
+ if (ci.flags & CURSOR_SHOWING) {
+ ICONINFO ii;
+ HDC memDC;
+
+ GetIconInfo (ci.hCursor, &ii);
+
+ if (SUCCEEDED (IDirect3DSurface9_GetDC (src->surface, &memDC))) {
+ HCURSOR cursor = CopyImage (ci.hCursor, IMAGE_CURSOR, 0, 0,
+ LR_MONOCHROME | LR_DEFAULTSIZE);
+
+ DrawIcon (memDC,
+ ci.ptScreenPos.x - ii.xHotspot - src->monitor_info.rcMonitor.left,
+ ci.ptScreenPos.y - ii.yHotspot - src->monitor_info.rcMonitor.top,
+ cursor);
+
+ DestroyCursor (cursor);
+ IDirect3DSurface9_ReleaseDC (src->surface, memDC);
+ }
+
+ DeleteObject (ii.hbmColor);
+ DeleteObject (ii.hbmMask);
+ }
+ }
+
hres =
IDirect3DSurface9_LockRect (src->surface, &locked_rect, &(src->src_rect),
D3DLOCK_NO_DIRTY_UPDATE | D3DLOCK_NOSYSLOCK | D3DLOCK_READONLY);