2 * Copyright (C) 2019 Seungha Yang <seungha.yang@navercorp.com>
3 * Copyright (C) 2020 Seungha Yang <seungha@centricular.com>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
24 #include <gst/video/video.h>
25 #include <gst/d3d11/gstd3d11_fwd.h>
29 #define GST_TYPE_D3D11_DEVICE (gst_d3d11_device_get_type())
30 #define GST_D3D11_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_D3D11_DEVICE,GstD3D11Device))
31 #define GST_D3D11_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_D3D11_DEVICE,GstD3D11DeviceClass))
32 #define GST_D3D11_DEVICE_GET_CLASS(obj) (GST_D3D11_DEVICE_CLASS(G_OBJECT_GET_CLASS(obj)))
33 #define GST_IS_D3D11_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_D3D11_DEVICE))
34 #define GST_IS_D3D11_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_D3D11_DEVICE))
35 #define GST_D3D11_DEVICE_CAST(obj) ((GstD3D11Device*)(obj))
37 #define GST_TYPE_D3D11_FENCE (gst_d3d11_fence_get_type())
38 #define GST_IS_D3D11_FENCE(obj) (GST_IS_MINI_OBJECT_TYPE(obj, GST_TYPE_D3D11_FENCE))
39 #define GST_D3D11_FENCE(obj) ((GstD3D11Fence *)obj)
40 #define GST_D3D11_FENCE_CAST(obj) (GST_D3D11_FENCE(obj))
43 * GST_D3D11_DEVICE_HANDLE_CONTEXT_TYPE:
45 * The name used in #GstContext queries for requesting a #GstD3D11Device
49 #define GST_D3D11_DEVICE_HANDLE_CONTEXT_TYPE "gst.d3d11.device.handle"
54 * Opaque GstD3D11Device struct
58 struct _GstD3D11Device
63 GstD3D11DevicePrivate *priv;
64 gpointer _gst_reserved[GST_PADDING];
68 * GstD3D11DeviceClass:
70 * Opaque GstD3D11DeviceClass struct
74 struct _GstD3D11DeviceClass
76 GstObjectClass parent_class;
79 gpointer _gst_reserved[GST_PADDING];
83 GType gst_d3d11_device_get_type (void);
86 GstD3D11Device * gst_d3d11_device_new (guint adapter_index,
90 GstD3D11Device * gst_d3d11_device_new_for_adapter_luid (gint64 adapter_luid,
94 GstD3D11Device * gst_d3d11_device_new_wrapped (ID3D11Device * device);
97 ID3D11Device * gst_d3d11_device_get_device_handle (GstD3D11Device * device);
100 ID3D11DeviceContext * gst_d3d11_device_get_device_context_handle (GstD3D11Device * device);
103 IDXGIFactory1 * gst_d3d11_device_get_dxgi_factory_handle (GstD3D11Device * device);
106 ID3D11VideoDevice * gst_d3d11_device_get_video_device_handle (GstD3D11Device * device);
109 ID3D11VideoContext * gst_d3d11_device_get_video_context_handle (GstD3D11Device * device);
112 void gst_d3d11_device_lock (GstD3D11Device * device);
115 void gst_d3d11_device_unlock (GstD3D11Device * device);
118 gboolean gst_d3d11_device_get_format (GstD3D11Device * device,
119 GstVideoFormat format,
120 GstD3D11Format * device_format);
125 * An abstraction of the ID3D11Fence interface
129 struct _GstD3D11Fence
131 GstMiniObject parent;
133 GstD3D11Device *device;
136 GstD3D11FencePrivate *priv;
137 gpointer _gst_reserved[GST_PADDING];
141 GType gst_d3d11_fence_get_type (void);
144 GstD3D11Fence * gst_d3d11_device_create_fence (GstD3D11Device * device);
147 gboolean gst_d3d11_fence_signal (GstD3D11Fence * fence);
150 gboolean gst_d3d11_fence_wait (GstD3D11Fence * fence);
153 gst_d3d11_fence_unref (GstD3D11Fence * fence)
155 gst_mini_object_unref (GST_MINI_OBJECT_CAST (fence));
159 gst_clear_d3d11_fence (GstD3D11Fence ** fence)
161 if (fence && *fence) {
162 gst_d3d11_fence_unref (*fence);