From 657d6a28606472a0e82f37dbd8e2c1efb7519e3f Mon Sep 17 00:00:00 2001 From: vspader Date: Sun, 4 Mar 2007 18:46:44 +0000 Subject: [PATCH] Shorten Framework currently has no callback mechanisms. Until then, did a workaround for the source system. --- Plugins/Shorten/ShortenDecoder.mm | 12 +++++++++++- Plugins/Shorten/ShortenPropertiesReader.mm | 4 ++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Plugins/Shorten/ShortenDecoder.mm b/Plugins/Shorten/ShortenDecoder.mm index a5e2bf13c..e728547c9 100644 --- a/Plugins/Shorten/ShortenDecoder.mm +++ b/Plugins/Shorten/ShortenDecoder.mm @@ -10,8 +10,14 @@ @implementation ShortenDecoder -- (BOOL)open:(NSURL *)url +- (BOOL)open:(id)source { + NSURL *url = [source url]; + if (![[url scheme] isEqualToString:@"file"]) + return NO; + + [source close]; + decoder = new shn_reader; if (!decoder) @@ -124,6 +130,10 @@ shn_unload(handle);*/ } +- (BOOL)seekable +{ + return YES; +} - (NSDictionary *)properties { diff --git a/Plugins/Shorten/ShortenPropertiesReader.mm b/Plugins/Shorten/ShortenPropertiesReader.mm index 797db4ba9..92ddf7d34 100644 --- a/Plugins/Shorten/ShortenPropertiesReader.mm +++ b/Plugins/Shorten/ShortenPropertiesReader.mm @@ -11,13 +11,13 @@ @implementation ShortenPropertiesReader -- (NSDictionary *)propertiesForURL:(NSURL *)url ++ (NSDictionary *)propertiesForSource:(id)source { NSDictionary *properties; ShortenDecoder *decoder; decoder = [[ShortenDecoder alloc] init]; - if (![decoder open:url]) + if (![decoder open:source]) { return nil; }