diff options
-rw-r--r-- | TOOLS/osxbundle/mpv.app/Contents/Info.plist | 46 | ||||
-rw-r--r-- | osdep/macosx_application.m | 30 |
2 files changed, 40 insertions, 36 deletions
diff --git a/TOOLS/osxbundle/mpv.app/Contents/Info.plist b/TOOLS/osxbundle/mpv.app/Contents/Info.plist index 4661981803..4c9340d808 100644 --- a/TOOLS/osxbundle/mpv.app/Contents/Info.plist +++ b/TOOLS/osxbundle/mpv.app/Contents/Info.plist @@ -190,57 +190,31 @@ <key>CFBundleTypeRole</key> <string>Viewer</string> <key>CFBundleURLName</key> - <string>Real Time (Streaming) Protocol</string> + <string>Streaming Protocol</string> <key>CFBundleURLSchemes</key> <array> + <string>mms</string> + <string>mmst</string> + <string>http</string> + <string>httpproxy</string> <string>rtp</string> <string>rtsp</string> - </array> - </dict> - <dict> - <key>CFBundleTypeRole</key> - <string>Viewer</string> - <key>CFBundleURLName</key> - <string>File over HTTP/FTP/UDP</string> - <key>CFBundleURLSchemes</key> - <array> - <string>icyx</string> - <string>udp</string> <string>ftp</string> - <string>http_proxy</string> - <string>http</string> - </array> - </dict> - <dict> - <key>CFBundleTypeRole</key> - <string>Viewer</string> - <key>CFBundleURLName</key> - <string>Microsoft Media Services</string> - <key>CFBundleURLSchemes</key> - <array> - <string>mms</string> - </array> - </dict> - <dict> - <key>CFBundleTypeRole</key> - <string>Viewer</string> - <key>CFBundleURLName</key> - <string>Cuesheet</string> - <key>CFBundleURLSchemes</key> - <array> - <string>cue</string> + <string>udp</string> + <string>smb</string> </array> </dict> <dict> <key>CFBundleTypeRole</key> <string>Viewer</string> <key>CFBundleURLName</key> - <string>CD/DVD Media</string> + <string>CD/DVD/Bluray Media</string> <key>CFBundleURLSchemes</key> <array> - <string>dvdnav</string> + <string>cdda</string> <string>dvd</string> <string>vcd</string> + <string>bd</string> </array> </dict> </array> diff --git a/osdep/macosx_application.m b/osdep/macosx_application.m index fb20fbf2cc..7c5990d912 100644 --- a/osdep/macosx_application.m +++ b/osdep/macosx_application.m @@ -97,11 +97,25 @@ static NSString *escape_loadfile_name(NSString *input) handler:^(NSEvent *event) { return [self.eventsResponder handleKey:event]; }]; + + NSAppleEventManager *em = [NSAppleEventManager sharedAppleEventManager]; + [em setEventHandler:self + andSelector:@selector(getUrl:withReplyEvent:) + forEventClass:kInternetEventClass + andEventID:kAEGetURL]; } return self; } +- (void)dealloc +{ + NSAppleEventManager *em = [NSAppleEventManager sharedAppleEventManager]; + [em removeEventHandlerForEventClass:kInternetEventClass + andEventID:kAEGetURL]; + [super dealloc]; +} + #define _R(P, T, E, K) \ { \ NSMenuItem *tmp = [self menuItemWithParent:(P) title:(T) \ @@ -221,6 +235,22 @@ static NSString *escape_loadfile_name(NSString *input) [self stopPlayback]; } +- (void)getUrl:(NSAppleEventDescriptor *)event + withReplyEvent:(NSAppleEventDescriptor *)replyEvent +{ + NSString *url = + [[event paramDescriptorForKeyword:keyDirectObject] stringValue]; + + self.files = @[url]; + + if (self.willStopOnOpenEvent) { + self.willStopOnOpenEvent = NO; + cocoa_stop_runloop(); + } else { + [self handleFiles]; + } +} + - (void)application:(NSApplication *)sender openFiles:(NSArray *)filenames { Application *app = mpv_shared_app(); |