[vlc-commits] macosx: change media type constants from char* to NSString*
David Fuhrmann
git at videolan.org
Sat Aug 25 00:45:51 CEST 2012
vlc | branch: master | David Fuhrmann <david.fuhrmann at googlemail.com> | Thu Aug 23 12:51:47 2012 +0200| [0308762a6cf2e211f4ea6ed8c64952156accf4d4] | committer: David Fuhrmann
macosx: change media type constants from char* to NSString*
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0308762a6cf2e211f4ea6ed8c64952156accf4d4
---
modules/gui/macosx/open.h | 18 +++++++++---------
modules/gui/macosx/open.m | 22 +++++++++++-----------
modules/gui/macosx/playlist.m | 16 ++++++++--------
3 files changed, 28 insertions(+), 28 deletions(-)
diff --git a/modules/gui/macosx/open.h b/modules/gui/macosx/open.h
index c67315d..3578576 100644
--- a/modules/gui/macosx/open.h
+++ b/modules/gui/macosx/open.h
@@ -24,14 +24,14 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
-#define kVLCMediaAudioCD "AudioCD"
-#define kVLCMediaDVD "DVD"
-#define kVLCMediaVCD "VCD"
-#define kVLCMediaSVCD "SVCD"
-#define kVLCMediaBD "Bluray"
-#define kVLCMediaVideoTSFolder "VIDEO_TS"
-#define kVLCMediaBDMVFolder "BDMV"
-#define kVLCMediaUnknown "Unknown"
+#define kVLCMediaAudioCD @"AudioCD"
+#define kVLCMediaDVD @"DVD"
+#define kVLCMediaVCD @"VCD"
+#define kVLCMediaSVCD @"SVCD"
+#define kVLCMediaBD @"Bluray"
+#define kVLCMediaVideoTSFolder @"VIDEO_TS"
+#define kVLCMediaBDMVFolder @"BDMV"
+#define kVLCMediaUnknown @"Unknown"
/*****************************************************************************
* Intf_Open interface
@@ -274,7 +274,7 @@
- (IBAction)openSpecialMediaFolder:(id)sender;
- (IBAction)dvdreadOptionChanged:(id)sender;
- (IBAction)vcdOptionChanged:(id)sender;
-- (char *)getVolumeTypeFromMountPath:(NSString *)mountPath;
+- (NSString *)getVolumeTypeFromMountPath:(NSString *)mountPath;
- (NSString *)getBSDNodeFromMountPath:(NSString *)mountPath;
- (void)openNet;
diff --git a/modules/gui/macosx/open.m b/modules/gui/macosx/open.m
index 9912c9f..24bc8a1 100644
--- a/modules/gui/macosx/open.m
+++ b/modules/gui/macosx/open.m
@@ -893,7 +893,7 @@ static VLCOpen *_o_sharedMainInstance = nil;
return @"";
}
-- (char *)getVolumeTypeFromMountPath:(NSString *)mountPath
+- (NSString *)getVolumeTypeFromMountPath:(NSString *)mountPath
{
OSStatus err;
FSRef ref;
@@ -930,7 +930,7 @@ static VLCOpen *_o_sharedMainInstance = nil;
matchingDict = IOBSDNameMatching(kIOMasterPortDefault, 0, volumeParms.vMDeviceID);
service = IOServiceGetMatchingService(kIOMasterPortDefault, matchingDict);
- char *returnValue;
+ NSString *returnValue;
if (IO_OBJECT_NULL != service) {
if (IOObjectConformsTo(service, kIOCDMediaClass)) {
returnValue = kVLCMediaAudioCD;
@@ -998,14 +998,14 @@ static VLCOpen *_o_sharedMainInstance = nil;
{
NSAutoreleasePool * o_pool = [[NSAutoreleasePool alloc] init];
- char *diskType = [self getVolumeTypeFromMountPath:o_opticalDevicePath];
+ NSString *diskType = [self getVolumeTypeFromMountPath:o_opticalDevicePath];
- if (diskType == kVLCMediaDVD || diskType == kVLCMediaVideoTSFolder)
+ if ([diskType isEqualToString: kVLCMediaDVD] || [diskType isEqualToString: kVLCMediaVideoTSFolder])
{
[o_disc_dvd_lbl setStringValue: [[NSFileManager defaultManager] displayNameAtPath:o_opticalDevicePath]];
[o_disc_dvdwomenus_lbl setStringValue: [o_disc_dvd_lbl stringValue]];
NSString *pathToOpen;
- if (diskType == kVLCMediaVideoTSFolder)
+ if ([diskType isEqualToString: kVLCMediaVideoTSFolder])
pathToOpen = o_opticalDevicePath;
else
pathToOpen = [self getBSDNodeFromMountPath: o_opticalDevicePath];
@@ -1017,26 +1017,26 @@ static VLCOpen *_o_sharedMainInstance = nil;
[self showOpticalMediaView: o_disc_dvdwomenus_view withIcon: [[NSWorkspace sharedWorkspace] iconForFile: o_opticalDevicePath]];
}
}
- else if (diskType == kVLCMediaAudioCD)
+ else if ([diskType isEqualToString: kVLCMediaAudioCD])
{
[o_disc_audiocd_lbl setStringValue: [[NSFileManager defaultManager] displayNameAtPath: o_opticalDevicePath]];
[o_disc_audiocd_trackcount_lbl setStringValue: [NSString stringWithFormat:_NS("%i tracks"), [[[NSFileManager defaultManager] subpathsOfDirectoryAtPath: o_opticalDevicePath error:NULL] count] - 1]]; // minus .TOC.plist
[self showOpticalMediaView: o_disc_audiocd_view withIcon: [[NSWorkspace sharedWorkspace] iconForFile: o_opticalDevicePath]];
[self setMRL: [NSString stringWithFormat: @"cdda://%@", [self getBSDNodeFromMountPath: o_opticalDevicePath]]];
}
- else if (diskType == kVLCMediaVCD)
+ else if ([diskType isEqualToString: kVLCMediaVCD])
{
[o_disc_vcd_lbl setStringValue: [[NSFileManager defaultManager] displayNameAtPath: o_opticalDevicePath]];
[self showOpticalMediaView: o_disc_vcd_view withIcon: [[NSWorkspace sharedWorkspace] iconForFile: o_opticalDevicePath]];
[self setMRL: [NSString stringWithFormat: @"vcd://%@#%i:%i", [self getBSDNodeFromMountPath: o_opticalDevicePath], [o_disc_vcd_title intValue], [o_disc_vcd_chapter intValue]]];
}
- else if (diskType == kVLCMediaSVCD)
+ else if ([diskType isEqualToString: kVLCMediaSVCD])
{
[o_disc_vcd_lbl setStringValue: [[NSFileManager defaultManager] displayNameAtPath: o_opticalDevicePath]];
[self showOpticalMediaView: o_disc_vcd_view withIcon: [[NSWorkspace sharedWorkspace] iconForFile: o_opticalDevicePath]];
[self setMRL: [NSString stringWithFormat: @"vcd://%@@%i:%i", [self getBSDNodeFromMountPath: o_opticalDevicePath], [o_disc_vcd_title intValue], [o_disc_vcd_chapter intValue]]];
}
- else if (diskType == kVLCMediaBD || diskType == kVLCMediaBDMVFolder)
+ else if ([diskType isEqualToString: kVLCMediaBD] || [diskType isEqualToString: kVLCMediaBDMVFolder])
{
[o_disc_bd_lbl setStringValue: [[NSFileManager defaultManager] displayNameAtPath: o_opticalDevicePath]];
[self showOpticalMediaView: o_disc_bd_view withIcon: [[NSWorkspace sharedWorkspace] iconForFile: o_opticalDevicePath]];
@@ -1117,10 +1117,10 @@ static VLCOpen *_o_sharedMainInstance = nil;
- (IBAction)dvdreadOptionChanged:(id)sender
{
NSString *o_device_path = [o_opticalDevices objectAtIndex: [o_disc_selector_pop indexOfSelectedItem]];
- char *diskType = [self getVolumeTypeFromMountPath:o_device_path];
+ NSString *diskType = [self getVolumeTypeFromMountPath:o_device_path];
NSString *pathToOpen;
- if (diskType == kVLCMediaVideoTSFolder)
+ if ([diskType isEqualToString: kVLCMediaVideoTSFolder])
pathToOpen = o_device_path;
else
pathToOpen = [self getBSDNodeFromMountPath: o_device_path];
diff --git a/modules/gui/macosx/playlist.m b/modules/gui/macosx/playlist.m
index 9d1fea5..64f5139 100644
--- a/modules/gui/macosx/playlist.m
+++ b/modules/gui/macosx/playlist.m
@@ -1085,30 +1085,30 @@
id o_vlc_open = [[VLCMain sharedInstance] open];
- char *diskType = [o_vlc_open getVolumeTypeFromMountPath: o_path];
- msg_Dbg( p_intf, "detected optical media of type '%s' in the file input", diskType );
+ NSString *diskType = [o_vlc_open getVolumeTypeFromMountPath: o_path];
+ msg_Dbg( p_intf, "detected optical media of type %s in the file input", [diskType UTF8String] );
- if (diskType == kVLCMediaDVD)
+ if ([diskType isEqualToString: kVLCMediaDVD])
{
o_uri = [NSString stringWithFormat: @"dvdnav://%@", [o_vlc_open getBSDNodeFromMountPath: o_path]];
}
- else if (diskType == kVLCMediaVideoTSFolder)
+ else if ([diskType isEqualToString: kVLCMediaVideoTSFolder])
{
o_uri = [NSString stringWithFormat: @"dvdnav://%@", o_path];
}
- else if (diskType == kVLCMediaAudioCD)
+ else if ([diskType isEqualToString: kVLCMediaAudioCD])
{
o_uri = [NSString stringWithFormat: @"cdda://%@", [o_vlc_open getBSDNodeFromMountPath: o_path]];
}
- else if (diskType == kVLCMediaVCD)
+ else if ([diskType isEqualToString: kVLCMediaVCD])
{
o_uri = [NSString stringWithFormat: @"vcd://%@#0:0", [o_vlc_open getBSDNodeFromMountPath: o_path]];
}
- else if (diskType == kVLCMediaSVCD)
+ else if ([diskType isEqualToString: kVLCMediaSVCD])
{
o_uri = [NSString stringWithFormat: @"vcd://%@@0:0", [o_vlc_open getBSDNodeFromMountPath: o_path]];
}
- else if (diskType == kVLCMediaBD || diskType == kVLCMediaBDMVFolder)
+ else if ([diskType isEqualToString: kVLCMediaBD] || [diskType isEqualToString: kVLCMediaBDMVFolder])
{
o_uri = [NSString stringWithFormat: @"bluray://%@", o_path];
}
More information about the vlc-commits
mailing list