[vlc-commits] vdpau: pass a window directly to vlc_xcb_parent_Create

Steve Lhomme git at videolan.org
Wed Nov 27 10:18:41 CET 2019


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Nov 22 08:40:09 2019 +0100| [26e5cfcf66aca503e8806eba98b1e079365a0273] | committer: Steve Lhomme

vdpau: pass a window directly to vlc_xcb_parent_Create

We don't need to know about the whole display configuration.

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

 modules/hw/vdpau/display.c        |  2 +-
 modules/video_output/xcb/events.c | 16 +++++++---------
 modules/video_output/xcb/events.h |  7 +++----
 modules/video_output/xcb/render.c |  2 +-
 modules/video_output/xcb/x11.c    |  2 +-
 5 files changed, 13 insertions(+), 16 deletions(-)

diff --git a/modules/hw/vdpau/display.c b/modules/hw/vdpau/display.c
index 33d16d5298..63dcc2291b 100644
--- a/modules/hw/vdpau/display.c
+++ b/modules/hw/vdpau/display.c
@@ -311,7 +311,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
         return VLC_ENOMEM;
 
     const xcb_screen_t *screen;
-    if (vlc_xcb_parent_Create(vd, cfg, &sys->conn, &screen) == NULL)
+    if (vlc_xcb_parent_Create(vd, cfg->window, &sys->conn, &screen) != VLC_SUCCESS)
     {
         free(sys);
         return VLC_EGENERIC;
diff --git a/modules/video_output/xcb/events.c b/modules/video_output/xcb/events.c
index 7c036b4634..559f8da745 100644
--- a/modules/video_output/xcb/events.c
+++ b/modules/video_output/xcb/events.c
@@ -101,17 +101,15 @@ static const xcb_screen_t *FindScreen (vlc_object_t *obj,
     return NULL;
 }
 
-vout_window_t *vlc_xcb_parent_Create(vout_display_t *vd,
-                                     const vout_display_cfg_t *cfg,
-                                     xcb_connection_t **restrict pconn,
-                                     const xcb_screen_t **restrict pscreen)
+int vlc_xcb_parent_Create(vout_display_t *vd, const vout_window_t *wnd,
+                          xcb_connection_t **restrict pconn,
+                          const xcb_screen_t **restrict pscreen)
 {
-    if (cfg->window->type != VOUT_WINDOW_TYPE_XID)
+    if (wnd->type != VOUT_WINDOW_TYPE_XID)
     {
         msg_Err (vd, "window not available");
-        return NULL;
+        return VLC_EBADVAR;
     }
-    vout_window_t *wnd = cfg->window;
 
     xcb_connection_t *conn = Connect (VLC_OBJECT(vd), wnd->display.x11);
     if (conn == NULL)
@@ -132,12 +130,12 @@ vout_window_t *vlc_xcb_parent_Create(vout_display_t *vd,
     if (screen == NULL)
         goto error;
     *pscreen = screen;
-    return wnd;
+    return VLC_SUCCESS;
 
 error:
     if (conn != NULL)
         xcb_disconnect (conn);
-    return NULL;
+    return VLC_EGENERIC;
 }
 
 /**
diff --git a/modules/video_output/xcb/events.h b/modules/video_output/xcb/events.h
index be86776847..f3e6ef5314 100644
--- a/modules/video_output/xcb/events.h
+++ b/modules/video_output/xcb/events.h
@@ -40,10 +40,9 @@ int vlc_xcb_error_Check(vout_display_t *, xcb_connection_t *conn,
  * Creates a VLC video X window object, connects to the corresponding X server,
  * finds the corresponding X server screen.
  */
-struct vout_window_t *vlc_xcb_parent_Create(vout_display_t *obj,
-                                            const vout_display_cfg_t *cfg,
-                                            xcb_connection_t **connp,
-                                            const xcb_screen_t **screenp);
+int vlc_xcb_parent_Create(vout_display_t *obj, const vout_window_t *wnd,
+                          xcb_connection_t **connp,
+                          const xcb_screen_t **screenp);
 /**
  * Processes XCB events.
  */
diff --git a/modules/video_output/xcb/render.c b/modules/video_output/xcb/render.c
index a88cdfcbbc..c3e71933f3 100644
--- a/modules/video_output/xcb/render.c
+++ b/modules/video_output/xcb/render.c
@@ -563,7 +563,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
     xcb_connection_t *conn;
     const xcb_screen_t *screen;
 
-    if (vlc_xcb_parent_Create(vd, cfg, &conn, &screen) == NULL)
+    if (vlc_xcb_parent_Create(vd, cfg->window, &conn, &screen) != VLC_SUCCESS)
         return VLC_EGENERIC;
 
     sys->conn = conn;
diff --git a/modules/video_output/xcb/x11.c b/modules/video_output/xcb/x11.c
index 0f7cf49eb1..05e012f389 100644
--- a/modules/video_output/xcb/x11.c
+++ b/modules/video_output/xcb/x11.c
@@ -265,7 +265,7 @@ static int Open (vout_display_t *vd, const vout_display_cfg_t *cfg,
     /* Get window, connect to X server */
     xcb_connection_t *conn;
     const xcb_screen_t *scr;
-    if (vlc_xcb_parent_Create(vd, cfg, &conn, &scr) == NULL)
+    if (vlc_xcb_parent_Create(vd, cfg->window, &conn, &scr) != VLC_SUCCESS)
     {
         free (sys);
         return VLC_EGENERIC;



More information about the vlc-commits mailing list