static void gst_vaapi_window_wayland_destroy (GstVaapiWindow * window) { GstVaapiWindowWaylandPrivate *const priv = GST_VAAPI_WINDOW_WAYLAND_GET_PRIVATE (window); /* Wait for the last frame to complete redraw */ gst_vaapi_window_wayland_sync (window); if (priv->last_frame) { frame_state_free (priv->last_frame); priv->last_frame = NULL; } if (priv->shell_surface) { wl_shell_surface_destroy (priv->shell_surface); priv->shell_surface = NULL; } if (priv->surface) { wl_surface_destroy (priv->surface); priv->surface = NULL; } if (priv->event_queue) { wl_event_queue_destroy (priv->event_queue); priv->event_queue = NULL; } gst_vaapi_filter_replace (&priv->filter, NULL); gst_vaapi_video_pool_replace (&priv->surface_pool, NULL); gst_poll_free (priv->poll); }
static void gst_wl_display_finalize (GObject * gobject) { GstWlDisplay *self = GST_WL_DISPLAY (gobject); gst_poll_set_flushing (self->wl_fd_poll, TRUE); if (self->thread) g_thread_join (self->thread); /* to avoid buffers being unregistered from another thread * at the same time, take their ownership */ g_mutex_lock (&self->buffers_mutex); self->shutting_down = TRUE; g_hash_table_foreach (self->buffers, (GHFunc) g_object_ref, NULL); g_mutex_unlock (&self->buffers_mutex); g_hash_table_foreach (self->buffers, (GHFunc) gst_wl_buffer_force_release_and_unref, NULL); g_hash_table_remove_all (self->buffers); g_array_unref (self->shm_formats); g_array_unref (self->dmabuf_formats); gst_poll_free (self->wl_fd_poll); g_hash_table_unref (self->buffers); g_mutex_clear (&self->buffers_mutex); if (self->viewporter) wp_viewporter_destroy (self->viewporter); if (self->shm) wl_shm_destroy (self->shm); if (self->dmabuf) zwp_linux_dmabuf_v1_destroy (self->dmabuf); if (self->shell) wl_shell_destroy (self->shell); if (self->compositor) wl_compositor_destroy (self->compositor); if (self->subcompositor) wl_subcompositor_destroy (self->subcompositor); if (self->registry) wl_registry_destroy (self->registry); if (self->queue) wl_event_queue_destroy (self->queue); if (self->own_display) { wl_display_flush (self->display); wl_display_disconnect (self->display); } G_OBJECT_CLASS (gst_wl_display_parent_class)->finalize (gobject); }
WaylandNativeWindow::~WaylandNativeWindow() { std::list<WaylandNativeWindowBuffer *>::iterator it = m_bufList.begin(); destroyBuffers(); if (frame_callback) wl_callback_destroy(frame_callback); wl_event_queue_destroy(wl_queue); if (m_window) { m_window->nativewindow = NULL; m_window->resize_callback = NULL; m_window->free_callback = NULL; } }
extern "C" void waylandws_Terminate(_EGLDisplay *dpy) { WaylandDisplay *wdpy = (WaylandDisplay *)dpy; int ret = 0; // We still have the sync callback on flight, wait for it to arrive while (ret == 0 && !wdpy->wlegl) { ret = wl_display_dispatch_queue(wdpy->wl_dpy, wdpy->queue); } assert(ret >= 0); android_wlegl_destroy(wdpy->wlegl); wl_registry_destroy(wdpy->registry); wl_event_queue_destroy(wdpy->queue); delete wdpy; }
WaylandNativeWindow::~WaylandNativeWindow() { std::list<WaylandNativeWindowBuffer *>::iterator it = m_bufList.begin(); for (; it != m_bufList.end(); it++) { WaylandNativeWindowBuffer* buf=*it; if (buf->wlbuffer) wl_buffer_destroy(buf->wlbuffer); buf->wlbuffer = NULL; buf->common.decRef(&buf->common); } if (frame_callback) wl_callback_destroy(frame_callback); wl_registry_destroy(registry); wl_event_queue_destroy(wl_queue); android_wlegl_destroy(m_android_wlegl); }
static void gst_wl_display_finalize (GObject * gobject) { GstWlDisplay *self = GST_WL_DISPLAY (gobject); gst_poll_set_flushing (self->wl_fd_poll, TRUE); if (self->thread) g_thread_join (self->thread); g_array_unref (self->formats); gst_poll_free (self->wl_fd_poll); if (self->shm) wl_shm_destroy (self->shm); if (self->shell) wl_shell_destroy (self->shell); if (self->compositor) wl_compositor_destroy (self->compositor); if (self->subcompositor) wl_subcompositor_destroy (self->subcompositor); if (self->registry) wl_registry_destroy (self->registry); if (self->queue) wl_event_queue_destroy (self->queue); if (self->own_display) { wl_display_flush (self->display); wl_display_disconnect (self->display); } G_OBJECT_CLASS (gst_wl_display_parent_class)->finalize (gobject); }
static void gst_mfx_window_wayland_destroy (GstMfxWindow * window) { GstMfxWindowWaylandPrivate *const priv = GST_MFX_WINDOW_WAYLAND_GET_PRIVATE (window); struct wl_display *const display = GST_MFX_DISPLAY_HANDLE (GST_MFX_WINDOW_DISPLAY (window)); /* Make sure that the last wl_buffer's callback could be called */ GST_MFX_DISPLAY_LOCK (GST_MFX_WINDOW_DISPLAY (window)); if (priv->surface) { wl_surface_attach (priv->surface, NULL, 0, 0); wl_surface_commit (priv->surface); wl_display_flush (display); } GST_MFX_DISPLAY_UNLOCK (GST_MFX_WINDOW_DISPLAY (window)); gst_poll_set_flushing (priv->poll, TRUE); if (priv->event_queue) { wl_display_roundtrip_queue (display, priv->event_queue); } if (priv->thread) { g_thread_join (priv->thread); priv->thread = NULL; } #ifdef USE_WESTON_4_0 if (priv->wp_viewport) { wp_viewport_destroy (priv->wp_viewport); priv->wp_viewport = NULL; } #else if (priv->viewport) { wl_viewport_destroy (priv->viewport); priv->viewport = NULL; } #endif if (priv->shell_surface) { wl_shell_surface_destroy (priv->shell_surface); priv->shell_surface = NULL; } if (priv->surface) { wl_surface_destroy (priv->surface); priv->surface = NULL; } if (priv->event_queue) { wl_event_queue_destroy (priv->event_queue); priv->event_queue = NULL; } #ifdef USE_EGL if (priv->egl_window) { wl_egl_window_destroy (priv->egl_window); priv->egl_window = NULL; } #endif gst_poll_free (priv->poll); }