d3d11: Update build-time dependency
[platform/upstream/gstreamer.git] / subprojects / gst-plugins-bad / sys / d3d11 / gstd3d11pluginutils.h
1 /* GStreamer
2  * Copyright (C) 2019 Seungha Yang <seungha.yang@navercorp.com>
3  * Copyright (C) 2020 Seungha Yang <seungha@centricular.com>
4  *
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.
9  *
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.
14  *
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.
19  */
20
21 #ifndef __GST_D3D11_PLUGIN_UTILS_H__
22 #define __GST_D3D11_PLUGIN_UTILS_H__
23
24 #include <gst/gst.h>
25 #include <gst/video/video.h>
26 #include <gst/d3d11/gstd3d11.h>
27 #include <d3d11_4.h>
28 #include <dxgi1_6.h>
29
30 G_BEGIN_DECLS
31
32 typedef struct _GstDxgiColorSpace GstDxgiColorSpace;
33
34 typedef enum
35 {
36   GST_D3D11_DEVICE_VENDOR_UNKNOWN = 0,
37   GST_D3D11_DEVICE_VENDOR_AMD,
38   GST_D3D11_DEVICE_VENDOR_INTEL,
39   GST_D3D11_DEVICE_VENDOR_NVIDIA,
40   GST_D3D11_DEVICE_VENDOR_QUALCOMM,
41   GST_D3D11_DEVICE_VENDOR_XBOX,
42 } GstD3D11DeviceVendor;
43
44 struct _GstDxgiColorSpace
45 {
46   guint dxgi_color_space_type;
47   GstVideoColorRange range;
48   GstVideoColorMatrix matrix;
49   GstVideoTransferFunction transfer;
50   GstVideoColorPrimaries primaries;
51 };
52
53 #define GST_D3D11_CLEAR_COM(obj) G_STMT_START { \
54     if (obj) { \
55       (obj)->Release (); \
56       (obj) = NULL; \
57     } \
58   } G_STMT_END
59
60 void            gst_d3d11_plugin_utils_init         (D3D_FEATURE_LEVEL feature_level);
61
62 GstCaps *       gst_d3d11_get_updated_template_caps (GstStaticCaps * template_caps);
63
64 gboolean        gst_d3d11_is_windows_8_or_greater   (void);
65
66 GstD3D11DeviceVendor gst_d3d11_get_device_vendor    (GstD3D11Device * device);
67
68 gboolean        gst_d3d11_hdr_meta_data_to_dxgi     (GstVideoMasteringDisplayInfo * minfo,
69                                                      GstVideoContentLightLevel * cll,
70                                                      DXGI_HDR_METADATA_HDR10 * dxgi_hdr10);
71
72 const GstDxgiColorSpace * gst_d3d11_video_info_to_dxgi_color_space (GstVideoInfo * info);
73
74 const GstDxgiColorSpace * gst_d3d11_find_swap_chain_color_space (GstVideoInfo * info,
75                                                                  IDXGISwapChain3 * swapchain);
76
77 GstBuffer *     gst_d3d11_allocate_staging_buffer_for (GstBuffer * buffer,
78                                                        const GstVideoInfo * info,
79                                                        gboolean add_videometa);
80
81 gboolean        gst_d3d11_buffer_copy_into          (GstBuffer * dst,
82                                                      GstBuffer * src,
83                                                      const GstVideoInfo * info);
84
85 gboolean        gst_is_d3d11_buffer                 (GstBuffer * buffer);
86
87 gboolean        gst_d3d11_buffer_can_access_device  (GstBuffer * buffer,
88                                                      ID3D11Device * device);
89
90 gboolean        gst_d3d11_buffer_map                (GstBuffer * buffer,
91                                                      ID3D11Device * device,
92                                                      GstMapInfo info[GST_VIDEO_MAX_PLANES],
93                                                      GstMapFlags flags);
94
95 gboolean        gst_d3d11_buffer_unmap              (GstBuffer * buffer,
96                                                      GstMapInfo info[GST_VIDEO_MAX_PLANES]);
97
98 guint           gst_d3d11_buffer_get_shader_resource_view (GstBuffer * buffer,
99                                                            ID3D11ShaderResourceView * view[GST_VIDEO_MAX_PLANES]);
100
101 guint           gst_d3d11_buffer_get_render_target_view   (GstBuffer * buffer,
102                                                            ID3D11RenderTargetView * view[GST_VIDEO_MAX_PLANES]);
103
104 GstBufferPool * gst_d3d11_buffer_pool_new_with_options  (GstD3D11Device * device,
105                                                          GstCaps * caps,
106                                                          GstD3D11AllocationParams * alloc_params,
107                                                          guint min_buffers,
108                                                          guint max_buffers);
109
110 G_END_DECLS
111
112 #endif /* __GST_D3D11_PLUGIN_UTILS_H__ */