2 * gstvaapidisplay_priv.h - Base VA display (private definitions)
4 * Copyright (C) 2010-2011 Splitted-Desktop Systems
5 * Author: Gwenole Beauchesne <gwenole.beauchesne@splitted-desktop.com>
6 * Copyright (C) 2011-2013 Intel Corporation
7 * Author: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation; either version 2.1
12 * of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free
21 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 * Boston, MA 02110-1301 USA
25 #ifndef GST_VAAPI_DISPLAY_PRIV_H
26 #define GST_VAAPI_DISPLAY_PRIV_H
28 #include <gst/vaapi/gstvaapidisplay.h>
29 #include <gst/vaapi/gstvaapidisplaycache.h>
30 #include "gstvaapiminiobject.h"
34 #define GST_VAAPI_DISPLAY_CAST(display) \
35 ((GstVaapiDisplay *)(display))
37 #define GST_VAAPI_DISPLAY_GET_PRIVATE(display) \
38 (&GST_VAAPI_DISPLAY_CAST(display)->priv)
40 #define GST_VAAPI_DISPLAY_CLASS(klass) \
41 ((GstVaapiDisplayClass *)(klass))
43 #define GST_VAAPI_IS_DISPLAY_CLASS(klass) \
46 #define GST_VAAPI_DISPLAY_GET_CLASS(obj) \
47 GST_VAAPI_DISPLAY_CLASS(GST_VAAPI_MINI_OBJECT_GET_CLASS(obj))
49 typedef struct _GstVaapiDisplayPrivate GstVaapiDisplayPrivate;
50 typedef struct _GstVaapiDisplayClass GstVaapiDisplayClass;
51 typedef enum _GstVaapiDisplayInitType GstVaapiDisplayInitType;
53 typedef void (*GstVaapiDisplayInitFunc) (GstVaapiDisplay * display);
54 typedef gboolean (*GstVaapiDisplayBindFunc) (GstVaapiDisplay * display,
56 typedef gboolean (*GstVaapiDisplayOpenFunc) (GstVaapiDisplay * display,
58 typedef void (*GstVaapiDisplayCloseFunc) (GstVaapiDisplay * display);
59 typedef void (*GstVaapiDisplayLockFunc) (GstVaapiDisplay * display);
60 typedef void (*GstVaapiDisplayUnlockFunc) (GstVaapiDisplay * display);
61 typedef void (*GstVaapiDisplaySyncFunc) (GstVaapiDisplay * display);
62 typedef void (*GstVaapiDisplayFlushFunc) (GstVaapiDisplay * display);
63 typedef gboolean (*GstVaapiDisplayGetInfoFunc) (GstVaapiDisplay * display,
64 GstVaapiDisplayInfo * info);
65 typedef void (*GstVaapiDisplayGetSizeFunc) (GstVaapiDisplay * display,
66 guint * pwidth, guint * pheight);
67 typedef void (*GstVaapiDisplayGetSizeMFunc) (GstVaapiDisplay * display,
68 guint * pwidth, guint * pheight);
71 * GST_VAAPI_DISPLAY_VADISPLAY:
72 * @display_: a #GstVaapiDisplay
74 * Macro that evaluates to the #VADisplay of @display.
75 * This is an internal macro that does not do any run-time type check.
77 #undef GST_VAAPI_DISPLAY_VADISPLAY
78 #define GST_VAAPI_DISPLAY_VADISPLAY(display_) \
79 GST_VAAPI_DISPLAY_GET_PRIVATE(display_)->display
82 * GST_VAAPI_DISPLAY_LOCK:
83 * @display: a #GstVaapiDisplay
87 #undef GST_VAAPI_DISPLAY_LOCK
88 #define GST_VAAPI_DISPLAY_LOCK(display) \
89 gst_vaapi_display_lock(GST_VAAPI_DISPLAY_CAST(display))
92 * GST_VAAPI_DISPLAY_UNLOCK:
93 * @display: a #GstVaapiDisplay
97 #undef GST_VAAPI_DISPLAY_UNLOCK
98 #define GST_VAAPI_DISPLAY_UNLOCK(display) \
99 gst_vaapi_display_unlock(GST_VAAPI_DISPLAY_CAST(display))
102 * GST_VAAPI_DISPLAY_TYPE:
103 * @display: a #GstVaapiDisplay
105 * Returns the @display type
107 #undef GST_VAAPI_DISPLAY_TYPE
108 #define GST_VAAPI_DISPLAY_TYPE(display) \
109 GST_VAAPI_DISPLAY_GET_PRIVATE(display)->display_type
112 * GST_VAAPI_DISPLAY_TYPES:
113 * @display: a #GstVaapiDisplay
115 * Returns compatible @display types as a set of flags
117 #undef GST_VAAPI_DISPLAY_TYPES
118 #define GST_VAAPI_DISPLAY_TYPES(display) \
119 gst_vaapi_display_get_display_types(GST_VAAPI_DISPLAY_CAST(display))
122 * GST_VAAPI_DISPLAY_HAS_VPP:
123 * @display: a @GstVaapiDisplay
125 * Returns whether the @display supports video processing (VA/VPP)
127 #undef GST_VAAPI_DISPLAY_HAS_VPP
128 #define GST_VAAPI_DISPLAY_HAS_VPP(display) \
129 gst_vaapi_display_has_video_processing(GST_VAAPI_DISPLAY_CAST(display))
132 * GST_VAAPI_DISPLAY_CACHE:
133 * @display: a @GstVaapiDisplay
135 * Returns the #GstVaapiDisplayCache attached to the supplied @display object.
137 #undef GST_VAAPI_DISPLAY_GET_CACHE
138 #define GST_VAAPI_DISPLAY_GET_CACHE(display) \
139 (GST_VAAPI_DISPLAY_GET_PRIVATE (display)->cache)
141 struct _GstVaapiDisplayPrivate
143 GstVaapiDisplay *parent;
144 GstVaapiDisplayCache *cache;
146 GstVaapiDisplayType display_type;
156 GArray *image_formats;
157 GArray *subpicture_formats;
159 gchar *vendor_string;
160 guint use_foreign_display:1;
162 guint has_profiles:1;
168 * Base class for VA displays.
170 struct _GstVaapiDisplay
173 GstVaapiMiniObject parent_instance;
175 GstVaapiDisplayPrivate priv;
179 * GstVaapiDisplayClass:
180 * @open_display: virtual function to open a display
181 * @close_display: virtual function to close a display
182 * @lock: (optional) virtual function to lock a display
183 * @unlock: (optional) virtual function to unlock a display
184 * @sync: (optional) virtual function to sync a display
185 * @flush: (optional) virtual function to flush pending requests of a display
186 * @get_display: virtual function to retrieve the #GstVaapiDisplayInfo
187 * @get_size: virtual function to retrieve the display dimensions, in pixels
188 * @get_size_mm: virtual function to retrieve the display dimensions, in millimeters
190 * Base class for VA displays.
192 struct _GstVaapiDisplayClass
195 GstVaapiMiniObjectClass parent_class;
201 GstVaapiDisplayInitFunc init;
202 GstVaapiDisplayBindFunc bind_display;
203 GstVaapiDisplayOpenFunc open_display;
204 GstVaapiDisplayCloseFunc close_display;
205 GstVaapiDisplayLockFunc lock;
206 GstVaapiDisplayUnlockFunc unlock;
207 GstVaapiDisplaySyncFunc sync;
208 GstVaapiDisplayFlushFunc flush;
209 GstVaapiDisplayGetInfoFunc get_display;
210 GstVaapiDisplayGetSizeFunc get_size;
211 GstVaapiDisplayGetSizeMFunc get_size_mm;
214 /* Initialization types */
215 enum _GstVaapiDisplayInitType
217 GST_VAAPI_DISPLAY_INIT_FROM_DISPLAY_NAME = 1,
218 GST_VAAPI_DISPLAY_INIT_FROM_NATIVE_DISPLAY,
219 GST_VAAPI_DISPLAY_INIT_FROM_VA_DISPLAY
223 gst_vaapi_display_class_init (GstVaapiDisplayClass * klass);
226 gst_vaapi_display_new (const GstVaapiDisplayClass * klass,
227 GstVaapiDisplayInitType init_type, gpointer init_value);
230 gst_vaapi_display_get_display_types (GstVaapiDisplay * display)
232 const GstVaapiDisplayClass *const dpy_class =
233 GST_VAAPI_DISPLAY_GET_CLASS (display);
235 return dpy_class->display_types;
238 /* Inline reference counting for core libgstvaapi library */
239 #ifdef IN_LIBGSTVAAPI_CORE
240 #define gst_vaapi_display_ref_internal(display) \
241 ((gpointer)gst_vaapi_mini_object_ref(GST_VAAPI_MINI_OBJECT(display)))
243 #define gst_vaapi_display_unref_internal(display) \
244 gst_vaapi_mini_object_unref(GST_VAAPI_MINI_OBJECT(display))
246 #define gst_vaapi_display_replace_internal(old_display_ptr, new_display) \
247 gst_vaapi_mini_object_replace((GstVaapiMiniObject **)(old_display_ptr), \
248 GST_VAAPI_MINI_OBJECT(new_display))
250 #undef gst_vaapi_display_ref
251 #define gst_vaapi_display_ref(display) \
252 gst_vaapi_display_ref_internal((display))
254 #undef gst_vaapi_display_unref
255 #define gst_vaapi_display_unref(display) \
256 gst_vaapi_display_unref_internal((display))
258 #undef gst_vaapi_display_replace
259 #define gst_vaapi_display_replace(old_display_ptr, new_display) \
260 gst_vaapi_display_replace_internal((old_display_ptr), (new_display))
265 #endif /* GST_VAAPI_DISPLAY_PRIV_H */