iface);
static void gst_wayland_sink_set_window_handle (GstVideoOverlay * overlay,
guintptr handle);
+static void
+gst_wayland_sink_set_wl_window_wl_surface_id (GstVideoOverlay * overlay,
+ guintptr wl_surface_id);
static void gst_wayland_sink_set_render_rectangle (GstVideoOverlay * overlay,
gint x, gint y, gint w, gint h);
static void gst_wayland_sink_expose (GstVideoOverlay * overlay);
iface->set_window_handle = gst_wayland_sink_set_window_handle;
iface->set_render_rectangle = gst_wayland_sink_set_render_rectangle;
iface->expose = gst_wayland_sink_expose;
+#ifdef GST_WLSINK_ENHANCEMENT /* use unique_id */
+ iface->set_wl_window_wl_surface_id =
+ gst_wayland_sink_set_wl_window_wl_surface_id;
+#endif
}
+#ifdef GST_WLSINK_ENHANCEMENT /* use unique_id */
static void
-gst_wayland_sink_set_window_handle (GstVideoOverlay * overlay, guintptr handle)
+gst_wayland_sink_set_wl_window_wl_surface_id (GstVideoOverlay * overlay,
+ guintptr wl_surface_id)
{
FUNCTION;
-#if GST_WLSINK_ENHANCEMENT /* use unique_id */
+
GstWaylandSink *sink = GST_WAYLAND_SINK (overlay);
g_return_if_fail (sink != NULL);
g_mutex_lock (&sink->render_lock);
g_clear_object (&sink->window);
- GST_INFO ("parent_id %d %p", (int) handle, handle);
+ GST_INFO ("wl_surface_id %d %p", (int) wl_surface_id, wl_surface_id);
- if (handle) {
+ if (wl_surface_id) {
if (G_LIKELY (gst_wayland_sink_find_display (sink))) {
/* we cannot use our own display with an external window handle */
if (G_UNLIKELY (sink->display->own_display)) {
- sink->display->parent_id = (int) handle;
- GST_INFO ("parent_id %d", sink->display->parent_id);
- //GST_DEBUG_OBJECT (sink, "Setting parent id %d", handle);
+ sink->display->wl_surface_id = (int) wl_surface_id;
sink->window = gst_wl_window_new_in_surface (sink->display, NULL);
}
} else {
g_mutex_unlock (&sink->render_lock);
+}
+#endif
+
+static void
+gst_wayland_sink_set_window_handle (GstVideoOverlay * overlay, guintptr handle)
+{
+ FUNCTION;
-#else
GstWaylandSink *sink = GST_WAYLAND_SINK (overlay);
struct wl_surface *surface = (struct wl_surface *) handle;
g_return_if_fail (sink != NULL);
+#ifdef GST_WLSINK_ENHANCEMENT /* use unique_id */
+ if (sink->window != NULL) {
+ GST_WARNING_OBJECT (sink, "changing window handle is not supported");
+ return;
+ }
+#endif
g_mutex_lock (&sink->render_lock);
GST_DEBUG_OBJECT (sink, "Setting window handle %" GST_PTR_FORMAT,
if (G_LIKELY (gst_wayland_sink_find_display (sink))) {
/* we cannot use our own display with an external window handle */
if (G_UNLIKELY (sink->display->own_display)) {
- GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_READ_WRITE,
- ("waylandsink cannot use an externally-supplied surface without "
- "an externally-supplied display handle. Consider providing a "
- "display handle from your application with GstContext"));
} else {
+ GST_ELEMENT_WARNING (sink, RESOURCE, OPEN_READ_WRITE,
+ ("Application did not provide a wayland display handle"),
+ ("Now waylandsink use internal display handle "
+ "which is created ourselves. Consider providing a "
+ "display handle from your application with GstContext"));
sink->window = gst_wl_window_new_in_surface (sink->display, surface);
}
} else {
}
g_mutex_unlock (&sink->render_lock);
-#endif /* use unique_id */
}
static void
}
static GstWlWindow *
+#ifdef GST_WLSINK_ENHANCEMENT
gst_wl_window_new_internal (GstWlDisplay * display, struct wl_surface *parent)
+#else
+gst_wl_window_new_internal (GstWlDisplay * display)
+#endif
{
FUNCTION;
GstWlWindow *window;
} else if (display->use_parent_wl_surface) {
#ifdef GST_WLSINK_ENHANCEMENT
GST_INFO ("call tizen_policy_get_subsurface");
- window->area_subsurface =
- tizen_policy_get_subsurface (display->tizen_policy,
- window->area_surface, display->parent_id);
- wl_subsurface_set_desync (window->area_subsurface);
- wl_surface_commit (window->area_surface);
+ if (display->wl_surface_id && parent == NULL) {
+ window->area_subsurface =
+ tizen_policy_get_subsurface (display->tizen_policy,
+ window->area_surface, display->wl_surface_id);
+ wl_subsurface_set_desync (window->area_subsurface);
+ wl_surface_commit (window->area_surface);
+ } else {
+ GST_INFO (" wl_surface %p", parent);
+ window->area_subsurface =
+ wl_subcompositor_get_subsurface (display->subcompositor,
+ window->area_surface, parent);
+ wl_subsurface_set_desync (window->area_subsurface);
+ }
#else
window->area_subsurface =
wl_subcompositor_get_subsurface (display->subcompositor,
gint width;
/* not create shell_surface here for enlightenment */
+#ifdef GST_WLSINK_ENHANCEMENT
display->need_shell_surface = TRUE;
window = gst_wl_window_new_internal (display, NULL);
window->shell_surface = wl_shell_get_shell_surface (display->shell,
window->area_surface);
#endif
+#endif
if (window->shell_surface) {
wl_shell_surface_add_listener (window->shell_surface,
&shell_surface_listener, window);
display->use_parent_wl_surface = TRUE;
#ifdef GST_WLSINK_ENHANCEMENT
- window = gst_wl_window_new_internal (display, NULL);
+ if (parent) { /*use wl_surface */
+ window = gst_wl_window_new_internal (display, parent);
+ } else { /* use wl_surface id */
+ window = gst_wl_window_new_internal (display, NULL);
+ }
#else
window = gst_wl_window_new_internal (display, parent);
#endif