[vlc-devel] commit: Segregate vout window types ( Rémi Denis-Courmont )

git version control git at videolan.org
Sat Jan 31 19:40:40 CET 2009


vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Sat Jan 31 20:40:17 2009 +0200| [7ecf78a8cbc66e79e69e049ee7e6c70a6a751ec0] | committer: Rémi Denis-Courmont 

Segregate vout window types

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

 include/vlc_window.h               |   16 +++++++++++++++-
 modules/gui/maemo/maemo.c          |    2 +-
 modules/gui/qt4/qt4.cpp            |    9 ++++++++-
 modules/video_output/msw/events.c  |    2 +-
 modules/video_output/omapfb.c      |    2 +-
 modules/video_output/x11/xcommon.c |    2 +-
 modules/video_output/xcb/window.c  |    4 ++--
 modules/video_output/xcb/xcb.c     |    2 +-
 src/video_output/vout_intf.c       |    7 ++++---
 9 files changed, 34 insertions(+), 12 deletions(-)

diff --git a/include/vlc_window.h b/include/vlc_window.h
index a0fe0ec..a002f3a 100644
--- a/include/vlc_window.h
+++ b/include/vlc_window.h
@@ -51,8 +51,22 @@ struct vout_window_t
     int (*control) (struct vout_window_t *, int, va_list);
 };
 
-VLC_EXPORT( vout_window_t *, vout_RequestWindow, ( vout_thread_t *, int *, int *, unsigned int *, unsigned int * ) );
+VLC_EXPORT( vout_window_t *, vout_RequestWindow, ( vout_thread_t *, const char *, int *, int *, unsigned int *, unsigned int * ) );
 VLC_EXPORT( void,   vout_ReleaseWindow, ( vout_window_t * ) );
 VLC_EXPORT( int, vout_ControlWindow, ( vout_window_t *, int, va_list ) );
 
+static inline vout_window_t *
+vout_RequestXWindow (vout_thread_t *vout,
+                     int *x, int *y, unsigned *w, unsigned *h)
+{
+    return vout_RequestWindow (vout, "xwindow", x, y, w, h);
+}
+
+static inline vout_window_t *
+vout_RequestHWND (vout_thread_t *vout,
+                  int *x, int *y, unsigned *w, unsigned *h)
+{
+    return vout_RequestWindow (vout, "hwnd", x, y, w, h);
+}
+
 #endif /* !LIBVLCCORE_WINDOW_H */
diff --git a/modules/gui/maemo/maemo.c b/modules/gui/maemo/maemo.c
index 7ed5c39..0690062 100644
--- a/modules/gui/maemo/maemo.c
+++ b/modules/gui/maemo/maemo.c
@@ -70,7 +70,7 @@ vlc_module_begin();
     add_shortcut( "maemo" );
 
     add_submodule();
-        set_capability( "vout_window", 50 );
+        set_capability( "xwindow", 50 );
         set_callbacks( OpenWindow, CloseWindow );
 vlc_module_end();
 
diff --git a/modules/gui/qt4/qt4.cpp b/modules/gui/qt4/qt4.cpp
index 6ea3520..816076a 100644
--- a/modules/gui/qt4/qt4.cpp
+++ b/modules/gui/qt4/qt4.cpp
@@ -231,9 +231,16 @@ vlc_module_begin ()
 
         set_callbacks( OpenDialogs, Close )
 
+#if defined (Q_WS_X11)
+# define WID_CAPABILITY "xwindow"
+#elif defined (WIN32)
+# define WID_CAPABILITY "hwnd"
+#endif
+#ifdef WID_CAPABILITY
     add_submodule ()
-        set_capability( "vout_window", 50 )
+        set_capability( WID_CAPABILITY, 50 )
         set_callbacks( WindowOpen, WindowClose )
+#endif
 
 vlc_module_end ()
 
diff --git a/modules/video_output/msw/events.c b/modules/video_output/msw/events.c
index 3e7a7a6..221e4dd 100644
--- a/modules/video_output/msw/events.c
+++ b/modules/video_output/msw/events.c
@@ -418,7 +418,7 @@ static int DirectXCreateWindow( vout_thread_t *p_vout )
 
     /* If an external window was specified, we'll draw in it. */
     p_vout->p_sys->parent_window =
-        vout_RequestWindow( p_vout, &p_vout->p_sys->i_window_x,
+        vout_RequestHWND( p_vout, &p_vout->p_sys->i_window_x,
                             &p_vout->p_sys->i_window_y,
                             &p_vout->p_sys->i_window_width,
                             &p_vout->p_sys->i_window_height );
diff --git a/modules/video_output/omapfb.c b/modules/video_output/omapfb.c
index f992700..df72a10 100644
--- a/modules/video_output/omapfb.c
+++ b/modules/video_output/omapfb.c
@@ -669,7 +669,7 @@ static int InitWindow( vout_thread_t *p_vout )
 
         // Request window from interface
         p_sys->owner_window =
-            vout_RequestWindow( p_vout,
+            vout_RequestXWindow( p_vout,
                                 &p_sys->embedded_window.i_x,
                                 &p_sys->embedded_window.i_y,
                                 &p_sys->embedded_window.i_width,
diff --git a/modules/video_output/x11/xcommon.c b/modules/video_output/x11/xcommon.c
index 3d103ce..e15dd6c 100644
--- a/modules/video_output/x11/xcommon.c
+++ b/modules/video_output/x11/xcommon.c
@@ -1619,7 +1619,7 @@ static int CreateWindow( vout_thread_t *p_vout, x11_window_t *p_win )
 
     if( !p_vout->b_fullscreen )
     {
-        p_win->owner_window = vout_RequestWindow( p_vout, &p_win->i_x,
+        p_win->owner_window = vout_RequestXWindow( p_vout, &p_win->i_x,
                               &p_win->i_y, &p_win->i_width, &p_win->i_height );
         xsize_hints.base_width  = xsize_hints.width = p_win->i_width;
         xsize_hints.base_height = xsize_hints.height = p_win->i_height;
diff --git a/modules/video_output/xcb/window.c b/modules/video_output/xcb/window.c
index 0dac44f..f5289c7 100644
--- a/modules/video_output/xcb/window.c
+++ b/modules/video_output/xcb/window.c
@@ -50,7 +50,7 @@ vlc_module_begin ()
     set_description (N_("(Experimental) XCB video window"))
     set_category (CAT_VIDEO)
     set_subcategory (SUBCAT_VIDEO_VOUT)
-    set_capability ("vout_window", 10)
+    set_capability ("xwindow", 10)
     set_callbacks (Open, Close)
 
     add_string ("x11-display", NULL, NULL,
@@ -114,7 +114,7 @@ static void Close (vlc_object_t *obj)
 {
     vout_window_t *wnd = (vout_window_t *)obj;
     xcb_connection_t *conn = wnd->p_sys;
-    xcb_window_t window = (uintptr_t)wnd->handle;
+    xcb_window_t window = wnd->handle.xid;
 
     xcb_unmap_window (conn, window);
     xcb_destroy_window (conn, window);
diff --git a/modules/video_output/xcb/xcb.c b/modules/video_output/xcb/xcb.c
index 035311a..e39257c 100644
--- a/modules/video_output/xcb/xcb.c
+++ b/modules/video_output/xcb/xcb.c
@@ -370,7 +370,7 @@ static int Init (vout_thread_t *vout)
     }
     else
     {
-        p_sys->embed = vout_RequestWindow (vout, &(int){ 0 }, &(int){ 0 },
+        p_sys->embed = vout_RequestXWindow (vout, &(int){ 0 }, &(int){ 0 },
                                             &width, &height);
         if (p_sys->embed == NULL)
         {
diff --git a/src/video_output/vout_intf.c b/src/video_output/vout_intf.c
index 89cc527..219d030 100644
--- a/src/video_output/vout_intf.c
+++ b/src/video_output/vout_intf.c
@@ -89,6 +89,7 @@ static int TitlePositionCallback( vlc_object_t *, char const *,
  * video within the resulting window, while in windowed mode.
  *
  * @param p_vout video output thread to create a window for
+ * @param psz_cap VLC module capability (window system type)
  * @param pi_x_hint pointer to store the recommended horizontal position [OUT]
  * @param pi_y_hint pointer to store the recommended vertical position [OUT]
  * @param pi_width_hint pointer to store the recommended width [OUT]
@@ -97,7 +98,7 @@ static int TitlePositionCallback( vlc_object_t *, char const *,
  * @return a vout_window_t object, or NULL in case of failure.
  * The window is released with vout_ReleaseWindow().
  */
-vout_window_t *vout_RequestWindow( vout_thread_t *p_vout,
+vout_window_t *vout_RequestWindow( vout_thread_t *p_vout, const char *psz_cap,
                           int *pi_x_hint, int *pi_y_hint,
                           unsigned int *pi_width_hint,
                           unsigned int *pi_height_hint )
@@ -125,10 +126,10 @@ vout_window_t *vout_RequestWindow( vout_thread_t *p_vout,
     wnd->pos_y = *pi_y_hint;
     vlc_object_attach (wnd, p_vout);
 
-    wnd->module = module_need (wnd, "vout_window", NULL, false);
+    wnd->module = module_need (wnd, psz_cap, NULL, false);
     if (wnd->module == NULL)
     {
-        msg_Dbg (wnd, "no window provider available");
+        msg_Dbg (wnd, "no \"%s\" window provider available", psz_cap);
         vlc_object_release (wnd);
         return NULL;
     }




More information about the vlc-devel mailing list