| | |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | #include <CoreFoundation/CoreFoundation.h> |
| | #include <CoreFoundation/CFPlugInCOM.h> |
| | #include <CoreServices/CoreServices.h> |
| | #include <QuickLook/QuickLook.h> |
| |
|
| | |
| | |
| | |
| |
|
| | |
| | #define PLUGIN_ID "F70BD796-FE76-450B-83CC-609688F17873" |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | |
| | |
| | |
| |
|
| | |
| | OSStatus GenerateThumbnailForURL(void *thisInterface, QLThumbnailRequestRef thumbnail, CFURLRef url, CFStringRef contentTypeUTI, CFDictionaryRef options, CGSize maxSize); |
| | void CancelThumbnailGeneration(void* thisInterface, QLThumbnailRequestRef thumbnail); |
| |
|
| | |
| | OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, CFURLRef url, CFStringRef contentTypeUTI, CFDictionaryRef options); |
| | void CancelPreviewGeneration(void *thisInterface, QLPreviewRequestRef preview); |
| |
|
| | |
| | typedef struct __QuickLookGeneratorPluginType |
| | { |
| | void *conduitInterface; |
| | CFUUIDRef factoryID; |
| | UInt32 refCount; |
| | } QuickLookGeneratorPluginType; |
| |
|
| | |
| | |
| | |
| | |
| | |
| |
|
| | QuickLookGeneratorPluginType *AllocQuickLookGeneratorPluginType(CFUUIDRef inFactoryID); |
| | void DeallocQuickLookGeneratorPluginType(QuickLookGeneratorPluginType *thisInstance); |
| | HRESULT QuickLookGeneratorQueryInterface(void *thisInstance,REFIID iid,LPVOID *ppv); |
| | void *QuickLookGeneratorPluginFactory(CFAllocatorRef allocator,CFUUIDRef typeID); |
| | ULONG QuickLookGeneratorPluginAddRef(void *thisInstance); |
| | ULONG QuickLookGeneratorPluginRelease(void *thisInstance); |
| |
|
| | |
| | |
| | |
| | |
| | |
| | static QLGeneratorInterfaceStruct myInterfaceFtbl = { |
| | NULL, |
| | QuickLookGeneratorQueryInterface, |
| | QuickLookGeneratorPluginAddRef, |
| | QuickLookGeneratorPluginRelease, |
| | NULL, |
| | NULL, |
| | NULL, |
| | NULL |
| | }; |
| |
|
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | QuickLookGeneratorPluginType *AllocQuickLookGeneratorPluginType(CFUUIDRef inFactoryID) |
| | { |
| | QuickLookGeneratorPluginType *theNewInstance; |
| |
|
| | theNewInstance = (QuickLookGeneratorPluginType *)malloc(sizeof(QuickLookGeneratorPluginType)); |
| | memset(theNewInstance,0,sizeof(QuickLookGeneratorPluginType)); |
| |
|
| | |
| | theNewInstance->conduitInterface = malloc(sizeof(QLGeneratorInterfaceStruct)); |
| | memcpy(theNewInstance->conduitInterface,&myInterfaceFtbl,sizeof(QLGeneratorInterfaceStruct)); |
| |
|
| | |
| | theNewInstance->factoryID = CFRetain(inFactoryID); |
| | CFPlugInAddInstanceForFactory(inFactoryID); |
| |
|
| | |
| | theNewInstance->refCount = 1; |
| | return theNewInstance; |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | void DeallocQuickLookGeneratorPluginType(QuickLookGeneratorPluginType *thisInstance) |
| | { |
| | CFUUIDRef theFactoryID; |
| |
|
| | theFactoryID = thisInstance->factoryID; |
| | |
| | free(thisInstance->conduitInterface); |
| |
|
| | |
| | free(thisInstance); |
| | if (theFactoryID){ |
| | CFPlugInRemoveInstanceForFactory(theFactoryID); |
| | CFRelease(theFactoryID); |
| | } |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | |
| | HRESULT QuickLookGeneratorQueryInterface(void *thisInstance,REFIID iid,LPVOID *ppv) |
| | { |
| | CFUUIDRef interfaceID; |
| |
|
| | interfaceID = CFUUIDCreateFromUUIDBytes(kCFAllocatorDefault,iid); |
| |
|
| | if (CFEqual(interfaceID,kQLGeneratorCallbacksInterfaceID)){ |
| | |
| | |
| | |
| | |
| | ((QLGeneratorInterfaceStruct *)((QuickLookGeneratorPluginType *)thisInstance)->conduitInterface)->GenerateThumbnailForURL = GenerateThumbnailForURL; |
| | ((QLGeneratorInterfaceStruct *)((QuickLookGeneratorPluginType *)thisInstance)->conduitInterface)->CancelThumbnailGeneration = CancelThumbnailGeneration; |
| | ((QLGeneratorInterfaceStruct *)((QuickLookGeneratorPluginType *)thisInstance)->conduitInterface)->GeneratePreviewForURL = GeneratePreviewForURL; |
| | ((QLGeneratorInterfaceStruct *)((QuickLookGeneratorPluginType *)thisInstance)->conduitInterface)->CancelPreviewGeneration = CancelPreviewGeneration; |
| | ((QLGeneratorInterfaceStruct *)((QuickLookGeneratorPluginType*)thisInstance)->conduitInterface)->AddRef(thisInstance); |
| | *ppv = thisInstance; |
| | CFRelease(interfaceID); |
| | return S_OK; |
| | }else{ |
| | |
| | *ppv = NULL; |
| | CFRelease(interfaceID); |
| | return E_NOINTERFACE; |
| | } |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | ULONG QuickLookGeneratorPluginAddRef(void *thisInstance) |
| | { |
| | ((QuickLookGeneratorPluginType *)thisInstance )->refCount += 1; |
| | return ((QuickLookGeneratorPluginType*) thisInstance)->refCount; |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | ULONG QuickLookGeneratorPluginRelease(void *thisInstance) |
| | { |
| | ((QuickLookGeneratorPluginType*)thisInstance)->refCount -= 1; |
| | if (((QuickLookGeneratorPluginType*)thisInstance)->refCount == 0){ |
| | DeallocQuickLookGeneratorPluginType((QuickLookGeneratorPluginType*)thisInstance ); |
| | return 0; |
| | }else{ |
| | return ((QuickLookGeneratorPluginType*) thisInstance )->refCount; |
| | } |
| | } |
| |
|
| | |
| | |
| | |
| | void *QuickLookGeneratorPluginFactory(CFAllocatorRef allocator,CFUUIDRef typeID) |
| | { |
| | QuickLookGeneratorPluginType *result; |
| | CFUUIDRef uuid; |
| |
|
| | |
| | |
| | |
| | if (CFEqual(typeID,kQLGeneratorTypeID)){ |
| | uuid = CFUUIDCreateFromString(kCFAllocatorDefault,CFSTR(PLUGIN_ID)); |
| | result = AllocQuickLookGeneratorPluginType(uuid); |
| | CFRelease(uuid); |
| | return result; |
| | } |
| | |
| | return NULL; |
| | } |
| |
|
| |
|