/* This function handles a GstVdpWindow creation */ static GstVdpWindow * gst_vdp_sink_window_new (VdpSink * vdp_sink, gint width, gint height) { GstVdpWindow *window = NULL; GstVdpDevice *device = vdp_sink->device; Window root; gint screen_num; gulong black; VdpStatus status; VdpColor color = { 0, }; g_return_val_if_fail (GST_IS_VDP_SINK (vdp_sink), NULL); window = g_new0 (GstVdpWindow, 1); window->width = width; window->height = height; window->internal = TRUE; g_mutex_lock (vdp_sink->x_lock); screen_num = DefaultScreen (device->display); root = DefaultRootWindow (device->display); black = XBlackPixel (device->display, screen_num); window->win = XCreateSimpleWindow (vdp_sink->device->display, root, 0, 0, window->width, window->height, 0, 0, black); /* We have to do that to prevent X from redrawing the background on ConfigureNotify. This takes away flickering of video when resizing. */ XSetWindowBackgroundPixmap (vdp_sink->device->display, window->win, None); /* set application name as a title */ gst_vdp_sink_window_set_title (vdp_sink, window, NULL); if (vdp_sink->handle_events) { Atom wm_delete; XSelectInput (vdp_sink->device->display, window->win, ExposureMask | StructureNotifyMask | PointerMotionMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask); /* Tell the window manager we'd like delete client messages instead of * being killed */ wm_delete = XInternAtom (vdp_sink->device->display, "WM_DELETE_WINDOW", False); (void) XSetWMProtocols (vdp_sink->device->display, window->win, &wm_delete, 1); } XMapRaised (vdp_sink->device->display, window->win); XSync (vdp_sink->device->display, FALSE); g_mutex_unlock (vdp_sink->x_lock); gst_vdp_sink_window_decorate (vdp_sink, window); status = device->vdp_presentation_queue_target_create_x11 (device->device, window->win, &window->target); if (status != VDP_STATUS_OK) { GST_ELEMENT_ERROR (vdp_sink, RESOURCE, READ, ("Could not create presentation target"), ("Error returned from vdpau was: %s", device->vdp_get_error_string (status))); } status = device->vdp_presentation_queue_create (device->device, window->target, &window->queue); if (status != VDP_STATUS_OK) { GST_ELEMENT_ERROR (vdp_sink, RESOURCE, READ, ("Could not create presentation queue"), ("Error returned from vdpau was: %s", device->vdp_get_error_string (status))); } status = device->vdp_presentation_queue_set_background_color (window->queue, &color); if (status != VDP_STATUS_OK) { GST_ELEMENT_ERROR (vdp_sink, RESOURCE, READ, ("Could not set background color"), ("Error returned from vdpau was: %s", device->vdp_get_error_string (status))); } gst_x_overlay_got_xwindow_id (GST_X_OVERLAY (vdp_sink), window->win); return window; }
static VALUE rg_got_xwindow_id(VALUE self, VALUE x_window_id) { gst_x_overlay_got_xwindow_id(SELF(self), NUM2ULL(x_window_id)); return self; }