2 * Copyright (C) 2019 OKADA Jun-ichi <okada@abt.jp>
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.
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.
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.
30 #include <gst/base/gstpushsrc.h>
31 #include <gst/video/video.h>
33 #define RECT_WIDTH(r) (r.right - r.left)
34 #define RECT_HEIGHT(r) (r.bottom - r.top)
36 #define HR_FAILED_AND(hr,func,and) \
39 gchar *msg = get_hresult_to_string (hr); \
40 GST_ERROR_OBJECT (src, #func " failed (%x): %s", (guint) hr, msg); \
46 #define HR_FAILED_RET(hr,func,ret) HR_FAILED_AND(hr,func,return ret)
48 #define HR_FAILED_GOTO(hr,func,where) HR_FAILED_AND(hr,func,goto where)
50 #define HR_FAILED_INFO(hr, func) \
53 gchar *msg = get_hresult_to_string (hr); \
54 GST_INFO_OBJECT (src, #func " failed (%x): %s", (guint) hr, msg); \
59 #define GST_DXGICAP_FLOW_RESOLUTION_CHANGE GST_FLOW_CUSTOM_SUCCESS_1
61 typedef struct _GstDXGIScreenCapSrc GstDXGIScreenCapSrc;
63 typedef struct _DxgiCapture DxgiCapture;
65 gboolean gst_dxgicap_shader_init (void);
67 DxgiCapture *dxgicap_new (HMONITOR monitor, GstDXGIScreenCapSrc * src);
68 void dxgicap_destory (DxgiCapture * _this);
70 gboolean dxgicap_start (DxgiCapture * _this);
71 void dxgicap_stop (DxgiCapture * _this);
73 GstFlowReturn dxgicap_acquire_next_frame (DxgiCapture * _this, gboolean show_cursor,
75 gboolean dxgicap_copy_buffer (DxgiCapture * _this, gboolean show_cursor,
76 LPRECT src_rect, GstVideoInfo * video_info, GstBuffer * buf);
78 HMONITOR get_hmonitor_by_device_name (const gchar * device_name);
79 HMONITOR get_hmonitor_primary (void);
80 HMONITOR get_hmonitor_by_index (int index);
82 gboolean get_monitor_physical_size (HMONITOR hmonitor, LPRECT rect);
84 gchar *get_hresult_to_string (HRESULT hr);
86 #endif /* __DXGICAP_H__ */