[vlc-devel] commit: Updated xcb vout module to the new API. (Laurent Aimar )

git version control git at videolan.org
Sat Aug 1 12:08:12 CEST 2009


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Fri Jul 31 21:59:47 2009 +0200| [5174ad04729741230220f5ab30576b58e8009cfd] | committer: Laurent Aimar 

Updated xcb vout module to the new API.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5174ad04729741230220f5ab30576b58e8009cfd
---

 modules/video_output/xcb/common.c |   15 +++++++++++----
 modules/video_output/xcb/window.c |   23 +++++++++++++----------
 modules/video_output/xcb/x11.c    |   21 ++++++++++++++++++---
 modules/video_output/xcb/xvideo.c |   23 ++++++++++++++++++++---
 4 files changed, 62 insertions(+), 20 deletions(-)

diff --git a/modules/video_output/xcb/common.c b/modules/video_output/xcb/common.c
index ab02b94..6bfd35f 100644
--- a/modules/video_output/xcb/common.c
+++ b/modules/video_output/xcb/common.c
@@ -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;
 }
 
diff --git a/modules/video_output/xcb/window.c b/modules/video_output/xcb/window.c
index d8db243..0f8a4b3 100644
--- a/modules/video_output/xcb/window.c
+++ b/modules/video_output/xcb/window.c
@@ -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,
diff --git a/modules/video_output/xcb/x11.c b/modules/video_output/xcb/x11.c
index 455b311..9c0ea97 100644
--- a/modules/video_output/xcb/x11.c
+++ b/modules/video_output/xcb/x11.c
@@ -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;
+    }
 }
diff --git a/modules/video_output/xcb/xvideo.c b/modules/video_output/xcb/xvideo.c
index 38d8862..0afd1c6 100644
--- a/modules/video_output/xcb/xvideo.c
+++ b/modules/video_output/xcb/xvideo.c
@@ -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;
+    }
+
 }




More information about the vlc-devel mailing list