From 407b78824263993fb67b844ea98763d0914f74aa Mon Sep 17 00:00:00 2001 From: Haakon Sporsheim Date: Sun, 24 Aug 2008 13:23:44 +0000 Subject: New plugin: winscreencap (#463941). Original commit message from CVS: patch by: Haakon Sporsheim * configure.ac: * sys/Makefile.am: * sys/winscreencap/Makefile.am: * sys/winscreencap/gstdx9screencapsrc.c: * sys/winscreencap/gstdx9screencapsrc.h: * sys/winscreencap/gstgdiscreencapsrc.c: * sys/winscreencap/gstgdiscreencapsrc.h: * sys/winscreencap/gstwinscreencap.c: * sys/winscreencap/gstwinscreencap.h: New plugin: winscreencap (#463941). --- sys/winscreencap/gstwinscreencap.c | 77 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 sys/winscreencap/gstwinscreencap.c (limited to 'sys/winscreencap/gstwinscreencap.c') diff --git a/sys/winscreencap/gstwinscreencap.c b/sys/winscreencap/gstwinscreencap.c new file mode 100644 index 00000000..bc6c1e0e --- /dev/null +++ b/sys/winscreencap/gstwinscreencap.c @@ -0,0 +1,77 @@ +/* GStreamer + * Copyright (C) 2007 Haakon Sporsheim + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "gstwinscreencap.h" +#include "gstgdiscreencapsrc.h" +#include "gstdx9screencapsrc.h" + +static BOOL CALLBACK +_diplay_monitor_enum (HMONITOR hMon, HDC hdc, LPRECT rect, LPARAM param) +{ + LPRECT *pp_rect = (LPRECT *) param; + CopyRect (*pp_rect, rect); + (*pp_rect)++; + return TRUE; +} + +RECT +gst_win32_get_monitor_rect (UINT index) +{ + RECT ret_rect; + LPRECT data; + + data = (LPRECT) malloc (sizeof (RECT) * GetSystemMetrics (SM_CMONITORS)); + if (data) { + LPRECT tmp = data; + EnumDisplayMonitors (NULL, NULL, _diplay_monitor_enum, (LPARAM) & tmp); + + ret_rect = data[index]; + free (data); + } else { + ZeroMemory (&ret_rect, sizeof (RECT)); + } + + return ret_rect; +} + +static gboolean +plugin_init (GstPlugin * plugin) +{ + if (!gst_element_register (plugin, "gdiscreencapsrc", + GST_RANK_NONE, GST_TYPE_GDISCREENCAPSRC)) { + return FALSE; + } + + if (!gst_element_register (plugin, "dx9screencapsrc", + GST_RANK_NONE, GST_TYPE_DX9SCREENCAPSRC)) { + return FALSE; + } + + return TRUE; +} + +GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, + GST_VERSION_MINOR, + "winscreencap", + "Screen capture plugin for Windows", + plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN) -- cgit v1.2.1