diff options
author | titer <[email protected]> | 2006-04-19 20:25:37 +0000 |
---|---|---|
committer | titer <[email protected]> | 2006-04-19 20:25:37 +0000 |
commit | 1d4535870a4212535c56f79f784c30a018a3e646 (patch) | |
tree | 750fb15df400421474e393563ce2e4edda9c9b96 /macosx/DriveDetector.m | |
parent | 72738ac78c91e391c1e03714f7142d325116d5a6 (diff) |
Show the name of the DVD instead of /dev/rdiskX
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@64 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx/DriveDetector.m')
-rw-r--r-- | macosx/DriveDetector.m | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/macosx/DriveDetector.m b/macosx/DriveDetector.m index 26958a964..61f722960 100644 --- a/macosx/DriveDetector.m +++ b/macosx/DriveDetector.m @@ -11,6 +11,7 @@ #include <IOKit/storage/IODVDMedia.h> #include "DriveDetector.h" +#include "hb.h" @interface DriveDetector (Private) @@ -22,7 +23,7 @@ - (void) dealloc { - [fTimer invalidate]; + [fDrives release]; [super dealloc]; } @@ -32,8 +33,13 @@ fSelector = selector; fCount = -1; - fDrives = [[NSMutableArray alloc] initWithCapacity: 1]; + fDrives = [[NSMutableDictionary alloc] initWithCapacity: 1]; + return self; +} + +- (void) run +{ /* Set up a timer to check devices every second */ fTimer = [NSTimer scheduledTimerWithTimeInterval: 1.0 target: self selector: @selector( detectTimer: ) userInfo: nil repeats: YES]; @@ -42,8 +48,11 @@ /* Do a first update right away */ [fTimer fire]; +} - return self; +- (void) stop +{ + [fTimer invalidate]; } - (void) detectTimer: (NSTimer *) timer @@ -82,6 +91,7 @@ next_media = IOIteratorNext( media_iterator ); if( next_media ) { + char * name; char psz_buf[0x32]; size_t dev_path_length; CFTypeRef str_bsd_path; @@ -106,7 +116,11 @@ sizeof(psz_buf) - dev_path_length, kCFStringEncodingASCII ) ) { - [fDrives addObject: [NSString stringWithCString: psz_buf]]; + if( ( name = hb_dvd_name( psz_buf ) ) ) + { + [fDrives setObject: [NSString stringWithCString: psz_buf] + forKey: [NSString stringWithCString: name]]; + } } CFRelease( str_bsd_path ); |