window: re-indent all GstVaapiWindow related source code.
[platform/upstream/gstreamer-vaapi.git] / gst-libs / gst / vaapi / gstvaapiwindow_priv.h
1 /*
2  *  gstvaapiwindow_priv.h - VA window abstraction (private definitions)
3  *
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>
8  *
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.
13  *
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.
18  *
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
23  */
24
25 #ifndef GST_VAAPI_WINDOW_PRIV_H
26 #define GST_VAAPI_WINDOW_PRIV_H
27
28 #include "gstvaapiobject_priv.h"
29
30 G_BEGIN_DECLS
31
32 #define GST_VAAPI_WINDOW_CLASS(klass) \
33     ((GstVaapiWindowClass *)(klass))
34
35 #define GST_VAAPI_WINDOW_GET_CLASS(obj) \
36     GST_VAAPI_WINDOW_CLASS(GST_VAAPI_OBJECT_GET_CLASS(obj))
37
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,
46     gboolean fullscreen);
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);
55
56 /**
57  * GstVaapiWindow:
58  *
59  * Base class for system-dependent windows.
60  */
61 struct _GstVaapiWindow
62 {
63   /*< private >*/
64   GstVaapiObject parent_instance;
65
66   /*< protected >*/
67   guint width;
68   guint height;
69   guint display_width;
70   guint display_height;
71   guint use_foreign_window:1;
72   guint is_fullscreen:1;
73   guint check_geometry:1;
74 };
75
76 /**
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
85  *
86  * Base class for system-dependent windows.
87  */
88 struct _GstVaapiWindowClass
89 {
90   /*< private >*/
91   GstVaapiObjectClass parent_class;
92
93   /*< protected >*/
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;
102 };
103
104 GstVaapiWindow *
105 gst_vaapi_window_new (const GstVaapiWindowClass * window_class,
106     GstVaapiDisplay * display, guint width, guint height);
107
108 GstVaapiWindow *
109 gst_vaapi_window_new_from_native (const GstVaapiWindowClass *
110     window_class, GstVaapiDisplay * display, gpointer native_window);
111
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)))
116
117 #define gst_vaapi_window_unref_internal(window) \
118     gst_vaapi_mini_object_unref(GST_VAAPI_MINI_OBJECT(window))
119
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))
123
124 #undef  gst_vaapi_window_ref
125 #define gst_vaapi_window_ref(window) \
126     gst_vaapi_window_ref_internal((window))
127
128 #undef  gst_vaapi_window_unref
129 #define gst_vaapi_window_unref(window) \
130     gst_vaapi_window_unref_internal((window))
131
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))
135 #endif
136
137 G_END_DECLS
138
139 #endif /* GST_VAAPI_WINDOW_PRIV_H */