waylandsink: move surface resizing logic to the GstWlWindow and make it be called...
[platform/upstream/gstreamer.git] / ext / wayland / wlwindow.h
1 /* GStreamer Wayland video sink
2  *
3  * Copyright (C) 2014 Collabora Ltd.
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 Free
17  * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  * Boston, MA 02110-1301 USA.
19  */
20
21 #ifndef __GST_WL_WINDOW_H__
22 #define __GST_WL_WINDOW_H__
23
24 #include "wldisplay.h"
25 #include <gst/video/gstvideosink.h>
26
27 G_BEGIN_DECLS
28
29 #define GST_TYPE_WL_WINDOW                  (gst_wl_window_get_type ())
30 #define GST_WL_WINDOW(obj)                  (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_WL_WINDOW, GstWlWindow))
31 #define GST_IS_WL_WINDOW(obj)               (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_WL_WINDOW))
32 #define GST_WL_WINDOW_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_WL_WINDOW, GstWlWindowClass))
33 #define GST_IS_WL_WINDOW_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_WL_WINDOW))
34 #define GST_WL_WINDOW_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_WL_WINDOW, GstWlWindowClass))
35
36 typedef struct _GstWlWindow GstWlWindow;
37 typedef struct _GstWlWindowClass GstWlWindowClass;
38
39 struct _GstWlWindow
40 {
41   GObject parent_instance;
42
43   GstWlDisplay *display;
44   struct wl_surface *surface;
45   struct wl_subsurface *subsurface;
46   struct wl_viewport *viewport;
47   struct wl_shell_surface *shell_surface;
48
49   /* the size of the destination area where we are overlaying our subsurface */
50   GstVideoRectangle render_rectangle;
51   /* the size of the video in the buffers */
52   gint video_width, video_height;
53   /* the size of the (sub)surface */
54   gint surface_width, surface_height;
55 };
56
57 struct _GstWlWindowClass
58 {
59   GObjectClass parent_class;
60 };
61
62 GType gst_wl_window_get_type (void);
63
64 GstWlWindow *gst_wl_window_new_toplevel (GstWlDisplay * display,
65         gint video_width, gint video_height);
66 GstWlWindow *gst_wl_window_new_in_surface (GstWlDisplay * display,
67         struct wl_surface * parent);
68
69 GstWlDisplay *gst_wl_window_get_display (GstWlWindow * window);
70 struct wl_surface *gst_wl_window_get_wl_surface (GstWlWindow * window);
71 gboolean gst_wl_window_is_toplevel (GstWlWindow *window);
72
73 /* functions to manipulate the size on non-toplevel windows */
74 void gst_wl_window_set_video_size (GstWlWindow * window, gint w, gint h);
75 void gst_wl_window_set_render_rectangle (GstWlWindow * window, gint x, gint y,
76         gint w, gint h);
77
78 G_END_DECLS
79
80 #endif /* __GST_WL_WINDOW_H__ */