• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* GStreamer
2  * Copyright (C) 2019 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_FORMAT_H__
21 #define __GST_D3D11_FORMAT_H__
22 
23 #include <gst/gst.h>
24 #include <gst/video/video.h>
25 #include <gst/d3d11/gstd3d11_fwd.h>
26 
27 G_BEGIN_DECLS
28 
29 #define GST_D3D11_COMMON_FORMATS \
30     "BGRA, RGBA, RGB10A2_LE, BGRx, RGBx, VUYA, NV12, NV21, " \
31     "P010_10LE, P012_LE, P016_LE, I420, YV12, I420_10LE, I420_12LE, " \
32     "Y42B, I422_10LE, I422_12LE, Y444, Y444_10LE, Y444_12LE, Y444_16LE, " \
33     "GRAY8, GRAY16_LE"
34 
35 #define GST_D3D11_EXTRA_IN_FORMATS \
36     "Y410"
37 
38 #define GST_D3D11_SINK_FORMATS \
39     "{ " GST_D3D11_COMMON_FORMATS " ," GST_D3D11_EXTRA_IN_FORMATS " }"
40 
41 #define GST_D3D11_SRC_FORMATS \
42     "{ " GST_D3D11_COMMON_FORMATS " }"
43 
44 #define GST_D3D11_ALL_FORMATS \
45     "{ " GST_D3D11_COMMON_FORMATS " ," GST_D3D11_EXTRA_IN_FORMATS " }"
46 
47 struct _GstD3D11Format
48 {
49   GstVideoFormat format;
50 
51   /* direct mapping to dxgi format if applicable */
52   DXGI_FORMAT dxgi_format;
53 
54   /* formats for texture processing */
55   DXGI_FORMAT resource_format[GST_VIDEO_MAX_PLANES];
56 
57   /*< private >*/
58   gpointer _gst_reserved[GST_PADDING];
59 };
60 
61 GST_D3D11_API
62 guint           gst_d3d11_dxgi_format_n_planes      (DXGI_FORMAT format);
63 
64 GST_D3D11_API
65 gboolean        gst_d3d11_dxgi_format_get_size      (DXGI_FORMAT format,
66                                                      guint width,
67                                                      guint height,
68                                                      guint pitch,
69                                                      gsize offset[GST_VIDEO_MAX_PLANES],
70                                                      gint stride[GST_VIDEO_MAX_PLANES],
71                                                      gsize *size);
72 
73 GST_D3D11_API
74 GstVideoFormat  gst_d3d11_dxgi_format_to_gst        (DXGI_FORMAT format);
75 
76 G_END_DECLS
77 
78 #endif /* __GST_D3D11_FORMAT_H__ */
79