1 /* GStreamer
2 * Copyright (C) 2007 Haakon Sporsheim <hakon.sporsheim@tandberg.com>
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
13 *
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 */
19
20 #ifdef HAVE_CONFIG_H
21 #include "config.h"
22 #endif
23
24 #include "gstwinscreencap.h"
25 #include "gstgdiscreencapsrc.h"
26 #include "gstdx9screencapsrc.h"
27
28 static BOOL CALLBACK
_diplay_monitor_enum(HMONITOR hMon,HDC hdc,LPRECT rect,LPARAM param)29 _diplay_monitor_enum (HMONITOR hMon, HDC hdc, LPRECT rect, LPARAM param)
30 {
31 LPRECT *pp_rect = (LPRECT *) param;
32 CopyRect (*pp_rect, rect);
33 (*pp_rect)++;
34 return TRUE;
35 }
36
37 RECT
gst_win32_get_monitor_rect(UINT index)38 gst_win32_get_monitor_rect (UINT index)
39 {
40 RECT ret_rect;
41 LPRECT data;
42
43 data = (LPRECT) malloc (sizeof (RECT) * GetSystemMetrics (SM_CMONITORS));
44 if (data) {
45 LPRECT tmp = data;
46 EnumDisplayMonitors (NULL, NULL, _diplay_monitor_enum, (LPARAM) & tmp);
47
48 ret_rect = data[index];
49 free (data);
50 } else {
51 ZeroMemory (&ret_rect, sizeof (RECT));
52 }
53
54 return ret_rect;
55 }
56
57 static gboolean
plugin_init(GstPlugin * plugin)58 plugin_init (GstPlugin * plugin)
59 {
60 if (!gst_element_register (plugin, "gdiscreencapsrc",
61 GST_RANK_NONE, GST_TYPE_GDISCREENCAPSRC)) {
62 return FALSE;
63 }
64
65 if (!gst_element_register (plugin, "dx9screencapsrc",
66 GST_RANK_NONE, GST_TYPE_DX9SCREENCAPSRC)) {
67 return FALSE;
68 }
69
70 return TRUE;
71 }
72
73 GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
74 GST_VERSION_MINOR,
75 winscreencap,
76 "Screen capture plugin for Windows",
77 plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
78