]> git.sesse.net Git - vlc/commitdiff
macosx/vout*.m: factorized some more code, fixed GL video device selection
authorEric Petit <titer@videolan.org>
Mon, 13 Dec 2004 19:18:31 +0000 (19:18 +0000)
committerEric Petit <titer@videolan.org>
Mon, 13 Dec 2004 19:18:31 +0000 (19:18 +0000)
modules/gui/macosx/vout.m
modules/gui/macosx/voutgl.m
modules/gui/macosx/voutqt.m

index 1701b2ffa0d7cb15dc7d64c122c208c8eebe13e1..386149ea0b67ba8cb605d43aaed7feca9201201b 100644 (file)
     NSScreen * o_screen;
     vlc_bool_t b_main_screen;
 
+    var_Create( p_vout, "macosx-vdev", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
+    var_Create( p_vout, "macosx-fill", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
+    var_Create( p_vout, "macosx-stretch", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
+    var_Create( p_vout, "macosx-opaqueness", VLC_VAR_FLOAT | VLC_VAR_DOINHERIT );
+
+    /* Setup the menuitem for the multiple displays. Read the vlc preference (macosx-vdev) for the primary display */
+    NSArray * o_screens = [NSScreen screens];
+    if( [o_screens count] > 0 && var_Type( p_real_vout, "video-device" ) == 0 )
+    {
+        int i = 1;
+        vlc_value_t val, val2, text;
+        NSScreen * o_screen;
+
+        var_Get( p_real_vout, "macosx-vdev", &val );
+
+        var_Create( p_real_vout, "video-device", VLC_VAR_INTEGER |
+                                            VLC_VAR_HASCHOICE );
+        text.psz_string = _("Video device");
+        var_Change( p_real_vout, "video-device", VLC_VAR_SETTEXT, &text, NULL );
+
+        NSEnumerator * o_enumerator = [o_screens objectEnumerator];
+
+        while( (o_screen = [o_enumerator nextObject]) != NULL )
+        {
+            char psz_temp[255];
+            NSRect s_rect = [o_screen frame];
+
+            snprintf( psz_temp, sizeof(psz_temp)/sizeof(psz_temp[0])-1,
+                      "%s %d (%dx%d)", _("Screen"), i,
+                      (int)s_rect.size.width, (int)s_rect.size.height );
+
+            text.psz_string = psz_temp;
+            val2.i_int = i;
+            var_Change( p_real_vout, "video-device",
+                        VLC_VAR_ADDCHOICE, &val2, &text );
+
+            if( ( i - 1 ) == val.i_int )
+            {
+                var_Set( p_real_vout, "video-device", val2 );
+            }
+            i++;
+        }
+
+        var_AddCallback( p_real_vout, "video-device", vout_VarCallback,
+                         NULL );
+
+        val2.b_bool = VLC_TRUE;
+        var_Set( p_real_vout, "intf-change", val2 );
+    }
+
     /* Find out on which screen to open the window */
-    int i_device = var_GetInteger( p_vout, "video-device" );
+    int i_device = var_GetInteger( p_real_vout, "video-device" );
     if( i_device < 0 )
     {
          /* No preference specified. Use the main screen */
         {
             i_device--;
             o_screen = [o_screens objectAtIndex: i_device];
-            var_SetInteger( p_vout, "macosx-vdev", i_device );
+            var_SetInteger( p_real_vout, "macosx-vdev", i_device );
             b_main_screen = ( i_device == 0 );
         }
     }
index e868cb5af20a3552fbff2e0f509c7634cc00e915..bceb7bcbb458b3547a181d71899bfd0586489da5 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * vout.m: MacOS X video output module
+ * voutgl.m: MacOS X OpenGL provider
  *****************************************************************************
  * Copyright (C) 2001-2003 VideoLAN
  * $Id: vout.m 8351 2004-08-02 13:06:38Z hartman $
@@ -60,7 +60,7 @@ struct vout_sys_t
     VLCGLView         * o_glview;
     vlc_bool_t          b_saved_frame;
     NSRect              s_frame;
-    vlc_bool_t        * b_got_frame;
+    vlc_bool_t          b_got_frame;
 };
 
 /*****************************************************************************
@@ -77,7 +77,6 @@ int E_(OpenVideoGL)  ( vlc_object_t * p_this )
 {
     vout_thread_t * p_vout = (vout_thread_t *) p_this;
     int i_timeout;
-    vlc_value_t val;
 
 /* OpenGL interface disabled until
  * - the green line is gone
@@ -122,59 +121,8 @@ int E_(OpenVideoGL)  ( vlc_object_t * p_this )
     p_vout->pf_control= Control;
     p_vout->pf_swap   = Swap;
 
-
     p_vout->p_sys->o_pool = [[NSAutoreleasePool alloc] init];
 
-    var_Create( p_vout, "macosx-vdev", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
-    var_Create( p_vout, "macosx-fill", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
-    var_Create( p_vout, "macosx-stretch", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
-    var_Create( p_vout, "macosx-opaqueness", VLC_VAR_FLOAT | VLC_VAR_DOINHERIT );
-
-    /* Setup the menuitem for the multiple displays. Read the vlc preference (macosx-vdev) for the primary display */
-    NSArray * o_screens = [NSScreen screens];
-    if( [o_screens count] > 0 && var_Type( p_vout, "video-device" ) == 0 )
-    {
-        int i = 1;
-        vlc_value_t val2, text;
-        NSScreen * o_screen;
-
-        var_Get( p_vout, "macosx-vdev", &val );
-
-        var_Create( p_vout, "video-device", VLC_VAR_INTEGER |
-                                            VLC_VAR_HASCHOICE ); 
-        text.psz_string = _("Video device");
-        var_Change( p_vout, "video-device", VLC_VAR_SETTEXT, &text, NULL );
-        
-        NSEnumerator * o_enumerator = [o_screens objectEnumerator];
-
-        while( (o_screen = [o_enumerator nextObject]) != NULL )
-        {
-            char psz_temp[255];
-            NSRect s_rect = [o_screen frame];
-
-            snprintf( psz_temp, sizeof(psz_temp)/sizeof(psz_temp[0])-1, 
-                      "%s %d (%dx%d)", _("Screen"), i,
-                      (int)s_rect.size.width, (int)s_rect.size.height ); 
-
-            text.psz_string = psz_temp;
-            val2.i_int = i;
-            var_Change( p_vout, "video-device",
-                        VLC_VAR_ADDCHOICE, &val2, &text );
-
-            if( ( i - 1 ) == val.i_int )
-            {
-                var_Set( p_vout, "video-device", val2 );
-            }
-            i++;
-        }
-
-        var_AddCallback( p_vout, "video-device", vout_VarCallback,
-                         NULL );
-
-        val2.b_bool = VLC_TRUE;
-        var_Set( p_vout, "intf-change", val2 );
-    }
-
     /* Spawn window */
     p_vout->p_sys->b_got_frame = VLC_FALSE;
     p_vout->p_sys->o_window = [[VLCWindow alloc] initWithVout: p_vout
index c73aa3e72a47180d59b8073fd825325ab524080d..390fe50cb06d744034107aaf4645307ccb82313c 100644 (file)
@@ -106,7 +106,6 @@ static void QTFreePicture       ( vout_thread_t *, picture_t * );
 int E_(OpenVideoQT) ( vlc_object_t *p_this )
 {   
     vout_thread_t * p_vout = (vout_thread_t *)p_this;
-    vlc_value_t val;
     OSErr err;
     int i_timeout;
 
@@ -145,11 +144,6 @@ int E_(OpenVideoQT) ( vlc_object_t *p_this )
 
     p_vout->p_sys->o_pool = [[NSAutoreleasePool alloc] init];
 
-    var_Create( p_vout, "macosx-vdev", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
-    var_Create( p_vout, "macosx-fill", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
-    var_Create( p_vout, "macosx-stretch", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
-    var_Create( p_vout, "macosx-opaqueness", VLC_VAR_FLOAT | VLC_VAR_DOINHERIT );
-    
     p_vout->p_sys->b_altivec = p_vout->p_libvlc->i_cpu & CPU_CAPABILITY_ALTIVEC;
     msg_Dbg( p_vout, "We do%s have Altivec", p_vout->p_sys->b_altivec ? "" : "n't" );
     
@@ -210,51 +204,6 @@ int E_(OpenVideoQT) ( vlc_object_t *p_this )
         return VLC_EGENERIC;        
     }
 
-    /* Setup the menuitem for the multiple displays. Read the vlc preference (macosx-vdev) for the primary display */
-    NSArray * o_screens = [NSScreen screens];
-    if( [o_screens count] > 0 && var_Type( p_vout, "video-device" ) == 0 )
-    {
-        int i = 1;
-        vlc_value_t val2, text;
-        NSScreen * o_screen;
-
-        var_Get( p_vout, "macosx-vdev", &val );
-
-        var_Create( p_vout, "video-device", VLC_VAR_INTEGER |
-                                            VLC_VAR_HASCHOICE ); 
-        text.psz_string = _("Video device");
-        var_Change( p_vout, "video-device", VLC_VAR_SETTEXT, &text, NULL );
-        
-        NSEnumerator * o_enumerator = [o_screens objectEnumerator];
-
-        while( (o_screen = [o_enumerator nextObject]) != NULL )
-        {
-            char psz_temp[255];
-            NSRect s_rect = [o_screen frame];
-
-            snprintf( psz_temp, sizeof(psz_temp)/sizeof(psz_temp[0])-1, 
-                      "%s %d (%dx%d)", _("Screen"), i,
-                      (int)s_rect.size.width, (int)s_rect.size.height ); 
-
-            text.psz_string = psz_temp;
-            val2.i_int = i;
-            var_Change( p_vout, "video-device",
-                        VLC_VAR_ADDCHOICE, &val2, &text );
-
-            if( ( i - 1 ) == val.i_int )
-            {
-                var_Set( p_vout, "video-device", val2 );
-            }
-            i++;
-        }
-
-        var_AddCallback( p_vout, "video-device", vout_VarCallback,
-                         NULL );
-
-        val2.b_bool = VLC_TRUE;
-        var_Set( p_vout, "intf-change", val2 );
-    }
-
     /* Spawn window */
     p_vout->p_sys->o_window =
         [[VLCWindow alloc] initWithVout: p_vout frame: nil];