diff options
author | Haakon Sporsheim <hakon.sporsheim@tandberg.com> | 2008-08-24 13:23:44 +0000 |
---|---|---|
committer | Ole André Vadla Ravnås <ole.andre.ravnas@tandberg.com> | 2008-08-24 13:23:44 +0000 |
commit | 407b78824263993fb67b844ea98763d0914f74aa (patch) | |
tree | f78bf107f1001db1a436bb7c7dc81a8a4a442729 /sys/winscreencap/gstwinscreencap.c | |
parent | 76b2b0502d785edc9040d48306639342a3d01963 (diff) | |
download | gst-plugins-bad-407b78824263993fb67b844ea98763d0914f74aa.tar.gz gst-plugins-bad-407b78824263993fb67b844ea98763d0914f74aa.tar.bz2 gst-plugins-bad-407b78824263993fb67b844ea98763d0914f74aa.zip |
New plugin: winscreencap (#463941).
Original commit message from CVS:
patch by: Haakon Sporsheim <hakon.sporsheim@tandberg.com>
* 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).
Diffstat (limited to 'sys/winscreencap/gstwinscreencap.c')
-rw-r--r-- | sys/winscreencap/gstwinscreencap.c | 77 |
1 files changed, 77 insertions, 0 deletions
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 <hakon.sporsheim@tandberg.com> + * + * 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) |