2 * gstvaapiwindow_priv.h - VA window abstraction (private definitions)
4 * Copyright (C) 2010-2011 Splitted-Desktop Systems
5 * Author: Gwenole Beauchesne <gwenole.beauchesne@splitted-desktop.com>
6 * Copyright (C) 2012-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_WINDOW_PRIV_H
26 #define GST_VAAPI_WINDOW_PRIV_H
28 #include "gstvaapiobject_priv.h"
32 #define GST_VAAPI_WINDOW_CLASS(klass) \
33 ((GstVaapiWindowClass *)(klass))
35 #define GST_VAAPI_WINDOW_GET_CLASS(obj) \
36 GST_VAAPI_WINDOW_CLASS(GST_VAAPI_OBJECT_GET_CLASS(obj))
38 /* GstVaapiWindowClass hooks */
39 typedef gboolean (*GstVaapiWindowCreateFunc) (GstVaapiWindow *window,
40 guint *width, guint *height);
41 typedef gboolean (*GstVaapiWindowShowFunc) (GstVaapiWindow *window);
42 typedef gboolean (*GstVaapiWindowHideFunc) (GstVaapiWindow *window);
43 typedef gboolean (*GstVaapiWindowGetGeometryFunc)(GstVaapiWindow *window,
44 gint *px, gint *py, guint *pwidth, guint *pheight);
45 typedef gboolean (*GstVaapiWindowSetFullscreenFunc)(GstVaapiWindow *window,
47 typedef gboolean (*GstVaapiWindowResizeFunc) (GstVaapiWindow *window,
48 guint width, guint height);
49 typedef gboolean (*GstVaapiWindowRenderFunc) (GstVaapiWindow *window,
50 GstVaapiSurface *surface, const GstVaapiRectangle *src_rect,
51 const GstVaapiRectangle *dst_rect, guint flags);
52 typedef gboolean (*GstVaapiWindowRenderPixmapFunc)(GstVaapiWindow *window,
53 GstVaapiPixmap *pixmap, const GstVaapiRectangle *src_rect,
54 const GstVaapiRectangle *dst_rect);
59 * Base class for system-dependent windows.
61 struct _GstVaapiWindow {
63 GstVaapiObject parent_instance;
70 guint use_foreign_window : 1;
71 guint is_fullscreen : 1;
72 guint check_geometry : 1;
76 * GstVaapiWindowClass:
77 * @create: virtual function to create a window with width and height
78 * @show: virtual function to show (map) a window
79 * @hide: virtual function to hide (unmap) a window
80 * @get_geometry: virtual function to get the current window geometry
81 * @set_fullscreen: virtual function to change window fullscreen state
82 * @resize: virtual function to resize a window
83 * @render: virtual function to render a #GstVaapiSurface into a window
85 * Base class for system-dependent windows.
87 struct _GstVaapiWindowClass {
89 GstVaapiObjectClass parent_class;
92 GstVaapiWindowCreateFunc create;
93 GstVaapiWindowShowFunc show;
94 GstVaapiWindowHideFunc hide;
95 GstVaapiWindowGetGeometryFunc get_geometry;
96 GstVaapiWindowSetFullscreenFunc set_fullscreen;
97 GstVaapiWindowResizeFunc resize;
98 GstVaapiWindowRenderFunc render;
99 GstVaapiWindowRenderPixmapFunc render_pixmap;
103 gst_vaapi_window_new(const GstVaapiWindowClass *window_class,
104 GstVaapiDisplay *display, guint width, guint height);
107 gst_vaapi_window_new_from_native(const GstVaapiWindowClass *window_class,
108 GstVaapiDisplay *display, gpointer native_window);
110 /* Inline reference counting for core libgstvaapi library */
111 #ifdef IN_LIBGSTVAAPI_CORE
112 #define gst_vaapi_window_ref_internal(window) \
113 ((gpointer)gst_vaapi_mini_object_ref(GST_VAAPI_MINI_OBJECT(window)))
115 #define gst_vaapi_window_unref_internal(window) \
116 gst_vaapi_mini_object_unref(GST_VAAPI_MINI_OBJECT(window))
118 #define gst_vaapi_window_replace_internal(old_window_ptr, new_window) \
119 gst_vaapi_mini_object_replace((GstVaapiMiniObject **)(old_window_ptr), \
120 GST_VAAPI_MINI_OBJECT(new_window))
122 #undef gst_vaapi_window_ref
123 #define gst_vaapi_window_ref(window) \
124 gst_vaapi_window_ref_internal((window))
126 #undef gst_vaapi_window_unref
127 #define gst_vaapi_window_unref(window) \
128 gst_vaapi_window_unref_internal((window))
130 #undef gst_vaapi_window_replace
131 #define gst_vaapi_window_replace(old_window_ptr, new_window) \
132 gst_vaapi_window_replace_internal((old_window_ptr), (new_window))
137 #endif /* GST_VAAPI_WINDOW_PRIV_H */