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
64 GstVaapiObject parent_instance;
71 guint use_foreign_window:1;
72 guint is_fullscreen:1;
73 guint check_geometry:1;
77 * GstVaapiWindowClass:
78 * @create: virtual function to create a window with width and height
79 * @show: virtual function to show (map) a window
80 * @hide: virtual function to hide (unmap) a window
81 * @get_geometry: virtual function to get the current window geometry
82 * @set_fullscreen: virtual function to change window fullscreen state
83 * @resize: virtual function to resize a window
84 * @render: virtual function to render a #GstVaapiSurface into a window
86 * Base class for system-dependent windows.
88 struct _GstVaapiWindowClass
91 GstVaapiObjectClass parent_class;
94 GstVaapiWindowCreateFunc create;
95 GstVaapiWindowShowFunc show;
96 GstVaapiWindowHideFunc hide;
97 GstVaapiWindowGetGeometryFunc get_geometry;
98 GstVaapiWindowSetFullscreenFunc set_fullscreen;
99 GstVaapiWindowResizeFunc resize;
100 GstVaapiWindowRenderFunc render;
101 GstVaapiWindowRenderPixmapFunc render_pixmap;
105 gst_vaapi_window_new (const GstVaapiWindowClass * window_class,
106 GstVaapiDisplay * display, guint width, guint height);
109 gst_vaapi_window_new_from_native (const GstVaapiWindowClass *
110 window_class, GstVaapiDisplay * display, gpointer native_window);
112 /* Inline reference counting for core libgstvaapi library */
113 #ifdef IN_LIBGSTVAAPI_CORE
114 #define gst_vaapi_window_ref_internal(window) \
115 ((gpointer)gst_vaapi_mini_object_ref(GST_VAAPI_MINI_OBJECT(window)))
117 #define gst_vaapi_window_unref_internal(window) \
118 gst_vaapi_mini_object_unref(GST_VAAPI_MINI_OBJECT(window))
120 #define gst_vaapi_window_replace_internal(old_window_ptr, new_window) \
121 gst_vaapi_mini_object_replace((GstVaapiMiniObject **)(old_window_ptr), \
122 GST_VAAPI_MINI_OBJECT(new_window))
124 #undef gst_vaapi_window_ref
125 #define gst_vaapi_window_ref(window) \
126 gst_vaapi_window_ref_internal((window))
128 #undef gst_vaapi_window_unref
129 #define gst_vaapi_window_unref(window) \
130 gst_vaapi_window_unref_internal((window))
132 #undef gst_vaapi_window_replace
133 #define gst_vaapi_window_replace(old_window_ptr, new_window) \
134 gst_vaapi_window_replace_internal((old_window_ptr), (new_window))
139 #endif /* GST_VAAPI_WINDOW_PRIV_H */