[vlc-devel] [PATCH 5/8] osx: Add vout_window_t support to macosx vout module

Juho Vähä-Herttua juhovh at iki.fi
Wed Jul 21 15:54:23 CEST 2010


---
 modules/video_output/macosx.m |   22 +++++++++++++++++++---
 1 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/modules/video_output/macosx.m b/modules/video_output/macosx.m
index 29cde85..4922516 100644
--- a/modules/video_output/macosx.m
+++ b/modules/video_output/macosx.m
@@ -98,6 +98,7 @@ struct vout_display_sys_t
     VLCOpenGLVideoView *glView;
     id<VLCOpenGLVideoViewEmbedding> container;
 
+    vout_window_t *embed;
     vout_opengl_t gl;
     vout_display_opengl_t vgl;
 
@@ -118,15 +119,29 @@ static int Open(vlc_object_t *this)
     vd->sys = sys;
     sys->pool = NULL;
     sys->gl.sys = NULL;
+    sys->embed = NULL;
 
     /* Get the drawable object */
     id container = var_CreateGetAddress(vd, "drawable-nsobject");
     if (!container)
     {
-        msg_Dbg(vd, "No drawable-nsobject, passing over.");
-        goto error;
+        vout_window_cfg_t wnd_cfg;
+
+        memset (&wnd_cfg, 0, sizeof (wnd_cfg));
+        wnd_cfg.type = VOUT_WINDOW_TYPE_NSOBJECT;
+        wnd_cfg.x = var_InheritInteger (vd, "video-x");
+        wnd_cfg.y = var_InheritInteger (vd, "video-y");
+        wnd_cfg.width  = vd->cfg->display.width;
+        wnd_cfg.height = vd->cfg->display.height;
+
+        sys->embed = vout_display_NewWindow (vd, &wnd_cfg);
+        container = sys->embed->handle.nsobject;
+        if (!container)
+        {
+            msg_Dbg(vd, "No drawable-nsobject nor vout_window_t found, passing over.");
+            goto error;
+        }
     }
-    vout_display_DeleteWindow(vd, NULL);
 
     /* This will be released in Close(), on
      * main thread, after we are done using it. */
@@ -220,6 +235,7 @@ void Close(vlc_object_t *this)
     if (sys->gl.sys != NULL)
         vout_display_opengl_Clean(&sys->vgl);
 
+    vout_display_DeleteWindow(vd, sys->embed);
     free (sys);
 }
 
-- 
1.7.0.4




More information about the vlc-devel mailing list