[vlc-devel] commit: macosx/framework: Delay sleeping during playback. (Pierre d' Herbemont )

git version control git at videolan.org
Wed Sep 2 14:27:11 CEST 2009


vlc | branch: master | Pierre d'Herbemont <pdherbemont at free.fr> | Wed Sep  2 14:26:16 2009 +0200| [57c35cd281a816fe7ea1f411a5d2a95d4e6b8462] | committer: Pierre d'Herbemont 

macosx/framework: Delay sleeping during playback.

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

 projects/macosx/framework/Sources/VLCMediaPlayer.m |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/projects/macosx/framework/Sources/VLCMediaPlayer.m b/projects/macosx/framework/Sources/VLCMediaPlayer.m
index 493b471..982dc87 100644
--- a/projects/macosx/framework/Sources/VLCMediaPlayer.m
+++ b/projects/macosx/framework/Sources/VLCMediaPlayer.m
@@ -32,6 +32,9 @@
 # include "config.h"
 #endif
 
+/* prevent system sleep */
+#import <CoreServices/CoreServices.h>
+
 #include <vlc/vlc.h>
 
 /* Notification Messages */
@@ -651,8 +654,16 @@ static const VLCMediaPlayerState libvlc_to_local_state[] =
     [self didChangeValueForKey:@"time"];
 }
 
+- (void)delaySleep
+{
+    UpdateSystemActivity(UsrActivity);
+}
+
 - (void)mediaPlayerPositionChanged:(NSNumber *)newPosition
 {
+    // This seems to be the most relevant place to delay sleeping and screen saver.
+    [self delaySleep];
+
     [self willChangeValueForKey:@"position"];
     position = [newPosition floatValue];
     [self didChangeValueForKey:@"position"];
@@ -664,4 +675,5 @@ static const VLCMediaPlayerState libvlc_to_local_state[] =
     cachedState = [newState intValue];
     [self didChangeValueForKey:@"state"];
 }
+
 @end




More information about the vlc-devel mailing list