summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordynaflash <[email protected]>2009-09-24 20:34:14 +0000
committerdynaflash <[email protected]>2009-09-24 20:34:14 +0000
commitd4dfa80f7c75c0d21d442c74b00494cda6174de3 (patch)
tree25b9f61ff1bdc2570cd259bab392c448ad547476
parent34a52465b44f6997047809ea9f123587831cd535 (diff)
MacGui: Allow and check for 64 bit vlc. Match HandBrake architecture to VLC architecture and warn appropriately.
- This allows 64 bit HB and 64 bit vlc to work harmoniously. - No vlc and architecture mistmatches link to http://www.videolan.org/vlc/download-macosx.html instead of the main vlc page where only the 32 bit version of vlc is listed for download for mac. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2837 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r--macosx/Controller.m140
1 files changed, 115 insertions, 25 deletions
diff --git a/macosx/Controller.m b/macosx/Controller.m
index da45caef3..cd0ef7342 100644
--- a/macosx/Controller.m
+++ b/macosx/Controller.m
@@ -1515,34 +1515,21 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It
if( [detector isVideoDVD] )
{
+ int hb_arch;
+#if defined( __LP64__ )
+ /* we are 64 bit */
+ hb_arch = 64;
+#else
+ /* we are 32 bit */
+ hb_arch = 32;
+#endif
+
+
// The chosen path was actually on a DVD, so use the raw block
// device path instead.
path = [detector devicePath];
[self writeToActivityLog: "trying to open a physical dvd at: %s", [scanPath UTF8String]];
-#if defined( __LP64__ )
- /* If we are 64 bit, we cannot read encrypted dvd's as vlc is 32 bit only */
- cancelScanDecrypt = 1;
- [self writeToActivityLog: "64 bit mode cannot read dvd's, scan cancelled"];
- /*On Screen Notification*/
- int status;
- NSBeep();
- status = NSRunAlertPanel(@"64-bit HandBrake cannot read encrypted dvds!",@"", @"Cancel Scan", @"Attempt Scan Anyway", nil);
- [NSApp requestUserAttention:NSCriticalRequest];
-
- if (status == NSAlertDefaultReturn)
- {
- /* User chose to cancel the scan */
- [self writeToActivityLog: "cannot open physical dvd , scan cancelled"];
- cancelScanDecrypt = 1;
- }
- else
- {
- [self writeToActivityLog: "user overrode 64-bit warning trying to open physical dvd without decryption"];
- cancelScanDecrypt = 0;
- }
-
-#else
/* lets check for vlc here to make sure we have a dylib available to use for decrypting */
NSString *vlcPath = @"/Applications/VLC.app/Contents/MacOS/lib/libdvdcss.2.dylib";
NSFileManager * fileManager = [NSFileManager defaultManager];
@@ -1558,7 +1545,7 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It
if (status == NSAlertDefaultReturn)
{
/* User chose to go download vlc (as they rightfully should) so we send them to the vlc site */
- [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://www.videolan.org/"]];
+ [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://www.videolan.org/vlc/download-macosx.html"]];
}
else if (status == NSAlertAlternateReturn)
{
@@ -1578,7 +1565,110 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It
/* VLC was found in /Applications so all is well, we can carry on using vlc's libdvdcss.dylib for decrypting if needed */
[self writeToActivityLog: "VLC app found for decrypting physical dvd"];
}
-#endif
+ /* test for architecture of the vlc app */
+ NSArray *vlc_architecturesArray = [[NSBundle bundleWithPath:@"/Applications/VLC.app"] executableArchitectures];
+ BOOL vlcIntel32bit = NO;
+ BOOL vlcIntel64bit = NO;
+ BOOL vlcPPC32bit = NO;
+ BOOL vlcPPC64bit = NO;
+ /* check the available architectures for vlc and note accordingly */
+ NSEnumerator *enumerator = [vlc_architecturesArray objectEnumerator];
+ id tempObject;
+ while (tempObject = [enumerator nextObject])
+ {
+
+ if ([tempObject intValue] == NSBundleExecutableArchitectureI386)
+ {
+ vlcIntel32bit = YES;
+ }
+ if ([tempObject intValue] == NSBundleExecutableArchitectureX86_64)
+ {
+ vlcIntel64bit = YES;
+ }
+ if ([tempObject intValue] == NSBundleExecutableArchitecturePPC)
+ {
+ vlcPPC32bit = YES;
+ }
+ if ([tempObject intValue] == NSBundleExecutableArchitecturePPC64)
+ {
+ vlcPPC64bit = YES;
+ }
+
+ }
+ /* Write vlc architecture findings to activity window */
+ if (vlcIntel32bit)
+ {
+ [self writeToActivityLog: " 32-Bit VLC app found for decrypting physical dvd"];
+ }
+ if (vlcIntel64bit)
+ {
+ [self writeToActivityLog: " 64-Bit VLC app found for decrypting physical dvd"];
+ }
+
+
+
+ if (hb_arch == 64 && !vlcIntel64bit && cancelScanDecrypt != 1)
+ {
+
+ /* we are 64 bit */
+
+ /* Appropriate VLC not found, so cancel */
+ cancelScanDecrypt = 1;
+ [self writeToActivityLog: "This version of HandBrake is 64 bit, 64 bit version of vlc not found, scan cancelled"];
+ /*On Screen Notification*/
+ int status;
+ NSBeep();
+ status = NSRunAlertPanel(@"This version of HandBrake is 64 bit, VLC found but not 64 bit!",@"", @"Cancel Scan", @"Attempt Scan Anyway", @"Get 64 bit VLC", nil);
+ [NSApp requestUserAttention:NSCriticalRequest];
+
+ if (status == NSAlertDefaultReturn)
+ {
+ /* User chose to cancel the scan */
+ [self writeToActivityLog: "cannot open physical dvd VLC found but not 64 bit, scan cancelled"];
+ cancelScanDecrypt = 1;
+ }
+ else if (status == NSAlertDefaultReturn)
+ {
+ [self writeToActivityLog: "user overrode 64-bit warning trying to open physical dvd without proper decryption"];
+ cancelScanDecrypt = 0;
+ }
+ else
+ {
+ /* User chose to go download vlc (as they rightfully should) so we send them to the vlc site */
+ [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://www.videolan.org/vlc/download-macosx.html"]];
+ }
+
+ }
+ else if (hb_arch == 32 && !vlcIntel32bit && cancelScanDecrypt != 1)
+ {
+ /* we are 32 bit */
+ /* Appropriate VLC not found, so cancel */
+ cancelScanDecrypt = 1;
+ [self writeToActivityLog: "This version of HandBrake is 32 bit, 32 bit version of vlc not found, scan cancelled"];
+ /*On Screen Notification*/
+ int status;
+ NSBeep();
+ status = NSRunAlertPanel(@"This version of HandBrake is 32 bit, VLC found but not 32 bit!",@"", @"Cancel Scan", @"Attempt Scan Anyway", @"Get 32 bit VLC", nil);
+ [NSApp requestUserAttention:NSCriticalRequest];
+
+ if (status == NSAlertDefaultReturn)
+ {
+ /* User chose to cancel the scan */
+ [self writeToActivityLog: "cannot open physical dvd VLC found but not 32 bit, scan cancelled"];
+ cancelScanDecrypt = 1;
+ }
+ else if (status == NSAlertDefaultReturn)
+ {
+ [self writeToActivityLog: "user overrode 32-bit warning trying to open physical dvd without proper decryption"];
+ cancelScanDecrypt = 0;
+ }
+ else
+ {
+ /* User chose to go download vlc (as they rightfully should) so we send them to the vlc site */
+ [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://www.videolan.org/vlc/download-macosx.html"]];
+ }
+
+ }
}
if (cancelScanDecrypt == 0)