1 /* GStreamer Wayland video sink
3 * Copyright (C) 2014 Collabora Ltd.
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.
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.
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the Free
17 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301 USA.
21 #ifndef __GST_WL_WINDOW_H__
22 #define __GST_WL_WINDOW_H__
24 #include "wldisplay.h"
26 #include <gst/video/video.h>
30 #define GST_TYPE_WL_WINDOW (gst_wl_window_get_type ())
31 #define GST_WL_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_WL_WINDOW, GstWlWindow))
32 #define GST_IS_WL_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_WL_WINDOW))
33 #define GST_WL_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_WL_WINDOW, GstWlWindowClass))
34 #define GST_IS_WL_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_WL_WINDOW))
35 #define GST_WL_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_WL_WINDOW, GstWlWindowClass))
37 typedef struct _GstWlWindow GstWlWindow;
38 typedef struct _GstWlWindowClass GstWlWindowClass;
42 GObject parent_instance;
46 GstWlDisplay *display;
47 struct wl_surface *area_surface;
48 struct wl_surface *area_surface_wrapper;
49 struct wl_subsurface *area_subsurface;
50 struct wp_viewport *area_viewport;
51 struct wl_surface *video_surface;
52 struct wl_surface *video_surface_wrapper;
53 struct wl_subsurface *video_subsurface;
54 struct wp_viewport *video_viewport;
55 struct wl_shell_surface *wl_shell_surface;
56 struct xdg_surface *xdg_surface;
57 struct xdg_toplevel *xdg_toplevel;
60 GMutex configure_mutex;
62 /* the size and position of the area_(sub)surface */
63 GstVideoRectangle render_rectangle;
65 /* the size and position of the video_subsurface */
66 GstVideoRectangle video_rectangle;
68 /* the size of the video in the buffers */
69 gint video_width, video_height;
71 /* this will be set when viewporter is available and black background has
72 * already been set on the area_subsurface */
73 gboolean no_border_update;
77 struct _GstWlWindowClass
79 GObjectClass parent_class;
82 GType gst_wl_window_get_type (void);
84 void gst_wl_window_ensure_fullscreen (GstWlWindow * window,
86 GstWlWindow *gst_wl_window_new_toplevel (GstWlDisplay * display,
87 const GstVideoInfo * info, gboolean fullscreen, GMutex * render_lock);
88 GstWlWindow *gst_wl_window_new_in_surface (GstWlDisplay * display,
89 struct wl_surface * parent, GMutex * render_lock);
91 GstWlDisplay *gst_wl_window_get_display (GstWlWindow * window);
92 struct wl_surface *gst_wl_window_get_wl_surface (GstWlWindow * window);
93 gboolean gst_wl_window_is_toplevel (GstWlWindow *window);
95 void gst_wl_window_render (GstWlWindow * window, GstWlBuffer * buffer,
96 const GstVideoInfo * info);
97 void gst_wl_window_set_render_rectangle (GstWlWindow * window, gint x, gint y,
102 #endif /* __GST_WL_WINDOW_H__ */