1 /* 2 * GStreamer 3 * Copyright (C) 2015 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_SWAPPER_H__ 22 #define __GST_VULKAN_SWAPPER_H__ 23 24 #include <gst/video/video.h> 25 26 #include <gst/vulkan/vulkan.h> 27 28 G_BEGIN_DECLS 29 30 #define GST_TYPE_VULKAN_SWAPPER (gst_vulkan_swapper_get_type()) 31 #define GST_VULKAN_SWAPPER(o) (G_TYPE_CHECK_INSTANCE_CAST((o), GST_TYPE_VULKAN_SWAPPER, GstVulkanSwapper)) 32 #define GST_VULKAN_SWAPPER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GST_TYPE_VULKAN_SWAPPER, GstVulkanSwapperClass)) 33 #define GST_IS_VULKAN_SWAPPER(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), GST_TYPE_VULKAN_SWAPPER)) 34 #define GST_IS_VULKAN_SWAPPER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), GST_TYPE_VULKAN_SWAPPER)) 35 #define GST_VULKAN_SWAPPER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GST_TYPE_VULKAN_SWAPPER, GstVulkanSwapperClass)) 36 GST_VULKAN_API 37 GType gst_vulkan_swapper_get_type (void); 38 39 /** 40 * GST_VULKAN_SWAPPER_VIDEO_FORMATS: 41 * 42 * Since: 1.18 43 */ 44 #define GST_VULKAN_SWAPPER_VIDEO_FORMATS " { RGBA, BGRA, RGB, BGR } " 45 46 typedef struct _GstVulkanSwapper GstVulkanSwapper; 47 typedef struct _GstVulkanSwapperClass GstVulkanSwapperClass; 48 typedef struct _GstVulkanSwapperPrivate GstVulkanSwapperPrivate; 49 50 /** 51 * GstVulkanSwapper: 52 * @parent: parent #GstObject 53 * @device: the #GstVulkanDevice 54 * @window: the #GstVulkanWindow to display into 55 * @queue: the #GstVulkanQueue to display with 56 * @cmd_pool: the #GstVulkanCommandPool to allocate command buffers from 57 * 58 * Since: 1.18 59 */ 60 struct _GstVulkanSwapper 61 { 62 GstObject parent; 63 64 GstVulkanDevice *device; 65 GstVulkanWindow *window; 66 GstVulkanQueue *queue; 67 GstVulkanCommandPool *cmd_pool; 68 69 /* <private> */ 70 gpointer _reserved [GST_PADDING]; 71 }; 72 73 /** 74 * GstVulkanSwapperClass: 75 * @parent_class: parent #GstObjectClass 76 * 77 * Since: 1.18 78 */ 79 struct _GstVulkanSwapperClass 80 { 81 GstObjectClass parent_class; 82 83 /* <private> */ 84 gpointer _reserved [GST_PADDING]; 85 }; 86 87 G_DEFINE_AUTOPTR_CLEANUP_FUNC (GstVulkanSwapper, gst_object_unref) 88 89 GST_VULKAN_API 90 GstVulkanSwapper * gst_vulkan_swapper_new (GstVulkanDevice * device, 91 GstVulkanWindow * window); 92 93 GST_VULKAN_API 94 gboolean gst_vulkan_swapper_choose_queue (GstVulkanSwapper * swapper, 95 GstVulkanQueue * available_queue, 96 GError ** error); 97 GST_VULKAN_API 98 GstCaps * gst_vulkan_swapper_get_supported_caps (GstVulkanSwapper * swapper, 99 GError ** error); 100 GST_VULKAN_API 101 gboolean gst_vulkan_swapper_set_caps (GstVulkanSwapper * swapper, 102 GstCaps * caps, 103 GError ** error); 104 GST_VULKAN_API 105 gboolean gst_vulkan_swapper_render_buffer (GstVulkanSwapper * swapper, 106 GstBuffer * buffer, 107 GError ** error); 108 109 GST_VULKAN_API 110 void gst_vulkan_swapper_get_surface_rectangles (GstVulkanSwapper *swapper, 111 GstVideoRectangle *input_image, 112 GstVideoRectangle *surface_location, 113 GstVideoRectangle *display_rect); 114 115 G_END_DECLS 116 117 #endif /* __GST_VULKAN_SWAPPER_H__ */ 118