Tizen 2.1 base
[framework/multimedia/gstreamer-vaapi.git] / gst-libs / gst / vaapi / gstvaapiwindow_x11.h
1 /*
2  *  gstvaapiwindow_x11.h - VA/X11 window abstraction
3  *
4  *  Copyright (C) 2010-2011 Splitted-Desktop Systems
5  *
6  *  This library is free software; you can redistribute it and/or
7  *  modify it under the terms of the GNU Lesser General Public License
8  *  as published by the Free Software Foundation; either version 2.1
9  *  of the License, or (at your option) any later version.
10  *
11  *  This library is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  *  Lesser General Public License for more details.
15  *
16  *  You should have received a copy of the GNU Lesser General Public
17  *  License along with this library; if not, write to the Free
18  *  Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  *  Boston, MA 02110-1301 USA
20  */
21
22 #ifndef GST_VAAPI_WINDOW_X11_H
23 #define GST_VAAPI_WINDOW_X11_H
24
25 #include <X11/Xlib.h>
26 #include <gst/vaapi/gstvaapidisplay.h>
27 #include <gst/vaapi/gstvaapiwindow.h>
28
29 G_BEGIN_DECLS
30
31 #define GST_VAAPI_TYPE_WINDOW_X11 \
32     (gst_vaapi_window_x11_get_type())
33
34 #define GST_VAAPI_WINDOW_X11(obj)                               \
35     (G_TYPE_CHECK_INSTANCE_CAST((obj),                          \
36                                 GST_VAAPI_TYPE_WINDOW_X11,      \
37                                 GstVaapiWindowX11))
38
39 #define GST_VAAPI_WINDOW_X11_CLASS(klass)                       \
40     (G_TYPE_CHECK_CLASS_CAST((klass),                           \
41                              GST_VAAPI_TYPE_WINDOW_X11,         \
42                              GstVaapiWindowX11Class))
43
44 #define GST_VAAPI_IS_WINDOW_X11(obj) \
45     (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_VAAPI_TYPE_WINDOW_X11))
46
47 #define GST_VAAPI_IS_WINDOW_X11_CLASS(klass) \
48     (G_TYPE_CHECK_CLASS_TYPE((klass), GST_VAAPI_TYPE_WINDOW_X11))
49
50 #define GST_VAAPI_WINDOW_X11_GET_CLASS(obj)                     \
51     (G_TYPE_INSTANCE_GET_CLASS((obj),                           \
52                                GST_VAAPI_TYPE_WINDOW_X11,       \
53                                GstVaapiWindowX11Class))
54
55 /**
56  * GST_VAAPI_WINDOW_XWINDOW:
57  * @window: a #GstVaapiWindow
58  *
59  * Macro that evaluates to the underlying X11 #Window of @window
60  */
61 #define GST_VAAPI_WINDOW_XWINDOW(window) \
62     gst_vaapi_window_x11_get_xid(GST_VAAPI_WINDOW_X11(window))
63
64 typedef struct _GstVaapiWindowX11               GstVaapiWindowX11;
65 typedef struct _GstVaapiWindowX11Private        GstVaapiWindowX11Private;
66 typedef struct _GstVaapiWindowX11Class          GstVaapiWindowX11Class;
67
68 /**
69  * GstVaapiWindowX11:
70  *
71  * An X11 #Window wrapper.
72  */
73 struct _GstVaapiWindowX11 {
74     /*< private >*/
75     GstVaapiWindow parent_instance;
76
77     GstVaapiWindowX11Private *priv;
78 };
79
80 /**
81  * GstVaapiWindowX11Class:
82  * @get_visual: virtual function to get the desired visual used to
83  *   create the window
84  * @get_colormap: virtual function to get the desired colormap used to
85  *   create the window
86  *
87  * An X11 #Window wrapper class.
88  */
89 struct _GstVaapiWindowX11Class {
90     /*< private >*/
91     GstVaapiWindowClass parent_class;
92
93     Visual *  (*get_visual)     (GstVaapiWindow *window);
94     Colormap  (*get_colormap)   (GstVaapiWindow *window);
95 };
96
97 GType
98 gst_vaapi_window_x11_get_type(void) G_GNUC_CONST;
99
100 GstVaapiWindow *
101 gst_vaapi_window_x11_new(GstVaapiDisplay *display, guint width, guint height);
102
103 GstVaapiWindow *
104 gst_vaapi_window_x11_new_with_xid(GstVaapiDisplay *display, Window xid, gboolean is_pixmap);
105
106 Window
107 gst_vaapi_window_x11_get_xid(GstVaapiWindowX11 *window);
108
109 gboolean
110 gst_vaapi_window_x11_is_foreign_xid(GstVaapiWindowX11 *window);
111
112 G_END_DECLS
113
114 #endif /* GST_VAAPI_WINDOW_X11_H */