1 /*
2  * GStreamer
3  * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.com>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  */
20 
21 #ifndef __GST_GL_WINDOW_X11_H__
22 #define __GST_GL_WINDOW_X11_H__
23 
24 #include <X11/Xlib.h>
25 #include <X11/Xutil.h>
26 
27 #include <gst/video/video.h>
28 
29 #include <gst/gl/gstgl_fwd.h>
30 #include <gst/gl/gstglwindow.h>
31 
32 G_BEGIN_DECLS
33 
34 #define GST_TYPE_GL_WINDOW_X11         (gst_gl_window_x11_get_type())
35 G_GNUC_INTERNAL GType gst_gl_window_x11_get_type (void);
36 
37 #define GST_GL_WINDOW_X11(o)           (G_TYPE_CHECK_INSTANCE_CAST((o), GST_TYPE_GL_WINDOW_X11, GstGLWindowX11))
38 #define GST_GL_WINDOW_X11_CLASS(k)     (G_TYPE_CHECK_CLASS((k), GST_TYPE_GL_WINDOW_X11, GstGLWindowX11Class))
39 #define GST_IS_GL_WINDOW_X11(o)        (G_TYPE_CHECK_INSTANCE_TYPE((o), GST_TYPE_GL_WINDOW_X11))
40 #define GST_IS_GL_WINDOW_X11_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE((k), GST_TYPE_GL_WINDOW_X11))
41 #define GST_GL_WINDOW_X11_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GST_TYPE_GL_WINDOW_X11, GstGLWindowX11Class))
42 
43 typedef struct _GstGLWindowX11        GstGLWindowX11;
44 typedef struct _GstGLWindowX11Private GstGLWindowX11Private;
45 typedef struct _GstGLWindowX11Class   GstGLWindowX11Class;
46 
47 /**
48  * GstGLWindowX11:
49  *
50  * Opaque #GstGLWindowX11 object
51  */
52 struct _GstGLWindowX11
53 {
54   /*< private >*/
55   GstGLWindow parent;
56 
57   gboolean      running;
58   gboolean      visible;
59   gboolean      allow_extra_expose_events;
60 
61   /* opengl context */
62   Display      *device;
63   Screen       *screen;
64   gint          screen_num;
65   Visual       *visual;
66   Window        root;
67   gulong        white;
68   gulong        black;
69   gint          depth;
70   gint          device_width;
71   gint          device_height;
72   gint          connection;
73   XVisualInfo  *visual_info;
74   Window        parent_win;
75 
76   /* X window */
77   Window        internal_win_id;
78 
79   GSource *x11_source;
80 
81   /*< private >*/
82   GstGLWindowX11Private *priv;
83 
84   gpointer _reserved[GST_PADDING];
85 };
86 
87 /**
88  * GstGLWindowX11Class:
89  *
90  * Opaque #GstGLWindowX11Class object
91  */
92 struct _GstGLWindowX11Class {
93   /*< private >*/
94   GstGLWindowClass parent_class;
95 
96   /*< private >*/
97   gpointer _reserved[GST_PADDING_LARGE];
98 };
99 
100 G_GNUC_INTERNAL
101 GstGLWindowX11 * gst_gl_window_x11_new (GstGLDisplay * display);
102 
103 G_GNUC_INTERNAL
104 void gst_gl_window_x11_trap_x_errors (void);
105 
106 G_GNUC_INTERNAL
107 gint gst_gl_window_x11_untrap_x_errors (void);
108 
109 G_GNUC_INTERNAL
110 gboolean gst_gl_window_x11_create_window (GstGLWindowX11 * window_x11);
111 
112 G_END_DECLS
113 
114 #endif /* __GST_GL_WINDOW_X11_H__ */
115