Relicense gst-libs/ code to LGPL v2.1+.
[profile/ivi/gstreamer-vaapi.git] / gst-libs / gst / vaapi / gstvaapiwindow_glx.h
1 /*
2  *  gstvaapiwindow_glx.h - VA/GLX window abstraction
3  *
4  *  gstreamer-vaapi (C) 2010 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_GLX_H
23 #define GST_VAAPI_WINDOW_GLX_H
24
25 #include <GL/glx.h>
26 #include <gst/vaapi/gstvaapidisplay.h>
27 #include <gst/vaapi/gstvaapiwindow_x11.h>
28 #include <gst/vaapi/gstvaapitexture.h>
29
30 G_BEGIN_DECLS
31
32 #define GST_VAAPI_TYPE_WINDOW_GLX \
33     (gst_vaapi_window_glx_get_type())
34
35 #define GST_VAAPI_WINDOW_GLX(obj)                               \
36     (G_TYPE_CHECK_INSTANCE_CAST((obj),                          \
37                                 GST_VAAPI_TYPE_WINDOW_GLX,      \
38                                 GstVaapiWindowGLX))
39
40 #define GST_VAAPI_WINDOW_GLX_CLASS(klass)                       \
41     (G_TYPE_CHECK_CLASS_CAST((klass),                           \
42                              GST_VAAPI_TYPE_WINDOW_GLX,         \
43                              GstVaapiWindowGLXClass))
44
45 #define GST_VAAPI_IS_WINDOW_GLX(obj) \
46     (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_VAAPI_TYPE_WINDOW_GLX))
47
48 #define GST_VAAPI_IS_WINDOW_GLX_CLASS(klass) \
49     (G_TYPE_CHECK_CLASS_TYPE((klass), GST_VAAPI_TYPE_WINDOW_GLX))
50
51 #define GST_VAAPI_WINDOW_GLX_GET_CLASS(obj)                     \
52     (G_TYPE_INSTANCE_GET_CLASS((obj),                           \
53                                GST_VAAPI_TYPE_WINDOW_GLX,       \
54                                GstVaapiWindowGLXClass))
55
56 typedef struct _GstVaapiWindowGLX               GstVaapiWindowGLX;
57 typedef struct _GstVaapiWindowGLXPrivate        GstVaapiWindowGLXPrivate;
58 typedef struct _GstVaapiWindowGLXClass          GstVaapiWindowGLXClass;
59
60 /**
61  * GstVaapiWindowGLX:
62  *
63  * An X11 #Window suitable for GLX rendering.
64  */
65 struct _GstVaapiWindowGLX {
66     /*< private >*/
67     GstVaapiWindowX11 parent_instance;
68
69     GstVaapiWindowGLXPrivate *priv;
70 };
71
72 /**
73  * GstVaapiWindowGLXClass:
74  *
75  * An X11 #Window suitable for GLX rendering.
76  */
77 struct _GstVaapiWindowGLXClass {
78     /*< private >*/
79     GstVaapiWindowX11Class parent_class;
80 };
81
82 GType
83 gst_vaapi_window_glx_get_type(void);
84
85 GstVaapiWindow *
86 gst_vaapi_window_glx_new(GstVaapiDisplay *display, guint width, guint height);
87
88 GstVaapiWindow *
89 gst_vaapi_window_glx_new_with_xid(GstVaapiDisplay *display, Window xid);
90
91 GLXContext
92 gst_vaapi_window_glx_get_context(GstVaapiWindowGLX *window);
93
94 gboolean
95 gst_vaapi_window_glx_set_context(GstVaapiWindowGLX *window, GLXContext ctx);
96
97 gboolean
98 gst_vaapi_window_glx_make_current(GstVaapiWindowGLX *window);
99
100 void
101 gst_vaapi_window_glx_swap_buffers(GstVaapiWindowGLX *window);
102
103 gboolean
104 gst_vaapi_window_glx_put_texture(
105     GstVaapiWindowGLX       *window,
106     GstVaapiTexture         *texture,
107     const GstVaapiRectangle *src_rect,
108     const GstVaapiRectangle *dst_rect
109 );
110
111 G_END_DECLS
112
113 #endif /* GST_VAAPI_WINDOW_GLX_H */