[vlc-commits] macosx: avoid unnecessarily early loading of open panel nib

David Fuhrmann git at videolan.org
Sat Oct 18 13:23:03 CEST 2014


vlc/vlc-2.2 | branch: master | David Fuhrmann <dfuhrmann at videolan.org> | Thu Oct  2 17:42:32 2014 +0200| [4812b7dd546fdf0d54441f4e2927dd119c3acb6a] | committer: David Fuhrmann

macosx: avoid unnecessarily early loading of open panel nib

Loading the open nib can take some significant time, due to audio/
video devices enumeration.

refs #12123

(cherry picked from commit 640b974d52785d5ae215c1cfeb46fdd5bc085231)
Signed-off-by: David Fuhrmann <dfuhrmann at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=4812b7dd546fdf0d54441f4e2927dd119c3acb6a
---

 modules/gui/macosx/open.h     |    6 ++++--
 modules/gui/macosx/open.m     |    8 ++++----
 modules/gui/macosx/playlist.m |   11 +++++------
 3 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/modules/gui/macosx/open.h b/modules/gui/macosx/open.h
index ee7c68a..3b7886a 100644
--- a/modules/gui/macosx/open.h
+++ b/modules/gui/macosx/open.h
@@ -273,8 +273,10 @@
 - (IBAction)openSpecialMediaFolder:(id)sender;
 - (IBAction)dvdreadOptionChanged:(id)sender;
 - (IBAction)vcdOptionChanged:(id)sender;
-- (NSString *)getVolumeTypeFromMountPath:(NSString *)mountPath;
-- (NSString *)getBSDNodeFromMountPath:(NSString *)mountPath;
+
+// static helper functions
++ (NSString *)getVolumeTypeFromMountPath:(NSString *)mountPath;
++ (NSString *)getBSDNodeFromMountPath:(NSString *)mountPath;
 
 - (void)openNet;
 - (IBAction)openNetModeChanged:(id)sender;
diff --git a/modules/gui/macosx/open.m b/modules/gui/macosx/open.m
index 9e3e538..7cbe463 100644
--- a/modules/gui/macosx/open.m
+++ b/modules/gui/macosx/open.m
@@ -825,7 +825,7 @@ static VLCOpen *_o_sharedMainInstance = nil;
     [[[o_tabview tabViewItemAtIndex: [o_tabview indexOfTabViewItemWithIdentifier:@"optical"]] view] displayIfNeeded];
 }
 
-- (NSString *) getBSDNodeFromMountPath:(NSString *)mountPath
++ (NSString *) getBSDNodeFromMountPath:(NSString *)mountPath
 {
     OSStatus err;
     FSRef ref;
@@ -860,7 +860,7 @@ static VLCOpen *_o_sharedMainInstance = nil;
     return @"";
 }
 
-- (NSString *)getVolumeTypeFromMountPath:(NSString *)mountPath
++ (NSString *)getVolumeTypeFromMountPath:(NSString *)mountPath
 {
     OSStatus err;
     FSRef ref;
@@ -1003,7 +1003,7 @@ out:
 
 - (NSDictionary *)scanPath:(NSString *)o_path
 {
-    NSString *o_type = [self getVolumeTypeFromMountPath:o_path];
+    NSString *o_type = [VLCOpen getVolumeTypeFromMountPath:o_path];
     NSImage *o_image = [[NSWorkspace sharedWorkspace] iconForFile: o_path];
     NSString *o_device_path;
 
@@ -1020,7 +1020,7 @@ out:
         [o_type isEqualToString: kVLCMediaUnknown])
         o_device_path = o_path;
     else
-        o_device_path = [self getBSDNodeFromMountPath:o_path];
+        o_device_path = [VLCOpen getBSDNodeFromMountPath:o_path];
 
     return [NSDictionary dictionaryWithObjectsAndKeys: o_path, @"path",
                                                 o_device_path, @"devicePath",
diff --git a/modules/gui/macosx/playlist.m b/modules/gui/macosx/playlist.m
index e6d777b..88c97b2 100644
--- a/modules/gui/macosx/playlist.m
+++ b/modules/gui/macosx/playlist.m
@@ -1066,21 +1066,20 @@
     if ([[NSFileManager defaultManager] fileExistsAtPath:o_path isDirectory:&b_dir] && b_dir &&
         [[NSWorkspace sharedWorkspace] getFileSystemInfoForPath:o_path isRemovable: &b_rem
                                                      isWritable:&b_writable isUnmountable:NULL description:NULL type:NULL] && b_rem && !b_writable && [o_nsurl isFileURL]) {
-        id o_vlc_open = [[VLCMain sharedInstance] open];
 
-        NSString *diskType = [o_vlc_open getVolumeTypeFromMountPath: o_path];
+        NSString *diskType = [VLCOpen getVolumeTypeFromMountPath: o_path];
         msg_Dbg(p_intf, "detected optical media of type %s in the file input", [diskType UTF8String]);
 
         if ([diskType isEqualToString: kVLCMediaDVD])
-            o_uri = [NSString stringWithFormat: @"dvdnav://%@", [o_vlc_open getBSDNodeFromMountPath: o_path]];
+            o_uri = [NSString stringWithFormat: @"dvdnav://%@", [VLCOpen getBSDNodeFromMountPath: o_path]];
         else if ([diskType isEqualToString: kVLCMediaVideoTSFolder])
             o_uri = [NSString stringWithFormat: @"dvdnav://%@", o_path];
         else if ([diskType isEqualToString: kVLCMediaAudioCD])
-            o_uri = [NSString stringWithFormat: @"cdda://%@", [o_vlc_open getBSDNodeFromMountPath: o_path]];
+            o_uri = [NSString stringWithFormat: @"cdda://%@", [VLCOpen getBSDNodeFromMountPath: o_path]];
         else if ([diskType isEqualToString: kVLCMediaVCD])
-            o_uri = [NSString stringWithFormat: @"vcd://%@#0:0", [o_vlc_open getBSDNodeFromMountPath: o_path]];
+            o_uri = [NSString stringWithFormat: @"vcd://%@#0:0", [VLCOpen getBSDNodeFromMountPath: o_path]];
         else if ([diskType isEqualToString: kVLCMediaSVCD])
-            o_uri = [NSString stringWithFormat: @"vcd://%@@0:0", [o_vlc_open getBSDNodeFromMountPath: o_path]];
+            o_uri = [NSString stringWithFormat: @"vcd://%@@0:0", [VLCOpen getBSDNodeFromMountPath: o_path]];
         else if ([diskType isEqualToString: kVLCMediaBD] || [diskType isEqualToString: kVLCMediaBDMVFolder])
             o_uri = [NSString stringWithFormat: @"bluray://%@", o_path];
         else



More information about the vlc-commits mailing list