[vlc-devel] commit: macosx: fixed IR Remote HID support ( Felix Paul Kühne )
git version control
git at videolan.org
Tue Oct 6 13:39:37 CEST 2009
vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Tue Oct 6 13:39:29 2009 +0200| [f556fb1661bc7646c449ef01ab30fea69f466c8e] | committer: Felix Paul Kühne
macosx: fixed IR Remote HID support
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f556fb1661bc7646c449ef01ab30fea69f466c8e
---
modules/gui/macosx/AppleRemote.m | 58 +++++++++++++++++++++++++------------
modules/gui/macosx/intf.m | 9 +++--
2 files changed, 44 insertions(+), 23 deletions(-)
diff --git a/modules/gui/macosx/AppleRemote.m b/modules/gui/macosx/AppleRemote.m
index 9790de2..6948184 100644
--- a/modules/gui/macosx/AppleRemote.m
+++ b/modules/gui/macosx/AppleRemote.m
@@ -72,18 +72,39 @@ const NSTimeInterval HOLD_RECOGNITION_TIME_INTERVAL=0.4;
hidDeviceInterface = NULL;
cookieToButtonMapping = [[NSMutableDictionary alloc] init];
- /* we're on Leopard and need to use a different set of cookies then we used to on Tiger and earlier */
- [cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonVolume_Plus] forKey:@"31_29_28_18_"];
- [cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonVolume_Minus] forKey:@"31_30_28_18_"];
- [cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonMenu] forKey:@"31_20_18_31_20_18_"];
- [cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonPlay] forKey:@"31_21_18_31_21_18_"];
- [cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonRight] forKey:@"31_22_18_31_22_18_"];
- [cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonLeft] forKey:@"31_23_18_31_23_18_"];
- [cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonRight_Hold] forKey:@"31_18_4_2_"];
- [cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonLeft_Hold] forKey:@"31_18_3_2_"];
- [cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonMenu_Hold] forKey:@"31_18_31_18_"];
- [cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonPlay_Sleep] forKey:@"35_31_18_35_31_18_"];
- [cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteControl_Switched] forKey:@"19_"];
+ if( NSAppKitVersionNumber < 1038.13 )
+ {
+ /* Leopard and early Snow Leopard Cookies */
+ msg_Dbg( VLCIntf, "using Leopard AR cookies" );
+ [cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonVolume_Plus] forKey:@"31_29_28_18_"];
+ [cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonVolume_Minus] forKey:@"31_30_28_18_"];
+ [cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonMenu] forKey:@"31_20_18_31_20_18_"];
+ [cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonPlay] forKey:@"31_21_18_31_21_18_"];
+ [cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonRight] forKey:@"31_22_18_31_22_18_"];
+ [cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonLeft] forKey:@"31_23_18_31_23_18_"];
+ [cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonRight_Hold] forKey:@"31_18_4_2_"];
+ [cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonLeft_Hold] forKey:@"31_18_3_2_"];
+ [cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonMenu_Hold] forKey:@"31_18_31_18_"];
+ [cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonPlay_Sleep] forKey:@"35_31_18_35_31_18_"];
+ [cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteControl_Switched] forKey:@"19_"];
+ }
+ else
+ {
+ /* current Snow Leopard cookies */
+ msg_Dbg( VLCIntf, "using Snow Leopard AR cookies" );
+ [cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonVolume_Plus] forKey:@"33_31_30_21_20_2_"];
+ [cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonVolume_Minus] forKey:@"33_32_30_21_20_2_"];
+ [cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonMenu] forKey:@"33_22_21_20_2_33_22_21_20_2_"];
+ [cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonPlay] forKey:@"33_23_21_20_2_33_23_21_20_2_"];
+ [cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonRight] forKey:@"33_24_21_20_2_33_24_21_20_2_"];
+ [cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonLeft] forKey:@"33_25_21_20_2_33_25_21_20_2_"];
+ [cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonRight_Hold] forKey:@"33_21_20_14_12_2_"];
+ [cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonLeft_Hold] forKey:@"33_21_20_13_12_2_"];
+ [cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonMenu_Hold] forKey:@"33_21_20_2_33_21_20_2_"];
+ [cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonPlay_Sleep] forKey:@"37_33_21_20_2_37_33_21_20_2_"];
+ [cookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteControl_Switched] forKey:@"19_"];
+ }
+
/* defaults */
[self setSimulatesPlusMinusHold: YES];
@@ -451,7 +472,7 @@ static AppleRemote* sharedInstance=nil;
[self handleEventWithCookieString: lastSubCookieString sumOfValues:0];
}
if ([cookieString length] > 0) {
- NSLog(@"Unknown button for cookiestring %@", cookieString);
+ msg_Warn( VLCIntf, "Unknown AR button for cookiestring %s", [cookieString UTF8String]);
}
}
}
@@ -504,7 +525,7 @@ static void QueueCallbackFunction(void* target, IOReturn result, void* refcon,
ioReturnValue = IOObjectGetClass(hidDevice, className);
if (ioReturnValue != kIOReturnSuccess) {
- NSLog(@"Error: Failed to get class name.");
+ msg_Err( VLCIntf, "Failed to get IOKit class name.");
return NULL;
}
@@ -519,7 +540,7 @@ static void QueueCallbackFunction(void* target, IOReturn result, void* refcon,
plugInResult = (*plugInInterface)->QueryInterface(plugInInterface, CFUUIDGetUUIDBytes(kIOHIDDeviceInterfaceID), (LPVOID) &hidDeviceInterface);
if (plugInResult != S_OK) {
- NSLog(@"Error: Couldn't create HID class device interface");
+ msg_Err( VLCIntf, "Couldn't create HID class device interface");
}
// Release
if (plugInInterface) (*plugInInterface)->Release(plugInInterface);
@@ -633,13 +654,13 @@ static void QueueCallbackFunction(void* target, IOReturn result, void* refcon,
(*queue)->start(queue);
return YES;
} else {
- NSLog(@"Error when setting event callout");
+ msg_Err( VLCIntf, "Error when setting event callout");
}
} else {
- NSLog(@"Error when creating async event source");
+ msg_Err( VLCIntf, "Error when creating async event source");
}
} else {
- NSLog(@"Error when opening device");
+ msg_Err( VLCIntf, "Error when opening HUD device");
}
}
return NO;
@@ -657,7 +678,6 @@ static void QueueCallbackFunction(void* target, IOReturn result, void* refcon,
}
- (void) dealloc {
- NSLog(@"Dealloc");
[applicationDelegate release];
[super dealloc];
}
diff --git a/modules/gui/macosx/intf.m b/modules/gui/macosx/intf.m
index 712031c..1d49df7 100644
--- a/modules/gui/macosx/intf.m
+++ b/modules/gui/macosx/intf.m
@@ -361,10 +361,6 @@ static VLCMain *_o_sharedMainInstance = nil;
i_lastShownVolume = -1;
- o_remote = [[AppleRemote alloc] init];
- [o_remote setClickCountEnabledButtons: kRemoteButtonPlay];
- [o_remote setDelegate: _o_sharedMainInstance];
-
o_eyetv = [[VLCEyeTVController alloc] init];
/* announce our launch to a potential eyetv plugin */
@@ -555,6 +551,11 @@ static VLCMain *_o_sharedMainInstance = nil;
name: NSControlTintDidChangeNotification
object: nil];
+ /* init Apple Remote support */
+ o_remote = [[AppleRemote alloc] init];
+ [o_remote setClickCountEnabledButtons: kRemoteButtonPlay];
+ [o_remote setDelegate: _o_sharedMainInstance];
+
/* yeah, we are done */
nib_main_loaded = TRUE;
}
More information about the vlc-devel
mailing list