• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_WAYLAND_EGL_H__
22 #define __GST_GL_WINDOW_WAYLAND_EGL_H__
23 
24 #include <wayland-client.h>
25 #include "xdg-shell-client-protocol.h"
26 #include <wayland-egl.h>
27 #include <wayland-cursor.h>
28 
29 #include <gst/gl/gl.h>
30 
31 G_BEGIN_DECLS
32 
33 #define GST_TYPE_GL_WINDOW_WAYLAND_EGL         (gst_gl_window_wayland_egl_get_type())
34 #define GST_GL_WINDOW_WAYLAND_EGL(o)           (G_TYPE_CHECK_INSTANCE_CAST((o), GST_TYPE_GL_WINDOW_WAYLAND_EGL, GstGLWindowWaylandEGL))
35 #define GST_GL_WINDOW_WAYLAND_EGL_CLASS(k)     (G_TYPE_CHECK_CLASS((k), GST_TYPE_GL_WINDOW_WAYLAND_EGL, GstGLWindowWaylandEGLClass))
36 #define GST_IS_GL_WINDOW_WAYLAND_EGL(o)        (G_TYPE_CHECK_INSTANCE_TYPE((o), GST_TYPE_GL_WINDOW_WAYLAND_EGL))
37 #define GST_IS_GL_WINDOW_WAYLAND_EGL_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE((k), GST_TYPE_GL_WINDOW_WAYLAND_EGL))
38 #define GST_GL_WINDOW_WAYLAND_EGL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GST_TYPE_GL_WINDOW_WAYLAND_EGL, GstGLWindowWaylandEGL_Class))
39 
40 typedef struct _GstGLWindowWaylandEGL        GstGLWindowWaylandEGL;
41 typedef struct _GstGLWindowWaylandEGLClass   GstGLWindowWaylandEGLClass;
42 
43 struct window;
44 
45 struct display {
46   struct wl_display      *display;
47   struct wl_registry     *registry;
48   struct wl_compositor   *compositor;
49   struct wl_subcompositor *subcompositor;
50   struct wl_shell        *shell;
51   struct wl_seat         *seat;
52   struct wl_pointer      *pointer;
53   struct wl_keyboard     *keyboard;
54   struct wl_shm          *shm;
55   struct wl_cursor_theme *cursor_theme;
56   struct wl_cursor       *default_cursor;
57   struct wl_surface      *cursor_surface;
58   struct xdg_wm_base     *xdg_wm_base;
59   struct window          *window;
60   guint32                 serial;
61 
62   gdouble pointer_x;
63   gdouble pointer_y;
64 };
65 
66 struct window {
67   struct display *display;
68 
69   struct wl_event_queue     *queue;
70 
71   /* wl_shell */
72   struct wl_surface         *surface;
73   struct wl_shell_surface   *wl_shell_surface;
74   /* XDG-shell */
75   struct xdg_surface        *xdg_surface;
76   struct xdg_toplevel       *xdg_toplevel;
77 
78   struct wl_egl_window      *native;
79   struct wl_surface         *foreign_surface;
80   struct wl_subsurface      *subsurface;
81   struct wl_callback        *callback;
82   int fullscreen, configured;
83   int window_width, window_height;
84   int preferred_width, preferred_height;
85   int window_x, window_y;
86   GstVideoRectangle render_rect;
87 };
88 
89 struct _GstGLWindowWaylandEGL {
90   /*< private >*/
91   GstGLWindow parent;
92 
93   struct display display;
94   struct window  window;
95 
96   GSource *wl_source;
97 
98   gpointer _reserved[GST_PADDING];
99 };
100 
101 struct _GstGLWindowWaylandEGLClass {
102   /*< private >*/
103   GstGLWindowClass parent_class;
104 
105   /*< private >*/
106   gpointer _reserved[GST_PADDING];
107 };
108 
109 G_GNUC_INTERNAL
110 GType                   gst_gl_window_wayland_egl_get_type (void);
111 
112 G_GNUC_INTERNAL
113 GstGLWindowWaylandEGL * gst_gl_window_wayland_egl_new  (GstGLDisplay * display);
114 
115 G_GNUC_INTERNAL
116 void gst_gl_window_wayland_egl_create_window (GstGLWindowWaylandEGL * window_egl);
117 
118 G_END_DECLS
119 
120 #endif /* __GST_GL_WINDOW_WAYLAND_EGL_H__ */
121