1 /*
2  * GStreamer
3  * Copyright (C) 2016 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 _VK_FENCE_H_
22 #define _VK_FENCE_H_
23 
24 #include <vk.h>
25 
26 #define GST_TYPE_VULKAN_FENCE (gst_vulkan_fence_get_type ())
27 GType gst_vulkan_fence_get_type (void);
28 
29 #define GST_VULKAN_FENCE_CAST(f) ((GstVulkanFence *) f)
30 #define GST_VULKAN_FENCE_FENCE(f) (GST_VULKAN_FENCE_CAST(f)->fence)
31 
32 G_BEGIN_DECLS
33 
34 struct _GstVulkanFence
35 {
36   GstMiniObject parent;
37 
38   GstVulkanDevice *device;
39 
40   VkFence fence;
41 };
42 
43 GstVulkanFence *    gst_vulkan_fence_new            (GstVulkanDevice * device,
44                                                      VkFenceCreateFlags flags,
45                                                      GError ** error);
46 GstVulkanFence *    gst_vulkan_fence_wait           (GstVulkanFence * fence);
47 gboolean            gst_vulkan_fence_is_signaled    (GstVulkanFence * fence);
48 
49 static inline GstVulkanFence *
gst_vulkan_fence_ref(GstVulkanFence * fence)50 gst_vulkan_fence_ref (GstVulkanFence * fence)
51 {
52   return GST_VULKAN_FENCE_CAST (gst_mini_object_ref (GST_MINI_OBJECT_CAST (fence)));
53 }
54 
55 static inline void
gst_vulkan_fence_unref(GstVulkanFence * fence)56 gst_vulkan_fence_unref (GstVulkanFence * fence)
57 {
58   gst_mini_object_unref (GST_MINI_OBJECT_CAST (fence));
59 }
60 
61 G_END_DECLS
62 
63 #endif /* _VK_FENCE_H_ */
64