[vlc-commits] vout: win32: use the vd->source directly in common code

Steve Lhomme git at videolan.org
Wed Jul 15 16:44:47 CEST 2020


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Jul 15 16:26:31 2020 +0200| [86e5a200fd9355f6f66b1d0e9385242fa722ef7d] | committer: Steve Lhomme

vout: win32: use the vd->source directly in common code

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

 modules/video_output/win32/common.c     | 30 ++++++++++++++----------------
 modules/video_output/win32/common.h     |  8 +++-----
 modules/video_output/win32/direct3d11.c |  8 ++++----
 modules/video_output/win32/direct3d9.c  |  6 +++---
 modules/video_output/win32/glwin32.c    |  4 ++--
 modules/video_output/win32/wingdi.c     |  4 ++--
 6 files changed, 28 insertions(+), 32 deletions(-)

diff --git a/modules/video_output/win32/common.c b/modules/video_output/win32/common.c
index b31c77d0be..893124a649 100644
--- a/modules/video_output/win32/common.c
+++ b/modules/video_output/win32/common.c
@@ -49,8 +49,6 @@ void CommonInit(vout_display_t *vd, display_win32_area_t *area, const vout_displ
     area->place_changed = false;
     area->vdcfg = *vdcfg;
 
-    area->texture_source = vd->source;
-
     var_Create(vd, "disable-screensaver", VLC_VAR_BOOL | VLC_VAR_DOINHERIT);
 }
 
@@ -58,7 +56,7 @@ void CommonInit(vout_display_t *vd, display_win32_area_t *area, const vout_displ
 static void CommonChangeThumbnailClip(vlc_object_t *, vout_display_sys_win32_t *, bool show);
 
 /* */
-int CommonWindowInit(vlc_object_t *obj, display_win32_area_t *area,
+int CommonWindowInit(vout_display_t *vd, display_win32_area_t *area,
                      vout_display_sys_win32_t *sys, bool projection_gestures)
 {
     if (unlikely(area->vdcfg.window == NULL))
@@ -72,7 +70,7 @@ int CommonWindowInit(vlc_object_t *obj, display_win32_area_t *area,
     sys->hparent   = NULL;
 
     /* */
-    sys->event = EventThreadCreate(obj, area->vdcfg.window);
+    sys->event = EventThreadCreate(VLC_OBJECT(vd), area->vdcfg.window);
     if (!sys->event)
         return VLC_EGENERIC;
 
@@ -90,7 +88,7 @@ int CommonWindowInit(vlc_object_t *obj, display_win32_area_t *area,
     sys->hparent       = hwnd.hparent;
     sys->hvideownd     = hwnd.hvideownd;
 
-    CommonPlacePicture(obj, area, sys);
+    CommonPlacePicture(vd, area, sys);
 
     return VLC_SUCCESS;
 }
@@ -103,7 +101,7 @@ int CommonWindowInit(vlc_object_t *obj, display_win32_area_t *area,
 * its job is to update the source and destination RECTs used to display the
 * picture.
 *****************************************************************************/
-void CommonPlacePicture(vlc_object_t *obj, display_win32_area_t *area, vout_display_sys_win32_t *sys)
+void CommonPlacePicture(vout_display_t *vd, display_win32_area_t *area, vout_display_sys_win32_t *sys)
 {
     /* Update the window position and size */
     vout_display_cfg_t place_cfg = area->vdcfg;
@@ -117,7 +115,7 @@ void CommonPlacePicture(vlc_object_t *obj, display_win32_area_t *area, vout_disp
 #endif
 
     vout_display_place_t before_place = area->place;
-    vout_display_PlacePicture(&area->place, &area->texture_source, &place_cfg);
+    vout_display_PlacePicture(&area->place, &vd->source, &place_cfg);
 
     /* Signal the change in size/position */
     if (!vout_display_PlaceEquals(&before_place, &area->place))
@@ -125,18 +123,18 @@ void CommonPlacePicture(vlc_object_t *obj, display_win32_area_t *area, vout_disp
         area->place_changed |= true;
 
 #ifndef NDEBUG
-        msg_Dbg(obj, "UpdateRects source offset: %i,%i visible: %ix%i decoded: %ix%i",
-            area->texture_source.i_x_offset, area->texture_source.i_y_offset,
-            area->texture_source.i_visible_width, area->texture_source.i_visible_height,
-            area->texture_source.i_width, area->texture_source.i_height);
-        msg_Dbg(obj, "UpdateRects image_dst coords: %i,%i %ix%i",
+        msg_Dbg(vd, "UpdateRects source offset: %i,%i visible: %ix%i decoded: %ix%i",
+            vd->source.i_x_offset, vd->source.i_y_offset,
+            vd->source.i_visible_width, vd->source.i_visible_height,
+            vd->source.i_width, vd->source.i_height);
+        msg_Dbg(vd, "UpdateRects image_dst coords: %i,%i %ix%i",
             area->place.x, area->place.y, area->place.width, area->place.height);
 #endif
 
 #if !VLC_WINSTORE_APP
         if (sys->event != NULL)
         {
-            CommonChangeThumbnailClip(obj, sys, true);
+            CommonChangeThumbnailClip(VLC_OBJECT(vd), sys, true);
         }
 #endif
     }
@@ -200,7 +198,7 @@ static void CommonChangeThumbnailClip(vlc_object_t *obj, vout_display_sys_win32_
 }
 #endif /* !VLC_WINSTORE_APP */
 
-int CommonControl(vlc_object_t *obj, display_win32_area_t *area, vout_display_sys_win32_t *sys, int query, va_list args)
+int CommonControl(vout_display_t *vd, display_win32_area_t *area, vout_display_sys_win32_t *sys, int query, va_list args)
 {
     switch (query) {
     case VOUT_DISPLAY_CHANGE_DISPLAY_FILLED: /* const vout_display_cfg_t *p_cfg */
@@ -208,7 +206,7 @@ int CommonControl(vlc_object_t *obj, display_win32_area_t *area, vout_display_sy
     case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
     case VOUT_DISPLAY_CHANGE_SOURCE_CROP: {
         area->vdcfg = *va_arg(args, const vout_display_cfg_t *);
-        CommonPlacePicture(obj, area, sys);
+        CommonPlacePicture(vd, area, sys);
         return VLC_SUCCESS;
     }
     case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:   /* const vout_display_cfg_t *p_cfg */
@@ -227,7 +225,7 @@ int CommonControl(vlc_object_t *obj, display_win32_area_t *area, vout_display_sy
                          area->vdcfg.display.height, SWP_NOZORDER|SWP_NOMOVE|SWP_NOACTIVATE);
         }
 #endif /* !VLC_WINSTORE_APP */
-        CommonPlacePicture(obj, area, sys);
+        CommonPlacePicture(vd, area, sys);
         return VLC_SUCCESS;
     }
 
diff --git a/modules/video_output/win32/common.h b/modules/video_output/win32/common.h
index ee2ae3cedd..abca868bdd 100644
--- a/modules/video_output/win32/common.h
+++ b/modules/video_output/win32/common.h
@@ -36,8 +36,6 @@ typedef struct display_win32_area_t
     vout_display_place_t  place;
     bool                  place_changed;
 
-    video_format_t        texture_source;
-
     vout_display_cfg_t    vdcfg;
 } display_win32_area_t;
 
@@ -69,13 +67,13 @@ typedef struct vout_display_sys_win32_t
  * Prototypes from common.c
  *****************************************************************************/
 #if !VLC_WINSTORE_APP
-int  CommonWindowInit(vlc_object_t *, display_win32_area_t *, vout_display_sys_win32_t *,
+int  CommonWindowInit(vout_display_t *, display_win32_area_t *, vout_display_sys_win32_t *,
                       bool projection_gestures);
 void CommonWindowClean(vlc_object_t *, vout_display_sys_win32_t *);
 #endif /* !VLC_WINSTORE_APP */
-int  CommonControl(vlc_object_t *, display_win32_area_t *, vout_display_sys_win32_t *, int , va_list );
+int  CommonControl(vout_display_t *, display_win32_area_t *, vout_display_sys_win32_t *, int , va_list );
 
-void CommonPlacePicture (vlc_object_t *, display_win32_area_t *, vout_display_sys_win32_t *);
+void CommonPlacePicture (vout_display_t *, display_win32_area_t *, vout_display_sys_win32_t *);
 
 void CommonInit(vout_display_t *, display_win32_area_t *, const vout_display_cfg_t *);
 
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index af02d3f571..f16a063b07 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -325,7 +325,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
 #if !VLC_WINSTORE_APP
         if (cfg->window->type == VOUT_WINDOW_TYPE_HWND)
         {
-            if (CommonWindowInit(VLC_OBJECT(vd), &sys->area, &sys->sys,
+            if (CommonWindowInit(vd, &sys->area, &sys->sys,
                        vd->source.projection_mode != PROJECTION_MODE_RECTANGULAR))
                 goto error;
         }
@@ -492,7 +492,7 @@ static void SetQuadVSProjection(vout_display_t *vd, d3d_quad_t *quad, const vlc_
 static int Control(vout_display_t *vd, int query, va_list args)
 {
     vout_display_sys_t *sys = vd->sys;
-    int res = CommonControl( VLC_OBJECT(vd), &sys->area, &sys->sys, query, args );
+    int res = CommonControl( vd, &sys->area, &sys->sys, query, args );
 
     if (query == VOUT_DISPLAY_CHANGE_VIEWPOINT)
     {
@@ -619,7 +619,7 @@ static void PreparePicture(vout_display_t *vd, picture_t *picture, subpicture_t
                 sys->texture_fmt.i_width  = sys->picQuad.i_height = texDesc.Height;
                 sys->texture_fmt.i_height = sys->picQuad.i_width = texDesc.Width;
 
-                CommonPlacePicture(VLC_OBJECT(vd), &sys->area, &sys->sys);
+                CommonPlacePicture(vd, &sys->area, &sys->sys);
                 UpdateSize(vd);
             }
         }
@@ -825,7 +825,7 @@ static int Direct3D11Open(vout_display_t *vd, video_format_t *fmtp, vlc_video_co
     sys->texture_fmt.i_width  = sys->picQuad.i_width;
     sys->texture_fmt.i_height = sys->picQuad.i_height;
 
-    CommonPlacePicture(VLC_OBJECT(vd), &sys->area, &sys->sys);
+    CommonPlacePicture(vd, &sys->area, &sys->sys);
 
     err = QueryDisplayFormat(vd, &fmt);
     if (err != VLC_SUCCESS) {
diff --git a/modules/video_output/win32/direct3d9.c b/modules/video_output/win32/direct3d9.c
index ef0d83ef01..162bf3a8b0 100644
--- a/modules/video_output/win32/direct3d9.c
+++ b/modules/video_output/win32/direct3d9.c
@@ -1707,7 +1707,7 @@ static int Control(vout_display_t *vd, int query, va_list args)
         return VLC_SUCCESS;
     }
     default:
-        return CommonControl(VLC_OBJECT(vd), &sys->area, &sys->sys, query, args);
+        return CommonControl(vd, &sys->area, &sys->sys, query, args);
     }
 }
 
@@ -1815,7 +1815,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
     if ( sys->swapCb == NULL || sys->startEndRenderingCb == NULL || sys->updateOutputCb == NULL )
     {
         /* use our own callbacks, since there isn't any external ones */
-        if (CommonWindowInit(VLC_OBJECT(vd), &sys->area, &sys->sys, false))
+        if (CommonWindowInit(vd, &sys->area, &sys->sys, false))
             goto error;
 
         sys->outside_opaque = vd;
@@ -1853,7 +1853,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
     }
 
     if (sys->swapCb == LocalSwapchainSwap)
-        CommonPlacePicture(VLC_OBJECT(vd), &sys->area, &sys->sys);
+        CommonPlacePicture(vd, &sys->area, &sys->sys);
 
     sys->hxdll = Direct3D9LoadShaderLibrary();
     if (!sys->hxdll)
diff --git a/modules/video_output/win32/glwin32.c b/modules/video_output/win32/glwin32.c
index da893768c4..e8147ed996 100644
--- a/modules/video_output/win32/glwin32.c
+++ b/modules/video_output/win32/glwin32.c
@@ -81,7 +81,7 @@ static int Control(vout_display_t *vd, int query, va_list args)
         return vout_display_opengl_SetViewpoint(sys->vgl,
             &va_arg (args, const vout_display_cfg_t* )->viewpoint);
 
-    return CommonControl(VLC_OBJECT(vd), &sys->area, &sys->sys, query, args);
+    return CommonControl(vd, &sys->area, &sys->sys, query, args);
 }
 
 static const struct vout_window_operations embedVideoWindow_Ops =
@@ -121,7 +121,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
 
     /* */
     CommonInit(vd, &sys->area, cfg);
-    if (CommonWindowInit(VLC_OBJECT(vd), &sys->area, &sys->sys,
+    if (CommonWindowInit(vd, &sys->area, &sys->sys,
                    vd->source.projection_mode != PROJECTION_MODE_RECTANGULAR))
         goto error;
 
diff --git a/modules/video_output/win32/wingdi.c b/modules/video_output/win32/wingdi.c
index 6653401b78..7cfb2cdb51 100644
--- a/modules/video_output/win32/wingdi.c
+++ b/modules/video_output/win32/wingdi.c
@@ -100,7 +100,7 @@ static void Prepare(vout_display_t *vd, picture_t *picture, subpicture_t *subpic
 static int Control(vout_display_t *vd, int query, va_list args)
 {
     vout_display_sys_t *sys = vd->sys;
-    return CommonControl(VLC_OBJECT(vd), &sys->area, &sys->sys, query, args);
+    return CommonControl(vd, &sys->area, &sys->sys, query, args);
 }
 
 /* */
@@ -117,7 +117,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
         return VLC_ENOMEM;
 
     CommonInit(vd, &sys->area, cfg);
-    if (CommonWindowInit(VLC_OBJECT(vd), &sys->area, &sys->sys, false))
+    if (CommonWindowInit(vd, &sys->area, &sys->sys, false))
         goto error;
 
     /* */



More information about the vlc-commits mailing list