Commit 5174ad04 authored by Laurent Aimar's avatar Laurent Aimar

Updated xcb vout module to the new API.

parent 40e17c0f
......@@ -35,7 +35,7 @@
#include <vlc_common.h>
#include <vlc_vout.h>
#include <vlc_window.h>
#include <vlc_vout_window.h>
#include "xcb_vlc.h"
......@@ -69,8 +69,15 @@ vout_window_t *GetWindow (vout_thread_t *obj,
{
/* Get window */
xcb_window_t root;
vout_window_t *wnd = vout_RequestXWindow (obj, &(int){ 0 }, &(int){ 0 },
&(unsigned){ 0 }, &(unsigned){ 0 });
vout_window_cfg_t wnd_cfg;
memset( &wnd_cfg, 0, sizeof(wnd_cfg) );
wnd_cfg.type = VOUT_WINDOW_TYPE_XWINDOW;
wnd_cfg.width = obj->i_window_width;
wnd_cfg.height = obj->i_window_height;
vout_window_t *wnd = vout_window_New (VLC_OBJECT(obj), NULL, &wnd_cfg);
if (wnd == NULL)
{
msg_Err (obj, "parent window not available");
......@@ -137,7 +144,7 @@ vout_window_t *GetWindow (vout_thread_t *obj,
return wnd;
error:
vout_ReleaseWindow (wnd);
vout_window_Delete (wnd);
return NULL;
}
......
......@@ -36,7 +36,7 @@ typedef xcb_atom_t Atom;
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_window.h>
#include <vlc_vout_window.h>
#include "xcb_vlc.h"
......@@ -56,7 +56,7 @@ vlc_module_begin ()
set_description (N_("(Experimental) XCB video window"))
set_category (CAT_VIDEO)
set_subcategory (SUBCAT_VIDEO_VOUT)
set_capability ("xwindow", 10)
set_capability ("vout window", 10)
set_callbacks (Open, Close)
add_string ("x11-display", NULL, NULL,
......@@ -141,10 +141,13 @@ xcb_atom_t get_atom (xcb_connection_t *conn, xcb_intern_atom_cookie_t ck)
static int Open (vlc_object_t *obj)
{
vout_window_t *wnd = (vout_window_t *)obj;
vout_window_sys_t *p_sys = malloc (sizeof (*p_sys));
xcb_generic_error_t *err;
xcb_void_cookie_t ck;
if (wnd->cfg->type != VOUT_WINDOW_TYPE_XWINDOW)
return VLC_EGENERIC;
vout_window_sys_t *p_sys = malloc (sizeof (*p_sys));
if (p_sys == NULL)
return VLC_ENOMEM;
......@@ -187,7 +190,7 @@ static int Open (vlc_object_t *obj)
xcb_window_t window = xcb_generate_id (conn);
ck = xcb_create_window_checked (conn, scr->root_depth, window, scr->root,
0, 0, wnd->width, wnd->height, 0,
0, 0, wnd->cfg->width, wnd->cfg->height, 0,
XCB_WINDOW_CLASS_INPUT_OUTPUT,
scr->root_visual, mask, values);
err = xcb_request_check (conn, ck);
......@@ -198,8 +201,8 @@ static int Open (vlc_object_t *obj)
}
wnd->handle.xid = window;
wnd->p_sys = p_sys;
wnd->control = Control;
wnd->sys = p_sys;
p_sys->conn = conn;
p_sys->keys = CreateKeyHandler (obj, conn);
......@@ -273,7 +276,7 @@ error:
static void Close (vlc_object_t *obj)
{
vout_window_t *wnd = (vout_window_t *)obj;
vout_window_sys_t *p_sys = wnd->p_sys;
vout_window_sys_t *p_sys = wnd->sys;
xcb_connection_t *conn = p_sys->conn;
xcb_window_t window = wnd->handle.xid;
......@@ -293,7 +296,7 @@ static void Close (vlc_object_t *obj)
static void *Thread (void *data)
{
vout_window_t *wnd = data;
vout_window_sys_t *p_sys = wnd->p_sys;
vout_window_sys_t *p_sys = wnd->sys;
xcb_connection_t *conn = p_sys->conn;
int fd = xcb_get_file_descriptor (conn);
......@@ -330,12 +333,12 @@ static void *Thread (void *data)
static int Control (vout_window_t *wnd, int cmd, va_list ap)
{
vout_window_sys_t *p_sys = wnd->p_sys;
vout_window_sys_t *p_sys = wnd->sys;
xcb_connection_t *conn = p_sys->conn;
switch (cmd)
{
case VOUT_SET_SIZE:
case VOUT_WINDOW_SET_SIZE:
{
unsigned width = va_arg (ap, unsigned);
unsigned height = va_arg (ap, unsigned);
......@@ -348,7 +351,7 @@ static int Control (vout_window_t *wnd, int cmd, va_list ap)
break;
}
case VOUT_SET_STAY_ON_TOP:
case VOUT_WINDOW_SET_ON_TOP:
{ /* From EWMH "_WM_STATE" */
xcb_client_message_event_t ev = {
.response_type = XCB_CLIENT_MESSAGE,
......
......@@ -33,7 +33,7 @@
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_vout.h>
#include <vlc_window.h>
#include <vlc_vout_window.h>
#include "xcb_vlc.h"
......@@ -296,7 +296,7 @@ static void Close (vlc_object_t *obj)
vout_thread_t *vout = (vout_thread_t *)obj;
vout_sys_t *p_sys = vout->p_sys;
vout_ReleaseWindow (p_sys->embed);
vout_window_Delete (p_sys->embed);
/* colormap and window are garbage-collected by X */
xcb_disconnect (p_sys->conn);
free (p_sys);
......@@ -447,5 +447,20 @@ HandleParentStructure (vout_thread_t *vout, xcb_connection_t *conn,
static int Control (vout_thread_t *vout, int query, va_list ap)
{
return vout_ControlWindow (vout->p_sys->embed, query, ap);
switch (query)
{
case VOUT_SET_SIZE:
{
const unsigned width = va_arg (ap, unsigned);
const unsigned height = va_arg (ap, unsigned);
return vout_window_SetSize (vout->p_sys->embed, width, height);
}
case VOUT_SET_STAY_ON_TOP:
{
const bool is_on_top = va_arg (ap, int);
return vout_window_SetOnTop (vout->p_sys->embed, is_on_top);
}
default:
return VLC_EGENERIC;
}
}
......@@ -34,7 +34,7 @@
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_vout.h>
#include <vlc_window.h>
#include <vlc_vout_window.h>
#include "xcb_vlc.h"
......@@ -233,7 +233,7 @@ static void Close (vlc_object_t *obj)
vout_sys_t *p_sys = vout->p_sys;
free (p_sys->adaptors);
vout_ReleaseWindow (p_sys->embed);
vout_window_Delete (p_sys->embed);
xcb_disconnect (p_sys->conn);
free (p_sys);
}
......@@ -611,5 +611,22 @@ HandleParentStructure (vout_thread_t *vout, xcb_connection_t *conn,
static int Control (vout_thread_t *vout, int query, va_list ap)
{
return vout_ControlWindow (vout->p_sys->embed, query, ap);
/* FIXME it can be shared between x11 and xvideo */
switch (query)
{
case VOUT_SET_SIZE:
{
const unsigned width = va_arg (ap, unsigned);
const unsigned height = va_arg (ap, unsigned);
return vout_window_SetSize (vout->p_sys->embed, width, height);
}
case VOUT_SET_STAY_ON_TOP:
{
const bool is_on_top = va_arg (ap, int);
return vout_window_SetOnTop (vout->p_sys->embed, is_on_top);
}
default:
return VLC_EGENERIC;
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment