[vlc-devel] [PATCH 12/24] vout: ios: refactor for next changes

Thomas Guillem thomas at gllm.fr
Wed Oct 31 17:50:07 CET 2018


vd->fmt and vd->cfg will be removed.
fmt and cfg will be passed by Open() and controls.
---
 modules/video_output/ios.m | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/modules/video_output/ios.m b/modules/video_output/ios.m
index 7629cdbb87..cfb7840134 100644
--- a/modules/video_output/ios.m
+++ b/modules/video_output/ios.m
@@ -123,6 +123,7 @@ struct vout_display_sys_t
     vlc_gl_t *gl;
 
     picture_pool_t *picturePool;
+    vout_window_t *embed;
 };
 
 struct gl_sys
@@ -144,8 +145,10 @@ static void *OurGetProcAddress(vlc_gl_t *gl, const char *name)
 static int Open(vlc_object_t *this)
 {
     vout_display_t *vd = (vout_display_t *)this;
+    const vout_display_cfg_t *cfg = vd->cfg;
+    video_format_t *fmt = &vd->fmt;
 
-    if (vout_display_IsWindowed(vd))
+    if (vout_display_cfg_IsWindowed(cfg))
         return VLC_EGENERIC;
 
     vout_display_sys_t *sys = vlc_obj_calloc (this, 1, sizeof(*sys));
@@ -174,8 +177,8 @@ static int Open(vlc_object_t *this)
         }
 
         const vlc_fourcc_t *subpicture_chromas;
-        video_format_t fmt = vd->fmt;
 
+        sys->embed = cfg->window;
         sys->gl = vlc_object_create(this, sizeof(*sys->gl));
         if (!sys->gl)
             goto bailout;
@@ -197,8 +200,8 @@ static int Open(vlc_object_t *this)
         if (vlc_gl_MakeCurrent(sys->gl) != VLC_SUCCESS)
             goto bailout;
 
-        vout_display_opengl_t *vgl = vout_display_opengl_New(&vd->fmt, &subpicture_chromas,
-                                                             sys->gl, &vd->cfg->viewpoint);
+        vout_display_opengl_t *vgl = vout_display_opengl_New(fmt, &subpicture_chromas,
+                                                             sys->gl, &cfg->viewpoint);
         vlc_gl_ReleaseCurrent(sys->gl);
         if (!vgl)
             goto bailout;
@@ -270,13 +273,8 @@ static int Control(vout_display_t *vd, int query, va_list ap)
         case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
         case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:
         {
-            const vout_display_cfg_t *cfg;
-
-            if (query == VOUT_DISPLAY_CHANGE_SOURCE_ASPECT ||
-                query == VOUT_DISPLAY_CHANGE_SOURCE_CROP)
-                cfg = vd->cfg;
-            else
-                cfg = (const vout_display_cfg_t*)va_arg(ap, const vout_display_cfg_t *);
+            const vout_display_cfg_t *cfg =
+                va_arg(ap, const vout_display_cfg_t *);
 
             assert(cfg);
 
@@ -700,8 +698,9 @@ static void GLESSwap(vlc_gl_t *gl)
         _place = place;
     }
 
-    vout_display_SendEventDisplaySize(_voutDisplay, _viewSize.width * _scaleFactor,
-                                      _viewSize.height * _scaleFactor);
+    vout_display_sys_t *sys = _voutDisplay->sys;
+    vout_window_ReportSize(sys->embed, _viewSize.width * _scaleFactor,
+                           _viewSize.height * _scaleFactor);
 
     vlc_mutex_unlock(&_mutex);
 }
-- 
2.19.1



More information about the vlc-devel mailing list