-/**
- * Get a list of XVideo adaptors for a given window.
- */
-static xcb_xv_query_adaptors_reply_t *GetAdaptors (vout_window_t *wnd,
- xcb_connection_t *conn)
-{
- xcb_xv_query_adaptors_cookie_t ck;
-
- ck = xcb_xv_query_adaptors (conn, wnd->handle.xid);
- return xcb_xv_query_adaptors_reply (conn, ck, NULL);
-}
-
-#define p_vout vout
-
-/**
- * Probe the X server.
- */
-static int Open (vlc_object_t *obj)
-{
- vout_thread_t *vout = (vout_thread_t *)obj;
- vout_sys_t *p_sys = malloc (sizeof (*p_sys));
- if (p_sys == NULL)
- return VLC_ENOMEM;
-
- vout->p_sys = p_sys;
-
- /* Connect to X */
- p_sys->conn = Connect (obj);
- if (p_sys->conn == NULL)
- {
- free (p_sys);
- return VLC_EGENERIC;
- }
-
- if (!CheckXVideo (vout, p_sys->conn))
- {
- msg_Warn (vout, "Please enable XVideo 2.2 for faster video display");
- xcb_disconnect (p_sys->conn);
- free (p_sys);
- return VLC_EGENERIC;
- }
-
- const xcb_screen_t *screen;
- p_sys->embed = GetWindow (vout, p_sys->conn, &screen, &p_sys->shm);
- if (p_sys->embed == NULL)
- {
- xcb_disconnect (p_sys->conn);
- free (p_sys);
- return VLC_EGENERIC;
- }
-
- /* Cache adaptors infos */
- p_sys->adaptors = GetAdaptors (p_sys->embed, p_sys->conn);
- if (p_sys->adaptors == NULL)
- goto error;
-
- /* Create window */
- {
- const uint32_t mask =
- /* XCB_CW_EVENT_MASK */
- XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE |
- XCB_EVENT_MASK_POINTER_MOTION;
- xcb_void_cookie_t c;
- xcb_window_t window = xcb_generate_id (p_sys->conn);
-
- c = xcb_create_window_checked (p_sys->conn, screen->root_depth, window,
- p_sys->embed->handle.xid, 0, 0, 1, 1, 0,
- XCB_WINDOW_CLASS_INPUT_OUTPUT,
- screen->root_visual,
- XCB_CW_EVENT_MASK, &mask);
- if (CheckError (vout, "cannot create X11 window", c))
- goto error;
- p_sys->window = window;
- msg_Dbg (vout, "using X11 window %08"PRIx32, p_sys->window);
- xcb_map_window (p_sys->conn, window);
- }
-
- p_sys->gc = xcb_generate_id (p_sys->conn);
- xcb_create_gc (p_sys->conn, p_sys->gc, p_sys->window, 0, NULL);
- msg_Dbg (vout, "using X11 graphic context %08"PRIx32, p_sys->gc);
-
- vout->pf_init = Init;
- vout->pf_end = Deinit;
- vout->pf_display = Display;
- vout->pf_manage = Manage;
- vout->pf_control = Control;
- return VLC_SUCCESS;
-
-error:
- Close (obj);
- return VLC_EGENERIC;
-}
-
-
-/**
- * Disconnect from the X server.
- */
-static void Close (vlc_object_t *obj)
-{
- vout_thread_t *vout = (vout_thread_t *)obj;
- vout_sys_t *p_sys = vout->p_sys;
-
- free (p_sys->adaptors);
- vout_ReleaseWindow (p_sys->embed);
- xcb_disconnect (p_sys->conn);
- free (p_sys);
-}
-
-static vlc_fourcc_t ParseFormat (vout_thread_t *vout,