2
2
* open.m: Open dialogues for VLC's MacOS X port
3
3
*****************************************************************************
4
4
* Copyright (C) 2002-2012 VLC authors and VideoLAN
5
* $Id: b9fa3618fff62563e0852483d5c62d72d6ccd22d $
5
* $Id: 028703a4fb7c4b476d1617e9a3c2321fcf28ab82 $
7
7
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
8
8
* Christophe Massiot <massiot@via.ecp.fr>
53
53
NSArray *qtkvideoDevices;
54
54
#define setEyeTVUnconnected \
55
55
[o_capture_lbl setStringValue: _NS("No device is selected")]; \
56
[o_capture_long_lbl setStringValue: _NS("No device is selected.\n\nChoose available device in above pull-down menu\n.")]; \
56
[o_capture_long_lbl setStringValue: _NS("No device is selected.\n\nChoose available device in above pull-down menu.\n")]; \
57
57
[o_capture_lbl displayIfNeeded]; \
58
58
[o_capture_long_lbl displayIfNeeded]; \
59
59
[self showCaptureView: o_capture_label_view]
709
709
GetVolParmsInfoBuffer volumeParms;
710
710
err = FSGetVolumeParms( actualVolume, &volumeParms, sizeof(volumeParms) );
711
if ( noErr != err ) {
712
msg_Err( p_intf, "error retrieving volume params, bailing out" );
713
NSString *bsdName = [NSString stringWithUTF8String:(char *)volumeParms.vMDeviceID];
714
return [NSString stringWithFormat:@"/dev/r%@", bsdName];
716
NSString *bsdName = [NSString stringWithUTF8String:(char *)volumeParms.vMDeviceID];
717
return [NSString stringWithFormat:@"/dev/r%@", bsdName];
720
720
- (char *)getVolumeTypeFromMountPath:(NSString *)mountPath
768
768
// NSFileManager is not thread-safe, don't use defaultManager outside of the main thread
769
769
NSFileManager * fm = [[NSFileManager alloc] init];
770
NSArray * topLevelItems;
771
topLevelItems = [fm subpathsOfDirectoryAtPath: mountPath error: NULL];
771
NSArray *dirContents = [fm contentsOfDirectoryAtPath:mountPath error:nil];
772
for (int i = 0; i < [dirContents count]; i++)
774
NSString *currentFile = [dirContents objectAtIndex:i];
775
NSString *fullPath = [mountPath stringByAppendingPathComponent:currentFile];
778
if ([fm fileExistsAtPath:fullPath isDirectory:&isDir] && isDir)
780
if ([currentFile caseInsensitiveCompare:@"SVCD"] == NSOrderedSame)
782
returnValue = kVLCMediaSVCD;
785
if ([currentFile caseInsensitiveCompare:@"VCD"] == NSOrderedSame)
787
returnValue = kVLCMediaVCD;
790
if ([currentFile caseInsensitiveCompare:@"BDMV"] == NSOrderedSame)
792
returnValue = kVLCMediaBDMVFolder;
795
if ([currentFile caseInsensitiveCompare:@"VIDEO_TS"] == NSOrderedSame)
797
returnValue = kVLCMediaVideoTSFolder;
774
NSUInteger itemCount = [topLevelItems count];
775
for (int i = 0; i < itemCount; i++) {
776
if([[topLevelItems objectAtIndex:i] rangeOfString:@"SVCD"].location != NSNotFound) {
777
returnValue = kVLCMediaSVCD;
780
if([[topLevelItems objectAtIndex:i] rangeOfString:@"VCD"].location != NSNotFound) {
781
returnValue = kVLCMediaVCD;
786
806
returnValue = kVLCMediaVideoTSFolder;
872
892
[o_disc_selector_pop setHidden: NO];
894
// select newly added media folder
895
if (o_notification && [[o_notification name] isEqualToString:@"VLCNewMediaFolderNotification"])
896
[o_disc_selector_pop selectItemAtIndex: [[o_disc_selector_pop itemArray] count] - 1];
874
898
[self showSelectedOpticalDisc];
903
927
if ([o_path length] > 0 )
905
929
[o_specialMediaFolders addObject: o_path];
906
[self scanOpticalMedia: nil];
930
[self scanOpticalMedia: [NSNotification notificationWithName:@"VLCNewMediaFolderNotification" object:nil]];
911
935
- (IBAction)dvdreadOptionChanged:(id)sender
937
NSString *o_device_path = [o_opticalDevices objectAtIndex: [o_disc_selector_pop indexOfSelectedItem]];
938
char *diskType = [self getVolumeTypeFromMountPath:o_device_path];
940
NSString *pathToOpen;
941
if (diskType == kVLCMediaVideoTSFolder)
942
pathToOpen = o_device_path;
944
pathToOpen = [self getBSDNodeFromMountPath: o_device_path];
913
946
if (sender == o_disc_dvdwomenus_enablemenus_btn) {
914
947
b_nodvdmenus = NO;
915
[self setMRL: [NSString stringWithFormat: @"dvdnav://%@", [self getBSDNodeFromMountPath:[o_opticalDevices objectAtIndex: [o_disc_selector_pop indexOfSelectedItem]]]]];
948
[self setMRL: [NSString stringWithFormat: @"dvdnav://%@", pathToOpen]];
916
949
[self showOpticalMediaView: o_disc_dvd_view withIcon: [o_currentOpticalMediaIconView image]];
930
963
if (sender == o_disc_dvdwomenus_chapter_stp)
931
964
[o_disc_dvdwomenus_chapter setIntValue: [o_disc_dvdwomenus_chapter_stp intValue]];
933
[self setMRL: [NSString stringWithFormat: @"dvdread://%@#%i:%i-", [self getBSDNodeFromMountPath:[o_opticalDevices objectAtIndex: [o_disc_selector_pop indexOfSelectedItem]]], [o_disc_dvdwomenus_title intValue], [o_disc_dvdwomenus_chapter intValue]]];
966
[self setMRL: [NSString stringWithFormat: @"dvdread://%@#%i:%i-", pathToOpen, [o_disc_dvdwomenus_title intValue], [o_disc_dvdwomenus_chapter intValue]]];
936
969
- (IBAction)vcdOptionChanged:(id)sender