summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--macosx/DriveDetector.h23
-rw-r--r--macosx/DriveDetector.m145
-rw-r--r--macosx/HBDVDDetector.m (renamed from macosx/HBDriveDetector.m)0
-rw-r--r--macosx/HandBrake.xcodeproj/project.pbxproj18
4 files changed, 4 insertions, 182 deletions
diff --git a/macosx/DriveDetector.h b/macosx/DriveDetector.h
deleted file mode 100644
index 468f779db..000000000
--- a/macosx/DriveDetector.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/* DriveDetector.h $
-
- This file is part of the HandBrake source code.
- Homepage: <http://handbrake.m0k.org/>.
- It may be used under the terms of the GNU General Public License. */
-
-#import <Cocoa/Cocoa.h>
-
-@interface DriveDetector : NSObject
-{
- id fTarget;
- SEL fSelector;
-
- int fCount;
- NSMutableDictionary * fDrives;
- NSTimer * fTimer;
-}
-
-- (id) initWithCallback: (id) target selector: (SEL) selector;
-- (void) run;
-- (void) stop;
-
-@end
diff --git a/macosx/DriveDetector.m b/macosx/DriveDetector.m
deleted file mode 100644
index b79e969de..000000000
--- a/macosx/DriveDetector.m
+++ /dev/null
@@ -1,145 +0,0 @@
-/* DriveDetector.m $
-
- This file is part of the HandBrake source code.
- Homepage: <http://handbrake.m0k.org/>.
- It may be used under the terms of the GNU General Public License. */
-
-#include <paths.h>
-#include <IOKit/IOKitLib.h>
-#include <IOKit/IOBSD.h>
-#include <IOKit/storage/IOMedia.h>
-#include <IOKit/storage/IODVDMedia.h>
-
-#include "DriveDetector.h"
-#include "hb.h"
-
-@interface DriveDetector (Private)
-
-- (void) detectTimer: (NSTimer *) timer;
-
-@end
-
-@implementation DriveDetector
-
-- (void) dealloc
-{
- [fDrives release];
- [super dealloc];
-}
-
-- (id) initWithCallback: (id) target selector: (SEL) selector
-{
- fTarget = target;
- fSelector = selector;
-
- fCount = -1;
- fDrives = [[NSMutableDictionary alloc] initWithCapacity: 1];
-
- return self;
-}
-
-- (void) run
-{
- if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DisableDvdAutoDetect"] == 0)
- {
- /* Set up a timer to check devices every second */
- fTimer = [NSTimer scheduledTimerWithTimeInterval: 1.0 target: self
- selector: @selector( detectTimer: ) userInfo: nil repeats: YES];
- [[NSRunLoop currentRunLoop] addTimer: fTimer forMode:
- NSModalPanelRunLoopMode];
-
- /* Do a first update right away */
- [fTimer fire];
- }
-}
-
-- (void) stop
-{
- [fTimer invalidate];
-}
-
-- (void) detectTimer: (NSTimer *) timer
-{
- /* Scan DVD drives (stolen from VLC) */
- io_object_t next_media;
- mach_port_t master_port;
- kern_return_t kern_result;
- io_iterator_t media_iterator;
- CFMutableDictionaryRef classes_to_match;
-
- kern_result = IOMasterPort( MACH_PORT_NULL, &master_port );
- if( kern_result != KERN_SUCCESS )
- {
- return;
- }
-
- classes_to_match = IOServiceMatching( kIODVDMediaClass );
- if( classes_to_match == NULL )
- {
- return;
- }
-
- CFDictionarySetValue( classes_to_match, CFSTR( kIOMediaEjectableKey ),
- kCFBooleanTrue );
-
- kern_result = IOServiceGetMatchingServices( master_port,
- classes_to_match, &media_iterator );
- if( kern_result != KERN_SUCCESS )
- {
- return;
- }
-
- [fDrives removeAllObjects];
-
- next_media = IOIteratorNext( media_iterator );
- if( next_media )
- {
- char * name;
- char psz_buf[0x32];
- size_t dev_path_length;
- CFTypeRef str_bsd_path;
- do
- {
- str_bsd_path =
- IORegistryEntryCreateCFProperty( next_media,
- CFSTR( kIOBSDNameKey ),
- kCFAllocatorDefault,
- 0 );
- if( str_bsd_path == NULL )
- {
- IOObjectRelease( next_media );
- continue;
- }
-
- snprintf( psz_buf, sizeof(psz_buf), "%s%c", _PATH_DEV, 'r' );
- dev_path_length = strlen( psz_buf );
-
- if( CFStringGetCString( (CFStringRef) str_bsd_path,
- (char*)&psz_buf + dev_path_length,
- sizeof(psz_buf) - dev_path_length,
- kCFStringEncodingASCII ) )
- {
- if( ( name = hb_dvd_name( psz_buf ) ) )
- {
- [fDrives setObject: [NSString stringWithCString: psz_buf]
- forKey: [NSString stringWithCString: name]];
- }
- }
-
- CFRelease( str_bsd_path );
-
- IOObjectRelease( next_media );
-
- } while( ( next_media = IOIteratorNext( media_iterator ) ) );
- }
-
- IOObjectRelease( media_iterator );
-
- if( [fDrives count] != fCount )
- {
- [fTarget performSelector: fSelector withObject: fDrives];
- fCount = [fDrives count];
- }
-}
-
-@end
diff --git a/macosx/HBDriveDetector.m b/macosx/HBDVDDetector.m
index 2b57237d9..2b57237d9 100644
--- a/macosx/HBDriveDetector.m
+++ b/macosx/HBDVDDetector.m
diff --git a/macosx/HandBrake.xcodeproj/project.pbxproj b/macosx/HandBrake.xcodeproj/project.pbxproj
index 1801a9285..ba993f884 100644
--- a/macosx/HandBrake.xcodeproj/project.pbxproj
+++ b/macosx/HandBrake.xcodeproj/project.pbxproj
@@ -83,10 +83,7 @@
4D1EA2F60993B0CA00FDC1A2 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
4D1EA3010993B13700FDC1A2 /* Express.nib in Resources */ = {isa = PBXBuildFile; fileRef = 4D1EA3000993B13700FDC1A2 /* Express.nib */; };
4D1EA31C0993B24700FDC1A2 /* ExpressController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D1EA31B0993B24700FDC1A2 /* ExpressController.m */; };
- 4D2AE78B09CCB24C007E18F6 /* DriveDetector.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D2AE78909CCB24C007E18F6 /* DriveDetector.m */; };
4D2AEA1A09CCB332007E18F6 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4DEB2024052B055F00C39CA9 /* IOKit.framework */; };
- 4D2AEA2909CCB8F9007E18F6 /* DriveDetector.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D2AE78909CCB24C007E18F6 /* DriveDetector.m */; };
- 4D2AEA2A09CCB8FC007E18F6 /* DriveDetector.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D2AE78A09CCB24C007E18F6 /* DriveDetector.h */; };
4D3ECC2709A4917000B2E45F /* WhiteBox.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D3ECC2609A4917000B2E45F /* WhiteBox.m */; };
4DD93F8F082036E8008E1322 /* Controller.h in Headers */ = {isa = PBXBuildFile; fileRef = 4DF3C8CB052889CD00A80101 /* Controller.h */; };
4DD93F90082036E8008E1322 /* PictureGLView.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D85758F052B78E300C39CA9 /* PictureGLView.h */; };
@@ -125,7 +122,7 @@
A29E05800BE1283E000533F5 /* Growl.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A29E057F0BE1283E000533F5 /* Growl.framework */; };
A29E058B0BE12889000533F5 /* Growl.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = A29E057F0BE1283E000533F5 /* Growl.framework */; };
A2A1EC310C76C35E00827E0D /* HBDVDDetector.h in Headers */ = {isa = PBXBuildFile; fileRef = A2A1EC300C76C35E00827E0D /* HBDVDDetector.h */; };
- A2A1EC3A0C76C58400827E0D /* HBDriveDetector.m in Sources */ = {isa = PBXBuildFile; fileRef = A2A1EC390C76C58400827E0D /* HBDriveDetector.m */; };
+ A2A1EC3A0C76C58400827E0D /* HBDVDDetector.m in Sources */ = {isa = PBXBuildFile; fileRef = A2A1EC390C76C58400827E0D /* HBDVDDetector.m */; };
A2DFC66E0C6196D900E66E89 /* actionWidget.png in Resources */ = {isa = PBXBuildFile; fileRef = A2DFC66C0C6196D900E66E89 /* actionWidget.png */; };
A2DFC66F0C6196D900E66E89 /* actionWidgetPressed.png in Resources */ = {isa = PBXBuildFile; fileRef = A2DFC66D0C6196D900E66E89 /* actionWidgetPressed.png */; };
A2DFC6750C6197C600E66E89 /* MVMenuButton.h in Headers */ = {isa = PBXBuildFile; fileRef = A2DFC6740C6197C600E66E89 /* MVMenuButton.h */; };
@@ -234,8 +231,6 @@
4D1EA31B0993B24700FDC1A2 /* ExpressController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = ExpressController.m; sourceTree = "<group>"; };
4D1FD381073D19CE00E46515 /* PictureController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PictureController.h; sourceTree = "<group>"; };
4D1FD382073D19CE00E46515 /* PictureController.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = PictureController.mm; sourceTree = "<group>"; };
- 4D2AE78909CCB24C007E18F6 /* DriveDetector.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = DriveDetector.m; sourceTree = "<group>"; };
- 4D2AE78A09CCB24C007E18F6 /* DriveDetector.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DriveDetector.h; sourceTree = "<group>"; };
4D3ECC2509A4917000B2E45F /* WhiteBox.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WhiteBox.h; sourceTree = "<group>"; };
4D3ECC2609A4917000B2E45F /* WhiteBox.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = WhiteBox.m; sourceTree = "<group>"; };
4D85758E052B78E300C39CA9 /* PictureGLView.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = PictureGLView.mm; sourceTree = "<group>"; };
@@ -267,7 +262,7 @@
A28468670C5A43D900EF9A98 /* Disc.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = Disc.tiff; sourceTree = "<group>"; };
A29E057F0BE1283E000533F5 /* Growl.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Growl.framework; sourceTree = "<group>"; };
A2A1EC300C76C35E00827E0D /* HBDVDDetector.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HBDVDDetector.h; sourceTree = "<group>"; };
- A2A1EC390C76C58400827E0D /* HBDriveDetector.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = HBDriveDetector.m; sourceTree = "<group>"; };
+ A2A1EC390C76C58400827E0D /* HBDVDDetector.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = HBDVDDetector.m; sourceTree = "<group>"; };
A2DFC66C0C6196D900E66E89 /* actionWidget.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = actionWidget.png; sourceTree = "<group>"; };
A2DFC66D0C6196D900E66E89 /* actionWidgetPressed.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = actionWidgetPressed.png; sourceTree = "<group>"; };
A2DFC6740C6197C600E66E89 /* MVMenuButton.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MVMenuButton.h; sourceTree = "<group>"; };
@@ -460,12 +455,10 @@
4DD27BA607C0065C0023D231 /* QueueController.mm */,
4D3ECC2509A4917000B2E45F /* WhiteBox.h */,
4D3ECC2609A4917000B2E45F /* WhiteBox.m */,
- 4D2AE78909CCB24C007E18F6 /* DriveDetector.m */,
- 4D2AE78A09CCB24C007E18F6 /* DriveDetector.h */,
593034E90BBA39A100172349 /* ChapterTitles.h */,
593034EA0BBA39A100172349 /* ChapterTitles.m */,
A2A1EC300C76C35E00827E0D /* HBDVDDetector.h */,
- A2A1EC390C76C58400827E0D /* HBDriveDetector.m */,
+ A2A1EC390C76C58400827E0D /* HBDVDDetector.m */,
253885FF0BFE0A5B0064E995 /* HBOutputRedirect.h */,
253886000BFE0A5B0064E995 /* HBOutputRedirect.m */,
253886150BFE0C160064E995 /* HBOutputPanelController.h */,
@@ -531,7 +524,6 @@
4DD93F91082036E8008E1322 /* ScanController.h in Headers */,
4DD93F92082036E8008E1322 /* PictureController.h in Headers */,
4DD93F93082036E8008E1322 /* QueueController.h in Headers */,
- 4D2AEA2A09CCB8FC007E18F6 /* DriveDetector.h in Headers */,
A2A1EC310C76C35E00827E0D /* HBDVDDetector.h in Headers */,
253886010BFE0A5B0064E995 /* HBOutputRedirect.h in Headers */,
253886170BFE0C160064E995 /* HBOutputPanelController.h in Headers */,
@@ -790,7 +782,6 @@
4D1EA2EA0993B09A00FDC1A2 /* main.mm in Sources */,
4D1EA31C0993B24700FDC1A2 /* ExpressController.m in Sources */,
4D3ECC2709A4917000B2E45F /* WhiteBox.m in Sources */,
- 4D2AE78B09CCB24C007E18F6 /* DriveDetector.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -805,8 +796,7 @@
4DD93F9D082036E8008E1322 /* ScanController.mm in Sources */,
4DD93F9E082036E8008E1322 /* PictureController.mm in Sources */,
4DD93F9F082036E8008E1322 /* QueueController.mm in Sources */,
- 4D2AEA2909CCB8F9007E18F6 /* DriveDetector.m in Sources */,
- A2A1EC3A0C76C58400827E0D /* HBDriveDetector.m in Sources */,
+ A2A1EC3A0C76C58400827E0D /* HBDVDDetector.m in Sources */,
253886020BFE0A5B0064E995 /* HBOutputRedirect.m in Sources */,
253886180BFE0C160064E995 /* HBOutputPanelController.m in Sources */,
25DE1FB70C169A0C00F01FC8 /* HBPreferencesController.m in Sources */,