1 /* GStreamer
2 * Copyright (C) 2020 Igalia, S.L.
3 * Author: Víctor Jáquez <vjaquez@igalia.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 #pragma once
22
23 #include <gst/va/va_fwd.h>
24 #include <gst/va/va-prelude.h>
25 #include <gst/gst.h>
26
27 G_BEGIN_DECLS
28
29 /**
30 * GstVaImplementation:
31 * @GST_VA_IMPLEMENTATION_MESA_GALLIUM: The mesa gallium implementation.
32 * @GST_VA_IMPLEMENTATION_INTEL_I965: The legacy i965 intel implementation.
33 * @GST_VA_IMPLEMENTATION_INTEL_IHD: The iHD intel implementation.
34 * @GST_VA_IMPLEMENTATION_OTHER: Other implementation.
35 * @GST_VA_IMPLEMENTATION_INVALID: Invalid implementation.
36 *
37 * Types of different VA API implemented drivers. These are the typical and
38 * the most widely used VA drivers.
39 *
40 * Since: 1.20
41 */
42 typedef enum
43 {
44 GST_VA_IMPLEMENTATION_MESA_GALLIUM,
45 GST_VA_IMPLEMENTATION_INTEL_I965,
46 GST_VA_IMPLEMENTATION_INTEL_IHD,
47 GST_VA_IMPLEMENTATION_OTHER,
48 GST_VA_IMPLEMENTATION_INVALID,
49 } GstVaImplementation;
50
51 /**
52 * GST_VA_DISPLAY_HANDLE_CONTEXT_TYPE_STR:
53 *
54 * Since: 1.20
55 */
56 #define GST_VA_DISPLAY_HANDLE_CONTEXT_TYPE_STR "gst.va.display.handle"
57
58 /**
59 * GST_CAPS_FEATURE_MEMORY_VA:
60 *
61 * Since: 1.20
62 */
63 #define GST_CAPS_FEATURE_MEMORY_VA "memory:VAMemory"
64
65 /**
66 * GST_VA_DISPLAY_IS_IMPLEMENTATION: (skip)
67 *
68 * Check whether the display is the implementation of the specified
69 * #GstVaImplementation type.
70 *
71 * Since: 1.20
72 */
73 #define GST_VA_DISPLAY_IS_IMPLEMENTATION(display, impl) \
74 (gst_va_display_is_implementation (display, G_PASTE (GST_VA_IMPLEMENTATION_, impl)))
75
76 #define GST_TYPE_VA_DISPLAY (gst_va_display_get_type())
77 #define GST_VA_DISPLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_VA_DISPLAY, GstVaDisplay))
78 #define GST_VA_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_VA_DISPLAY, GstVaDisplayClass))
79 #define GST_IS_VA_DISPLAY(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_VA_DISPLAY))
80 #define GST_IS_VA_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_VA_DISPLAY))
81 #define GST_VA_DISPLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GST_TYPE_VA_DISPLAY, GstVaDisplayClass))
82
83 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstVaDisplay, gst_object_unref)
84
85 /**
86 * GstVaDisplay:
87 * @parent: parent #GstObject
88 *
89 * The common VA display object structure.
90 *
91 * Since: 1.20
92 */
93 struct _GstVaDisplay
94 {
95 GstObject parent;
96 };
97
98 /**
99 * GstVaDisplayClass:
100 * @parent_class: parent #GstObjectClass
101 *
102 * The common VA display object class structure.
103 *
104 * Since: 1.20
105 */
106 struct _GstVaDisplayClass
107 {
108 GstObjectClass parent_class;
109
110 /**
111 * GstVaDisplayClass::create_va_display:
112 * @self: a #GstVaDisplay instance
113 *
114 * This is called when the subclass has to create the internal
115 * VADisplay.
116 *
117 * Returns: The created VADisplay
118 */
119 gpointer (*create_va_display) (GstVaDisplay * self);
120 };
121
122 GST_VA_API
123 GType gst_va_display_get_type (void);
124 GST_VA_API
125 void gst_va_display_lock (GstVaDisplay * self);
126 GST_VA_API
127 void gst_va_display_unlock (GstVaDisplay * self);
128 GST_VA_API
129 gboolean gst_va_display_initialize (GstVaDisplay * self);
130 GST_VA_API
131 gpointer gst_va_display_get_va_dpy (GstVaDisplay * self);
132 GST_VA_API
133 GstVaImplementation gst_va_display_get_implementation (GstVaDisplay * self);
134
135 /**
136 * gst_va_display_is_implementation:
137 * @display: the #GstVaDisplay to check.
138 * @impl: the specified #GstVaImplementation.
139 *
140 * Check whether the @display is the implementation of the @impl type.
141 *
142 * Returns: %TRUE if the @display is the implementation of the @impl type.
143 *
144 * Since: 1.20
145 */
146 static inline gboolean
gst_va_display_is_implementation(GstVaDisplay * display,GstVaImplementation impl)147 gst_va_display_is_implementation (GstVaDisplay * display, GstVaImplementation impl)
148 {
149 return (gst_va_display_get_implementation (display) == impl);
150 }
151
152 G_END_DECLS
153