• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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#ifdef HAVE_CONFIG_H
22#include "config.h"
23#endif
24
25#include <UIKit/UIKit.h>
26
27#include <gst/vulkan/vulkan.h>
28
29#include "gstvkdisplay_ios.h"
30
31#define GST_CAT_DEFAULT gst_vulkan_display_debug
32GST_DEBUG_CATEGORY_STATIC (gst_vulkan_display_debug);
33
34G_DEFINE_TYPE (GstVulkanDisplayIos, gst_vulkan_display_ios,
35    GST_TYPE_VULKAN_DISPLAY);
36
37static void gst_vulkan_display_ios_finalize (GObject * object);
38static gpointer gst_vulkan_display_ios_get_handle (GstVulkanDisplay * display);
39
40static void
41gst_vulkan_display_ios_class_init (GstVulkanDisplayIosClass * klass)
42{
43  GST_VULKAN_DISPLAY_CLASS (klass)->get_handle =
44      GST_DEBUG_FUNCPTR (gst_vulkan_display_ios_get_handle);
45
46  G_OBJECT_CLASS (klass)->finalize = gst_vulkan_display_ios_finalize;
47}
48
49static void
50gst_vulkan_display_ios_init (GstVulkanDisplayIos * display_ios)
51{
52  GstVulkanDisplay *display = (GstVulkanDisplay *) display_ios;
53
54  display->type = GST_VULKAN_DISPLAY_TYPE_IOS;
55}
56
57static void
58gst_vulkan_display_ios_finalize (GObject * object)
59{
60  G_OBJECT_CLASS (gst_vulkan_display_ios_parent_class)->finalize (object);
61}
62
63/**
64 * gst_vulkan_display_ios_new:
65 *
66 * Create a new #GstVulkanDisplayIos.
67 *
68 * Returns: (transfer full): a new #GstVulkanDisplayIos or %NULL
69 */
70GstVulkanDisplayIos *
71gst_vulkan_display_ios_new (void)
72{
73  GstVulkanDisplayIos *ret;
74
75  GST_DEBUG_CATEGORY_GET (gst_vulkan_display_debug, "vulkandisplay");
76
77  ret = g_object_new (GST_TYPE_VULKAN_DISPLAY_IOS, NULL);
78  gst_object_ref_sink (ret);
79
80  return ret;
81}
82
83static gpointer
84gst_vulkan_display_ios_get_handle (GstVulkanDisplay * display)
85{
86  return (gpointer) (__bridge gpointer) [UIApplication sharedApplication];
87}
88