]> git.sesse.net Git - vlc/blobdiff - modules/gui/macosx/vout.m
macosx: experimental 64bit support
[vlc] / modules / gui / macosx / vout.m
index 8152b4452bcf322c7ba8ed9e7178c02bd75467f4..618831568b68bf9caed22e4c16564c31ed05863b 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * vout.m: MacOS X video output module
  *****************************************************************************
- * Copyright (C) 2001-2008 the VideoLAN team
+ * Copyright (C) 2001-2009 the VideoLAN team
  * $Id$
  *
  * Authors: Colin Delacroix <colin@zoy.org>
 #include <stdlib.h>                                                /* free() */
 #include <string.h>
 
-/* BeginFullScreen, EndFullScreen */
-#include <QuickTime/QuickTime.h>
+/* prevent system sleep */
+#import <CoreServices/CoreServices.h>
+#import <CoreServices/../Frameworks/OSServices.framework/Headers/Power.h>
+
+/* SystemUIMode */
+#import <Carbon/Carbon.h>
 
 #include <vlc_keys.h>
 
@@ -123,14 +127,19 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
 
 - (id)getViewForWindow: (id)o_window
 {
-    id o_enumerator = [o_embedded_array objectEnumerator];
-    id o_current_embedded;
-
-    while( (o_current_embedded = [o_enumerator nextObject]) )
+    if( o_embedded_array != nil )
     {
-        if( [o_current_embedded getWindow] == o_window )
+        id o_enumerator = [o_embedded_array objectEnumerator];
+        id o_current_embedded;
+        if( o_window != nil )
         {
-            return o_current_embedded;
+            while( (o_current_embedded = [o_enumerator nextObject]) )
+            {
+                if( [o_current_embedded getWindow] == o_window )
+                {
+                    return o_current_embedded;
+                }
+            }
         }
     }
     return nil;
@@ -330,7 +339,6 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
     vlc_object_release( p_input );
 }
 
-
 - (void)setOnTop:(BOOL)b_on_top
 {
     if( b_on_top )
@@ -438,7 +446,7 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
 
 - (void)snapshot
 {
-    vout_Control( p_real_vout, VOUT_SNAPSHOT );
+    var_TriggerCallback( p_real_vout, "video-snapshot" );
 }
 
 - (void)manage
@@ -447,6 +455,7 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
     if( !VLCIntf || !VLCIntf->p_sys )
         return;
 
+    UInt8 UsrActivity;
     if( VLCIntf->p_sys->i_play_status == PLAYING_S )
         UpdateSystemActivity( UsrActivity );
 }
@@ -570,9 +579,7 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
 
     if( p_vout && [o_event type] == NSLeftMouseUp )
     {
-        vlc_value_t b_val;
-        b_val.b_bool = true;
-        var_Set( p_vout, "mouse-clicked", b_val );
+        var_SetBool( p_vout, "mouse-clicked", true );
 
         var_Get( p_vout, "mouse-button-down", &val );
         val.i_int &= ~1;
@@ -704,11 +711,11 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
 + (id)voutView: (vout_thread_t *)p_vout subView: (NSView *)view
          frame: (NSRect *)s_frame
 {
-    vlc_value_t value_drawable;
+    int i_drawable_gl;
     int i_timeout;
     id o_return = nil;
 
-    var_Get( p_vout->p_libvlc, "drawable", &value_drawable );
+    i_drawable_gl = var_GetInteger( p_vout->p_libvlc, "drawable-gl" );
 
     var_Create( p_vout, "macosx-vdev", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
     var_Create( p_vout, "macosx-stretch", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
@@ -719,9 +726,9 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
 
     /* We only wait for NSApp to initialise if we're not embedded (as in the
      * case of the Mozilla plugin).  We can tell whether we're embedded or not
-     * by examining the "drawable" value: if it's zero, we're running in the
+     * by examining the "drawable-gl" value: if it's zero, we're running in the
      * main Mac intf; if it's non-zero, we're embedded. */
-    if( value_drawable.i_int == 0 )
+    if( i_drawable_gl == 0 )
     {
         /* Wait for a MacOS X interface to appear. Timeout is 2 seconds. */
         for( i_timeout = 20 ; i_timeout-- ; )
@@ -796,7 +803,7 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
     return YES;
 }
 
-- (bool)setVout: (vout_thread_t *) p_arg_vout subView: (NSView *) view
+- (BOOL)setVout: (vout_thread_t *) p_arg_vout subView: (NSView *) view
                      frame: (NSRect *) s_arg_frame
 {
     BOOL b_return = [super setVout: p_arg_vout subView: view frame:s_arg_frame];