1 /*
2 * GStreamer
3 * Copyright (C) 2019 Matthew Waters <matthew@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_VULKAN_IMAGE_VIEW_H__
22 #define __GST_VULKAN_IMAGE_VIEW_H__
23
24 #include <gst/vulkan/gstvkbarrier.h>
25
26 G_BEGIN_DECLS
27
28 /**
29 * GST_TYPE_VULKAN_IMAGE_VIEW:
30 *
31 * Since: 1.18
32 */
33 #define GST_TYPE_VULKAN_IMAGE_VIEW (gst_vulkan_image_view_get_type())
34 GST_VULKAN_API
35 /**
36 * gst_vulkan_image_view_get_type:
37 *
38 * Since: 1.18
39 */
40 GType gst_vulkan_image_view_get_type(void);
41
42 /**
43 * GstVulkanImageView:
44 * @parent: the parent #GstMiniObject
45 * @device: the #GstVulkanDevice
46 * @image: the associated #GstVulkanImageMemory for this view
47 * @view: the vulkan image view handle
48 * @create_info: the creation information for this view
49 *
50 * Since: 1.18
51 */
52 struct _GstVulkanImageView
53 {
54 GstMiniObject parent;
55
56 GstVulkanDevice * device;
57
58 GstVulkanImageMemory *image;
59 VkImageView view;
60
61 VkImageViewCreateInfo create_info;
62
63 /* <private> */
64 gpointer _reserved [GST_PADDING];
65 };
66
67 /**
68 * gst_vulkan_image_view_ref: (skip)
69 * @trash: a #GstVulkanImageView.
70 *
71 * Increases the refcount of the given trash object by one.
72 *
73 * Returns: (transfer full): @trash
74 *
75 * Since: 1.18
76 */
77 static inline GstVulkanImageView* gst_vulkan_image_view_ref(GstVulkanImageView* trash);
78 static inline GstVulkanImageView *
gst_vulkan_image_view_ref(GstVulkanImageView * trash)79 gst_vulkan_image_view_ref (GstVulkanImageView * trash)
80 {
81 return (GstVulkanImageView *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (trash));
82 }
83
84 /**
85 * gst_vulkan_image_view_unref: (skip)
86 * @trash: (transfer full): a #GstVulkanImageView.
87 *
88 * Decreases the refcount of the trash object. If the refcount reaches 0, the
89 * trash will be freed.
90 *
91 * Since: 1.18
92 */
93 static inline void gst_vulkan_image_view_unref(GstVulkanImageView* trash);
94 static inline void
gst_vulkan_image_view_unref(GstVulkanImageView * trash)95 gst_vulkan_image_view_unref (GstVulkanImageView * trash)
96 {
97 gst_mini_object_unref (GST_MINI_OBJECT_CAST (trash));
98 }
99
100 /**
101 * gst_clear_vulkan_image_view: (skip)
102 * @view_ptr: a pointer to a #GstVulkanImageView reference
103 *
104 * Clears a reference to a #GstVulkanImageView.
105 *
106 * @view_ptr must not be %NULL.
107 *
108 * If the reference is %NULL then this function does nothing. Otherwise, the
109 * reference count of the descriptor set is decreased and the pointer is set
110 * to %NULL.
111 *
112 * Since: 1.18
113 */
114 static inline void
gst_clear_vulkan_image_view(GstVulkanImageView ** view_ptr)115 gst_clear_vulkan_image_view (GstVulkanImageView ** view_ptr)
116 {
117 gst_clear_mini_object ((GstMiniObject **) view_ptr);
118 }
119
120 #ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
121 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstVulkanImageView, gst_vulkan_image_view_unref)
122 #endif
123
124 GST_VULKAN_API
125 GstVulkanImageView * gst_vulkan_image_view_new (GstVulkanImageMemory * image,
126 VkImageViewCreateInfo * create_info);
127
128 G_END_DECLS
129
130 #endif /* __GST_VULKAN_IMAGE_MEMORY_H__ */
131