gstreamer1.0-plugins-bad: update patch
[AGL/meta-agl.git] / meta-agl-core / recipes-multimedia / gstreamer1.0-plugins-bad / files / 0001-Added-appid-and-title-support.patch
1 From b8bbab864a1367ac47bcc0998b4c07d20020965a Mon Sep 17 00:00:00 2001
2 From: Marius Vlad <marius.vlad@collabora.com>
3 Date: Thu, 5 Oct 2023 18:23:52 +0300
4 Subject: [PATCH] ext/wayland: Add title/appid support
5
6 Upstream-Status: Pending
7
8 Bug-AGL: SPEC-4870
9 Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
10 ---
11  ext/wayland/gstwaylandsink.c       | 41 +++++++++++++++++++++++++++++-
12  ext/wayland/gstwaylandsink.h       |  2 ++
13  gst-libs/gst/wayland/gstwlwindow.c | 12 ++++++++-
14  gst-libs/gst/wayland/gstwlwindow.h |  3 ++-
15  4 files changed, 55 insertions(+), 3 deletions(-)
16
17 diff --git a/ext/wayland/gstwaylandsink.c b/ext/wayland/gstwaylandsink.c
18 index 2f116bf..69f4a00 100644
19 --- a/ext/wayland/gstwaylandsink.c
20 +++ b/ext/wayland/gstwaylandsink.c
21 @@ -61,6 +61,8 @@ enum
22    PROP_DISPLAY,
23    PROP_FULLSCREEN,
24    PROP_ROTATE_METHOD,
25 +  PROP_APP_ID,
26 +  PROP_TITLE,
27    PROP_LAST
28  };
29  
30 @@ -177,6 +179,16 @@ gst_wayland_sink_class_init (GstWaylandSinkClass * klass)
31            GST_TYPE_VIDEO_ORIENTATION_METHOD, GST_VIDEO_ORIENTATION_IDENTITY,
32            G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
33  
34 +  g_object_class_install_property (gobject_class, PROP_APP_ID,
35 +      g_param_spec_string ("appid", "Top-level application id", "Wayland "
36 +          "appid, as xdg_shell::set_app_id",
37 +          NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
38 +
39 +  g_object_class_install_property (gobject_class, PROP_TITLE,
40 +      g_param_spec_string ("title", "Top-level title", "Wayland "
41 +          "title, xdg_shell::set_title",
42 +          NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
43 +
44   /**
45    * waylandsink:render-rectangle:
46    *
47 @@ -266,6 +278,16 @@ gst_wayland_sink_get_property (GObject * object,
48        g_value_set_enum (value, self->current_rotate_method);
49        GST_OBJECT_UNLOCK (self);
50        break;
51 +    case PROP_APP_ID:
52 +      GST_OBJECT_LOCK (self);
53 +      g_value_set_string (value, self->app_id);
54 +      GST_OBJECT_UNLOCK (self);
55 +      break;
56 +    case PROP_TITLE:
57 +      GST_OBJECT_LOCK (self);
58 +      g_value_set_string (value, self->title);
59 +      GST_OBJECT_UNLOCK (self);
60 +      break;
61      default:
62        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
63        break;
64 @@ -289,6 +311,16 @@ gst_wayland_sink_set_property (GObject * object,
65        gst_wayland_sink_set_fullscreen (self, g_value_get_boolean (value));
66        GST_OBJECT_UNLOCK (self);
67        break;
68 +    case PROP_APP_ID:
69 +      GST_OBJECT_LOCK (self);
70 +      self->app_id = g_value_dup_string (value);
71 +      GST_OBJECT_UNLOCK (self);
72 +      break;
73 +    case PROP_TITLE:
74 +      GST_OBJECT_LOCK (self);
75 +      self->title = g_value_dup_string (value);
76 +      GST_OBJECT_UNLOCK (self);
77 +      break;
78      case PROP_ROTATE_METHOD:
79        gst_wayland_sink_set_rotate_method (self, g_value_get_enum (value),
80            FALSE);
81 @@ -310,12 +342,18 @@ gst_wayland_sink_finalize (GObject * object)
82      gst_buffer_unref (self->last_buffer);
83    if (self->display)
84      g_object_unref (self->display);
85 +  if (self->title)
86 +    g_object_unref (self->title);
87 +  if (self->app_id)
88 +    g_object_unref (self->app_id);
89    if (self->window)
90      g_object_unref (self->window);
91    if (self->pool)
92      gst_object_unref (self->pool);
93  
94    g_free (self->display_name);
95 +  g_free (self->title);
96 +  g_free (self->app_id);
97  
98    g_mutex_clear (&self->display_lock);
99    g_mutex_clear (&self->render_lock);
100 @@ -761,7 +799,8 @@ gst_wayland_sink_show_frame (GstVideoSink * vsink, GstBuffer * buffer)
101      if (!self->window) {
102        /* if we were not provided a window, create one ourselves */
103        self->window = gst_wl_window_new_toplevel (self->display,
104 -          &self->video_info, self->fullscreen, &self->render_lock);
105 +          &self->video_info, self->fullscreen, &self->app_id, &self->title,
106 +          &self->render_lock);
107        g_signal_connect_object (self->window, "closed",
108            G_CALLBACK (on_window_closed), self, 0);
109        gst_wl_window_set_rotate_method (self->window,
110 diff --git a/ext/wayland/gstwaylandsink.h b/ext/wayland/gstwaylandsink.h
111 index 3243d8c..6aee19d 100644
112 --- a/ext/wayland/gstwaylandsink.h
113 +++ b/ext/wayland/gstwaylandsink.h
114 @@ -58,6 +58,8 @@ struct _GstWaylandSink
115    gboolean fullscreen;
116  
117    gchar *display_name;
118 +  gchar *app_id;
119 +  gchar *title;
120  
121    gboolean redraw_pending;
122    GMutex render_lock;
123 diff --git a/gst-libs/gst/wayland/gstwlwindow.c b/gst-libs/gst/wayland/gstwlwindow.c
124 index 6004993..de0a81e 100644
125 --- a/gst-libs/gst/wayland/gstwlwindow.c
126 +++ b/gst-libs/gst/wayland/gstwlwindow.c
127 @@ -270,7 +270,7 @@ gst_wl_window_ensure_fullscreen (GstWlWindow * self, gboolean fullscreen)
128  
129  GstWlWindow *
130  gst_wl_window_new_toplevel (GstWlDisplay * display, const GstVideoInfo * info,
131 -    gboolean fullscreen, GMutex * render_lock)
132 +    gboolean fullscreen, gchar *app_id, gchar *title, GMutex * render_lock)
133  {
134    GstWlWindow *self;
135    GstWlWindowPrivate *priv;
136 @@ -307,6 +307,16 @@ gst_wl_window_new_toplevel (GstWlDisplay * display, const GstVideoInfo * info,
137  
138      gst_wl_window_ensure_fullscreen (self, fullscreen);
139  
140 +    if (app_id)
141 +           xdg_toplevel_set_app_id (priv->xdg_toplevel, app_id);
142 +    else
143 +           xdg_toplevel_set_app_id (priv->xdg_toplevel, "ext.wayland.waylandsink");
144 +    if (title)
145 +           xdg_toplevel_set_title (priv->xdg_toplevel, title);
146 +    else
147 +           xdg_toplevel_set_title (priv->xdg_toplevel, "ext.wayland.waylandsink");
148 +
149 +
150      /* Finally, commit the xdg_surface state as toplevel */
151      priv->configured = FALSE;
152      wl_surface_commit (priv->area_surface);
153 diff --git a/gst-libs/gst/wayland/gstwlwindow.h b/gst-libs/gst/wayland/gstwlwindow.h
154 index 06c4001..e102052 100644
155 --- a/gst-libs/gst/wayland/gstwlwindow.h
156 +++ b/gst-libs/gst/wayland/gstwlwindow.h
157 @@ -39,7 +39,8 @@ void gst_wl_window_ensure_fullscreen (GstWlWindow * self,
158  
159  GST_WL_API
160  GstWlWindow *gst_wl_window_new_toplevel (GstWlDisplay * display,
161 -        const GstVideoInfo * info, gboolean fullscreen, GMutex * render_lock);
162 +        const GstVideoInfo * info, gboolean fullscreen, gchar * app_id,
163 +        gchar *title, GMutex * render_lock);
164  
165  GST_WL_API
166  GstWlWindow *gst_wl_window_new_in_surface (GstWlDisplay * display,
167 -- 
168 2.35.1
169