Merging gstreamer-sharp
[platform/upstream/gstreamer.git] / subprojects / gst-plugins-bad / sys / d3d11 / gstd3d11videoprocessor.h
1 /* GStreamer
2  * Copyright (C) <2020> Seungha Yang <seungha.yang@navercorp.com>
3  *
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.
8  *
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.
13  *
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.
18  */
19
20 #ifndef __GST_D3D11_VIDEO_PROCESSOR_H__
21 #define __GST_D3D11_VIDEO_PROCESSOR_H__
22
23 #include <gst/gst.h>
24 #include <gst/video/video.h>
25 #include <gst/d3d11/gstd3d11.h>
26
27 G_BEGIN_DECLS
28
29 typedef struct _GstD3D11VideoProcessor GstD3D11VideoProcessor;
30
31 GstD3D11VideoProcessor * gst_d3d11_video_processor_new  (GstD3D11Device * device,
32                                                          guint in_width,
33                                                          guint in_height,
34                                                          guint out_width,
35                                                          guint out_height);
36
37 void      gst_d3d11_video_processor_free (GstD3D11VideoProcessor * processor);
38
39 gboolean  gst_d3d11_video_processor_supports_input_format (GstD3D11VideoProcessor * processor,
40                                                            DXGI_FORMAT format);
41
42 gboolean  gst_d3d11_video_processor_supports_output_format (GstD3D11VideoProcessor * processor,
43                                                             DXGI_FORMAT format);
44
45 gboolean  gst_d3d11_video_processor_get_caps (GstD3D11VideoProcessor * processor,
46                                               D3D11_VIDEO_PROCESSOR_CAPS * caps);
47
48 gboolean  gst_d3d11_video_processor_set_input_color_space  (GstD3D11VideoProcessor * processor,
49                                                             GstVideoColorimetry * color);
50
51 gboolean  gst_d3d11_video_processor_set_output_color_space (GstD3D11VideoProcessor * processor,
52                                                             GstVideoColorimetry * color);
53
54 #if (GST_D3D11_DXGI_HEADER_VERSION >= 4)
55 gboolean  gst_d3d11_video_processor_check_format_conversion (GstD3D11VideoProcessor * processor,
56                                                              DXGI_FORMAT in_format,
57                                                              DXGI_COLOR_SPACE_TYPE in_color_space,
58                                                              DXGI_FORMAT out_format,
59                                                              DXGI_COLOR_SPACE_TYPE out_color_space);
60
61 gboolean  gst_d3d11_video_processor_set_input_dxgi_color_space (GstD3D11VideoProcessor * processor,
62                                                                 DXGI_COLOR_SPACE_TYPE color_space);
63
64 gboolean  gst_d3d11_video_processor_set_output_dxgi_color_space (GstD3D11VideoProcessor * processor,
65                                                                 DXGI_COLOR_SPACE_TYPE color_space);
66 #endif
67
68 #if (GST_D3D11_DXGI_HEADER_VERSION >= 5)
69 gboolean  gst_d3d11_video_processor_set_input_hdr10_metadata (GstD3D11VideoProcessor * processor,
70                                                               DXGI_HDR_METADATA_HDR10 * hdr10_meta);
71
72 gboolean  gst_d3d11_video_processor_set_output_hdr10_metadata (GstD3D11VideoProcessor * processor,
73                                                               DXGI_HDR_METADATA_HDR10 * hdr10_meta);
74 #endif
75
76 gboolean  gst_d3d11_video_processor_create_input_view  (GstD3D11VideoProcessor * processor,
77                                                         D3D11_VIDEO_PROCESSOR_INPUT_VIEW_DESC * desc,
78                                                         ID3D11Resource *resource,
79                                                         ID3D11VideoProcessorInputView ** view);
80
81 ID3D11VideoProcessorInputView * gst_d3d11_video_processor_get_input_view (GstD3D11VideoProcessor * processor,
82                                                                           GstD3D11Memory *mem);
83
84 gboolean  gst_d3d11_video_processor_create_output_view (GstD3D11VideoProcessor * processor,
85                                                         D3D11_VIDEO_PROCESSOR_OUTPUT_VIEW_DESC * desc,
86                                                         ID3D11Resource *resource,
87                                                         ID3D11VideoProcessorOutputView ** view);
88
89 ID3D11VideoProcessorOutputView * gst_d3d11_video_processor_get_output_view (GstD3D11VideoProcessor * processor,
90                                                                             GstD3D11Memory *mem);
91
92 gboolean  gst_d3d11_video_processor_render             (GstD3D11VideoProcessor * processor,
93                                                         RECT *in_rect,
94                                                         ID3D11VideoProcessorInputView * in_view,
95                                                         RECT *out_rect,
96                                                         ID3D11VideoProcessorOutputView * out_view);
97
98 gboolean  gst_d3d11_video_processor_render_unlocked    (GstD3D11VideoProcessor * processor,
99                                                         RECT *in_rect,
100                                                         ID3D11VideoProcessorInputView * in_view,
101                                                         RECT *out_rect,
102                                                         ID3D11VideoProcessorOutputView * out_view);
103
104 /* utils */
105 gboolean gst_d3d11_video_processor_check_bind_flags_for_input_view (guint bind_flags);
106
107 gboolean gst_d3d11_video_processor_check_bind_flags_for_output_view (guint bind_flags);
108
109 G_END_DECLS
110
111 #endif /* __GST_D3D11_VIDEO_PROCESSOR_H__ */