2 * gstvaapidisplay_priv.h - Base VA display (private definitions)
4 * Copyright (C) 2010-2011 Splitted-Desktop Systems
5 * Copyright (C) 2011-2012 Intel Corporation
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public License
9 * as published by the Free Software Foundation; either version 2.1
10 * of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301 USA
23 #ifndef GST_VAAPI_DISPLAY_PRIV_H
24 #define GST_VAAPI_DISPLAY_PRIV_H
26 #include <gst/vaapi/gstvaapidisplay.h>
27 #include <gst/vaapi/gstvaapidisplaycache.h>
28 #include "gstvaapiminiobject.h"
32 #define GST_VAAPI_DISPLAY_CAST(display) \
33 ((GstVaapiDisplay *)(display))
35 #define GST_VAAPI_DISPLAY_GET_PRIVATE(display) \
36 (&GST_VAAPI_DISPLAY_CAST(display)->priv)
38 #define GST_VAAPI_DISPLAY_CLASS(klass) \
39 ((GstVaapiDisplayClass *)(klass))
41 #define GST_VAAPI_IS_DISPLAY_CLASS(klass) \
44 #define GST_VAAPI_DISPLAY_GET_CLASS(obj) \
45 GST_VAAPI_DISPLAY_CLASS(GST_VAAPI_MINI_OBJECT_GET_CLASS(obj))
47 typedef struct _GstVaapiDisplayPrivate GstVaapiDisplayPrivate;
48 typedef struct _GstVaapiDisplayClass GstVaapiDisplayClass;
49 typedef enum _GstVaapiDisplayInitType GstVaapiDisplayInitType;
51 typedef void (*GstVaapiDisplayInitFunc) (GstVaapiDisplay *display);
52 typedef gboolean (*GstVaapiDisplayBindFunc) (GstVaapiDisplay *display,
54 typedef gboolean (*GstVaapiDisplayOpenFunc) (GstVaapiDisplay *display,
56 typedef void (*GstVaapiDisplayCloseFunc) (GstVaapiDisplay *display);
57 typedef void (*GstVaapiDisplayLockFunc) (GstVaapiDisplay *display);
58 typedef void (*GstVaapiDisplayUnlockFunc) (GstVaapiDisplay *display);
59 typedef void (*GstVaapiDisplaySyncFunc) (GstVaapiDisplay *display);
60 typedef void (*GstVaapiDisplayFlushFunc) (GstVaapiDisplay *display);
61 typedef gboolean (*GstVaapiDisplayGetInfoFunc) (GstVaapiDisplay *display,
62 GstVaapiDisplayInfo *info);
63 typedef void (*GstVaapiDisplayGetSizeFunc) (GstVaapiDisplay *display,
64 guint *pwidth, guint *pheight);
65 typedef void (*GstVaapiDisplayGetSizeMFunc)(GstVaapiDisplay *display,
66 guint *pwidth, guint *pheight);
69 * GST_VAAPI_DISPLAY_VADISPLAY:
70 * @display_: a #GstVaapiDisplay
72 * Macro that evaluates to the #VADisplay of @display.
73 * This is an internal macro that does not do any run-time type check.
75 #undef GST_VAAPI_DISPLAY_VADISPLAY
76 #define GST_VAAPI_DISPLAY_VADISPLAY(display_) \
77 GST_VAAPI_DISPLAY_GET_PRIVATE(display_)->display
80 * GST_VAAPI_DISPLAY_LOCK:
81 * @display: a #GstVaapiDisplay
85 #undef GST_VAAPI_DISPLAY_LOCK
86 #define GST_VAAPI_DISPLAY_LOCK(display) \
87 gst_vaapi_display_lock(GST_VAAPI_DISPLAY_CAST(display))
90 * GST_VAAPI_DISPLAY_UNLOCK:
91 * @display: a #GstVaapiDisplay
95 #undef GST_VAAPI_DISPLAY_UNLOCK
96 #define GST_VAAPI_DISPLAY_UNLOCK(display) \
97 gst_vaapi_display_unlock(GST_VAAPI_DISPLAY_CAST(display))
100 * GST_VAAPI_DISPLAY_TYPE:
101 * @display: a #GstVaapiDisplay
103 * Returns the @display type
105 #undef GST_VAAPI_DISPLAY_TYPE
106 #define GST_VAAPI_DISPLAY_TYPE(display) \
107 GST_VAAPI_DISPLAY_GET_PRIVATE(display)->display_type
110 * GST_VAAPI_DISPLAY_TYPES:
111 * @display: a #GstVaapiDisplay
113 * Returns compatible @display types as a set of flags
115 #undef GST_VAAPI_DISPLAY_TYPES
116 #define GST_VAAPI_DISPLAY_TYPES(display) \
117 gst_vaapi_display_get_display_types(GST_VAAPI_DISPLAY_CAST(display))
120 * GST_VAAPI_DISPLAY_HAS_VPP:
121 * @display: a @GstVaapiDisplay
123 * Returns whether the @display supports video processing (VA/VPP)
125 #undef GST_VAAPI_DISPLAY_HAS_VPP
126 #define GST_VAAPI_DISPLAY_HAS_VPP(display) \
127 (GST_VAAPI_DISPLAY_GET_PRIVATE(display)->has_vpp)
129 struct _GstVaapiDisplayPrivate {
130 GstVaapiDisplay *parent;
132 GstVaapiDisplayType display_type;
142 GArray *image_formats;
143 GArray *subpicture_formats;
145 guint use_foreign_display : 1;
152 * Base class for VA displays.
154 struct _GstVaapiDisplay {
156 GstVaapiMiniObject parent_instance;
158 GstVaapiDisplayPrivate priv;
162 * GstVaapiDisplayClass:
163 * @open_display: virtual function to open a display
164 * @close_display: virtual function to close a display
165 * @lock: (optional) virtual function to lock a display
166 * @unlock: (optional) virtual function to unlock a display
167 * @sync: (optional) virtual function to sync a display
168 * @flush: (optional) virtual function to flush pending requests of a display
169 * @get_display: virtual function to retrieve the #GstVaapiDisplayInfo
170 * @get_size: virtual function to retrieve the display dimensions, in pixels
171 * @get_size_mm: virtual function to retrieve the display dimensions, in millimeters
173 * Base class for VA displays.
175 struct _GstVaapiDisplayClass {
177 GstVaapiMiniObjectClass parent_class;
183 GstVaapiDisplayInitFunc init;
184 GstVaapiDisplayBindFunc bind_display;
185 GstVaapiDisplayOpenFunc open_display;
186 GstVaapiDisplayCloseFunc close_display;
187 GstVaapiDisplayLockFunc lock;
188 GstVaapiDisplayUnlockFunc unlock;
189 GstVaapiDisplaySyncFunc sync;
190 GstVaapiDisplayFlushFunc flush;
191 GstVaapiDisplayGetInfoFunc get_display;
192 GstVaapiDisplayGetSizeFunc get_size;
193 GstVaapiDisplayGetSizeMFunc get_size_mm;
196 /* Initialization types */
197 enum _GstVaapiDisplayInitType {
198 GST_VAAPI_DISPLAY_INIT_FROM_DISPLAY_NAME = 1,
199 GST_VAAPI_DISPLAY_INIT_FROM_NATIVE_DISPLAY,
200 GST_VAAPI_DISPLAY_INIT_FROM_VA_DISPLAY
204 gst_vaapi_display_class_init(GstVaapiDisplayClass *klass);
207 gst_vaapi_display_new(const GstVaapiDisplayClass *klass,
208 GstVaapiDisplayInitType init_type, gpointer init_value);
210 GstVaapiDisplayCache *
211 gst_vaapi_display_get_cache(void);
214 gst_vaapi_display_get_display_types(GstVaapiDisplay *display)
216 const GstVaapiDisplayClass * const dpy_class =
217 GST_VAAPI_DISPLAY_GET_CLASS(display);
219 return dpy_class->display_types;
222 /* Inline reference counting for core libgstvaapi library */
223 #ifdef GST_VAAPI_CORE
224 #define gst_vaapi_display_ref_internal(display) \
225 ((gpointer)gst_vaapi_mini_object_ref(GST_VAAPI_MINI_OBJECT(display)))
227 #define gst_vaapi_display_unref_internal(display) \
228 gst_vaapi_mini_object_unref(GST_VAAPI_MINI_OBJECT(display))
230 #define gst_vaapi_display_replace_internal(old_display_ptr, new_display) \
231 gst_vaapi_mini_object_replace((GstVaapiMiniObject **)(old_display_ptr), \
232 GST_VAAPI_MINI_OBJECT(new_display))
234 #undef gst_vaapi_display_ref
235 #define gst_vaapi_display_ref(display) \
236 gst_vaapi_display_ref_internal((display))
238 #undef gst_vaapi_display_unref
239 #define gst_vaapi_display_unref(display) \
240 gst_vaapi_display_unref_internal((display))
242 #undef gst_vaapi_display_replace
243 #define gst_vaapi_display_replace(old_display_ptr, new_display) \
244 gst_vaapi_display_replace_internal((old_display_ptr), (new_display))
249 #endif /* GST_VAAPI_DISPLAY_PRIV_H */