diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..c7a5090 Binary files /dev/null and b/.DS_Store differ diff --git a/DemoProject/Classes/NSGIF.h b/DemoProject/Classes/NSGIF.h deleted file mode 100644 index 70ee777..0000000 --- a/DemoProject/Classes/NSGIF.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// NSGIF.h -// -// Created by Sebastian Dobrincu -// - -#import -#import -#import -#import -#import - -@interface NSGIF : NSObject - -+ (void)createGIFfromURL:(NSURL*)videoURL withFrameCount:(int)frameCount delayTime:(int)delayTime loopCount:(int)loopCount completion:(void(^)(NSURL *GifURL))completionBlock; - -@end diff --git a/DemoProject/Classes/NSGIF.m b/DemoProject/Classes/NSGIF.m deleted file mode 100644 index c9f5dae..0000000 --- a/DemoProject/Classes/NSGIF.m +++ /dev/null @@ -1,242 +0,0 @@ -// -// NSGIF.m -// -// Created by Sebastian Dobrincu -// - -#import "NSGIF.h" - -@implementation NSGIF - -// Declare constants -#define fileName @"NSGIF" -#define timeInterval @(600) -#define tolerance @(0.01) - -typedef NS_ENUM(NSInteger, GIFSize) { - GIFSizeVeryLow = 2, - GIFSizeLow = 3, - GIFSizeMedium = 5, - GIFSizeHigh = 7, - GIFSizeOriginal = 10 -}; - -#pragma mark - Public methods - -+ (void)optimalGIFfromURL:(NSURL*)videoURL loopCount:(int)loopCount completion:(void(^)(NSURL *GifURL))completionBlock { - - float delayTime = 0.02f; - - // Create properties dictionaries - NSDictionary *fileProperties = [self filePropertiesWithLoopCount:loopCount]; - NSDictionary *frameProperties = [self framePropertiesWithDelayTime:delayTime]; - - AVURLAsset *asset = [AVURLAsset assetWithURL:videoURL]; - - float videoWidth = [[[asset tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0] naturalSize].width; - float videoHeight = [[[asset tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0] naturalSize].height; - - GIFSize optimalSize = GIFSizeMedium; - if (videoWidth >= 1200 || videoHeight >= 1200) - optimalSize = GIFSizeVeryLow; - else if (videoWidth >= 800 || videoHeight >= 800) - optimalSize = GIFSizeLow; - else if (videoWidth >= 400 || videoHeight >= 400) - optimalSize = GIFSizeMedium; - else if (videoWidth < 400|| videoHeight < 400) - optimalSize = GIFSizeHigh; - - // Get the length of the video in seconds - float videoLength = (float)asset.duration.value/asset.duration.timescale; - int framesPerSecond = 4; - int frameCount = videoLength*framesPerSecond; - - // How far along the video track we want to move, in seconds. - float increment = (float)videoLength/frameCount; - - // Add frames to the buffer - NSMutableArray *timePoints = [NSMutableArray array]; - for (int currentFrame = 0; currentFrame - -@interface AppDelegate : NSObject - - -@end - diff --git a/DemoProject/NSGIF-OSX/AppDelegate.m b/DemoProject/NSGIF-OSX/AppDelegate.m deleted file mode 100644 index 79cb7ba..0000000 --- a/DemoProject/NSGIF-OSX/AppDelegate.m +++ /dev/null @@ -1,25 +0,0 @@ -// -// AppDelegate.m -// NSGIF-OSX -// -// Created by Sebastian Dobrincu on 06/09/15. -// Copyright (c) 2015 Sebastian Dobrincu. All rights reserved. -// - -#import "AppDelegate.h" - -@interface AppDelegate () - -@end - -@implementation AppDelegate - -- (void)applicationDidFinishLaunching:(NSNotification *)aNotification { - // Insert code here to initialize your application -} - -- (void)applicationWillTerminate:(NSNotification *)aNotification { - // Insert code here to tear down your application -} - -@end diff --git a/DemoProject/NSGIF-OSX/Base.lproj/Main.storyboard b/DemoProject/NSGIF-OSX/Base.lproj/Main.storyboard deleted file mode 100644 index 7f8bfc1..0000000 --- a/DemoProject/NSGIF-OSX/Base.lproj/Main.storyboard +++ /dev/null @@ -1,777 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Default - - - - - - - Left to Right - - - - - - - Right to Left - - - - - - - - - - - Default - - - - - - - Left to Right - - - - - - - Right to Left - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/DemoProject/NSGIF-OSX/Images.xcassets/AppIcon.appiconset/Contents.json b/DemoProject/NSGIF-OSX/Images.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index 2db2b1c..0000000 --- a/DemoProject/NSGIF-OSX/Images.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "images" : [ - { - "idiom" : "mac", - "size" : "16x16", - "scale" : "1x" - }, - { - "idiom" : "mac", - "size" : "16x16", - "scale" : "2x" - }, - { - "idiom" : "mac", - "size" : "32x32", - "scale" : "1x" - }, - { - "idiom" : "mac", - "size" : "32x32", - "scale" : "2x" - }, - { - "idiom" : "mac", - "size" : "128x128", - "scale" : "1x" - }, - { - "idiom" : "mac", - "size" : "128x128", - "scale" : "2x" - }, - { - "idiom" : "mac", - "size" : "256x256", - "scale" : "1x" - }, - { - "idiom" : "mac", - "size" : "256x256", - "scale" : "2x" - }, - { - "idiom" : "mac", - "size" : "512x512", - "scale" : "1x" - }, - { - "idiom" : "mac", - "size" : "512x512", - "scale" : "2x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/DemoProject/NSGIF-OSX/Info.plist b/DemoProject/NSGIF-OSX/Info.plist deleted file mode 100644 index 66db56a..0000000 --- a/DemoProject/NSGIF-OSX/Info.plist +++ /dev/null @@ -1,34 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIconFile - - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - LSMinimumSystemVersion - $(MACOSX_DEPLOYMENT_TARGET) - NSHumanReadableCopyright - Copyright © 2015 Sebastian Dobrincu. All rights reserved. - NSMainStoryboardFile - Main - NSPrincipalClass - NSApplication - - diff --git a/DemoProject/NSGIF-OSX/ViewController.h b/DemoProject/NSGIF-OSX/ViewController.h deleted file mode 100644 index c799a56..0000000 --- a/DemoProject/NSGIF-OSX/ViewController.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// ViewController.h -// NSGIF-OSX -// -// Copyright (c) 2015 Sebastian Dobrincu. All rights reserved. -// - -#import -#import - -@interface ViewController : NSViewController - -@property (strong) IBOutlet WebView *webView; -@property (strong) IBOutlet NSTextField *textField; -@property (strong) IBOutlet NSProgressIndicator *activityIndicator; - -@end - diff --git a/DemoProject/NSGIF-OSX/ViewController.m b/DemoProject/NSGIF-OSX/ViewController.m deleted file mode 100644 index 3d2b8c4..0000000 --- a/DemoProject/NSGIF-OSX/ViewController.m +++ /dev/null @@ -1,68 +0,0 @@ -// -// ViewController.m -// NSGIF-OSX -// -// Copyright (c) 2015 Sebastian Dobrincu. All rights reserved. -// - -#import "ViewController.h" -#import "NSGIF.h" - -@implementation ViewController - -- (void)viewDidLoad { - [super viewDidLoad]; -} - -- (IBAction)demoButtonClicked:(id)sender { - - self.activityIndicator.hidden = NO; - [self.activityIndicator startAnimation:nil]; - - NSURL *videoURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"video" ofType:@"mp4"]]; - [self.textField setStringValue:[videoURL path]]; - - [NSGIF optimalGIFfromURL:videoURL loopCount:0 completion:^(NSURL *GifURL) { - - NSLog(@"Finished generating GIF: %@", GifURL); - - [self.activityIndicator stopAnimation:nil]; - self.activityIndicator.hidden = YES; - [[self.webView mainFrame] loadRequest:[NSURLRequest requestWithURL:GifURL]]; - [[[[[self.webView mainFrame] frameView] documentView] superview] scaleUnitSquareToSize:NSMakeSize(.5, .5)]; - }]; - -} - -- (IBAction)openButtonClicked:(id)sender { - - NSOpenPanel* openDlg = [NSOpenPanel openPanel]; - NSArray *fileTypesArray; - fileTypesArray = @[@"mov", @"mp4", @"avi"]; - - [openDlg setCanChooseFiles:YES]; - [openDlg setAllowedFileTypes:fileTypesArray]; - [openDlg setAllowsMultipleSelection:TRUE]; - - if ([openDlg runModal] == NSModalResponseOK) { - NSArray *files = [openDlg URLs]; - for(int i = 0; i < [files count]; i++ ) { - NSURL *videoURL = [NSURL fileURLWithPath:[[files objectAtIndex:i] path]]; - [self.textField setStringValue:[[files objectAtIndex:i] path]]; - self.activityIndicator.hidden = NO; - [self.activityIndicator startAnimation:nil]; - - [NSGIF optimalGIFfromURL:videoURL loopCount:0 completion:^(NSURL *GifURL) { - - NSLog(@"Finished generating GIF: %@", GifURL); - - [self.activityIndicator stopAnimation:nil]; - self.activityIndicator.hidden = YES; - [[self.webView mainFrame] loadRequest:[NSURLRequest requestWithURL:GifURL]]; - [[[[[self.webView mainFrame] frameView] documentView] superview] scaleUnitSquareToSize:NSMakeSize(.5, .5)]; - }]; - } - } -} - -@end diff --git a/DemoProject/NSGIF-OSX/main.m b/DemoProject/NSGIF-OSX/main.m deleted file mode 100644 index adea3f8..0000000 --- a/DemoProject/NSGIF-OSX/main.m +++ /dev/null @@ -1,13 +0,0 @@ -// -// main.m -// NSGIF-OSX -// -// Created by Sebastian Dobrincu on 06/09/15. -// Copyright (c) 2015 Sebastian Dobrincu. All rights reserved. -// - -#import - -int main(int argc, const char * argv[]) { - return NSApplicationMain(argc, argv); -} diff --git a/DemoProject/NSGIF-OSXTests/Info.plist b/DemoProject/NSGIF-OSXTests/Info.plist deleted file mode 100644 index ba72822..0000000 --- a/DemoProject/NSGIF-OSXTests/Info.plist +++ /dev/null @@ -1,24 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - BNDL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - - diff --git a/DemoProject/NSGIF-OSXTests/NSGIF_OSXTests.m b/DemoProject/NSGIF-OSXTests/NSGIF_OSXTests.m deleted file mode 100644 index 330b69c..0000000 --- a/DemoProject/NSGIF-OSXTests/NSGIF_OSXTests.m +++ /dev/null @@ -1,40 +0,0 @@ -// -// NSGIF_OSXTests.m -// NSGIF-OSXTests -// -// Created by Sebastian Dobrincu on 06/09/15. -// Copyright (c) 2015 Sebastian Dobrincu. All rights reserved. -// - -#import -#import - -@interface NSGIF_OSXTests : XCTestCase - -@end - -@implementation NSGIF_OSXTests - -- (void)setUp { - [super setUp]; - // Put setup code here. This method is called before the invocation of each test method in the class. -} - -- (void)tearDown { - // Put teardown code here. This method is called after the invocation of each test method in the class. - [super tearDown]; -} - -- (void)testExample { - // This is an example of a functional test case. - XCTAssert(YES, @"Pass"); -} - -- (void)testPerformanceExample { - // This is an example of a performance test case. - [self measureBlock:^{ - // Put the code you want to measure the time of here. - }]; -} - -@end diff --git a/DemoProject/NSGIF.xcodeproj/project.pbxproj b/DemoProject/NSGIF.xcodeproj/project.pbxproj deleted file mode 100644 index bae6097..0000000 --- a/DemoProject/NSGIF.xcodeproj/project.pbxproj +++ /dev/null @@ -1,728 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 9A2069F11B9D0AEE00E886E8 /* video.mp4 in Resources */ = {isa = PBXBuildFile; fileRef = 9A2069F01B9D0AEE00E886E8 /* video.mp4 */; }; - 9A2069F21B9D0AEE00E886E8 /* video.mp4 in Resources */ = {isa = PBXBuildFile; fileRef = 9A2069F01B9D0AEE00E886E8 /* video.mp4 */; }; - 9A2069F61B9D138500E886E8 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9A2069F51B9D138500E886E8 /* WebKit.framework */; }; - 9A7C0A3A1B9262A800556C5A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A7C0A391B9262A800556C5A /* main.m */; }; - 9A7C0A3D1B9262A800556C5A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A7C0A3C1B9262A800556C5A /* AppDelegate.m */; }; - 9A7C0A401B9262A800556C5A /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A7C0A3F1B9262A800556C5A /* ViewController.m */; }; - 9A7C0A431B9262A800556C5A /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9A7C0A411B9262A800556C5A /* Main.storyboard */; }; - 9A7C0A451B9262A800556C5A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9A7C0A441B9262A800556C5A /* Images.xcassets */; }; - 9A7C0A481B9262A800556C5A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9A7C0A461B9262A800556C5A /* LaunchScreen.xib */; }; - 9A7C0A541B9262A800556C5A /* NSGIFTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A7C0A531B9262A800556C5A /* NSGIFTests.m */; }; - 9AF8884D1B985F5B005E0F14 /* NSGIF.m in Sources */ = {isa = PBXBuildFile; fileRef = 9AF8884C1B985F5B005E0F14 /* NSGIF.m */; }; - 9AF9B7EB1B9C769C00016854 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 9AF9B7EA1B9C769C00016854 /* AppDelegate.m */; }; - 9AF9B7ED1B9C769C00016854 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 9AF9B7EC1B9C769C00016854 /* main.m */; }; - 9AF9B7F01B9C769C00016854 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9AF9B7EF1B9C769C00016854 /* ViewController.m */; }; - 9AF9B7F21B9C769C00016854 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9AF9B7F11B9C769C00016854 /* Images.xcassets */; }; - 9AF9B7F51B9C769C00016854 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9AF9B7F31B9C769C00016854 /* Main.storyboard */; }; - 9AF9B8011B9C769C00016854 /* NSGIF_OSXTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 9AF9B8001B9C769C00016854 /* NSGIF_OSXTests.m */; }; - 9AF9B80A1B9C82C100016854 /* NSGIF.m in Sources */ = {isa = PBXBuildFile; fileRef = 9AF8884C1B985F5B005E0F14 /* NSGIF.m */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 9A7C0A4E1B9262A800556C5A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9A7C0A2C1B9262A800556C5A /* Project object */; - proxyType = 1; - remoteGlobalIDString = 9A7C0A331B9262A800556C5A; - remoteInfo = NSGIF; - }; - 9AF9B7FB1B9C769C00016854 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 9A7C0A2C1B9262A800556C5A /* Project object */; - proxyType = 1; - remoteGlobalIDString = 9AF9B7E41B9C769C00016854; - remoteInfo = "NSGIF-OSX"; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXFileReference section */ - 9A2069F01B9D0AEE00E886E8 /* video.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = video.mp4; sourceTree = ""; }; - 9A2069F51B9D138500E886E8 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/WebKit.framework; sourceTree = DEVELOPER_DIR; }; - 9A7C0A341B9262A800556C5A /* NSGIF.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = NSGIF.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 9A7C0A381B9262A800556C5A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 9A7C0A391B9262A800556C5A /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; - 9A7C0A3B1B9262A800556C5A /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; - 9A7C0A3C1B9262A800556C5A /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; - 9A7C0A3E1B9262A800556C5A /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; - 9A7C0A3F1B9262A800556C5A /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; - 9A7C0A421B9262A800556C5A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; - 9A7C0A441B9262A800556C5A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; - 9A7C0A471B9262A800556C5A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; - 9A7C0A4D1B9262A800556C5A /* NSGIFTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = NSGIFTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 9A7C0A521B9262A800556C5A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 9A7C0A531B9262A800556C5A /* NSGIFTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NSGIFTests.m; sourceTree = ""; }; - 9AF8884B1B985F5B005E0F14 /* NSGIF.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NSGIF.h; path = ../NSGIF/NSGIF.h; sourceTree = ""; }; - 9AF8884C1B985F5B005E0F14 /* NSGIF.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = NSGIF.m; path = ../NSGIF/NSGIF.m; sourceTree = ""; }; - 9AF9B7E51B9C769C00016854 /* NSGIF-OSX.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "NSGIF-OSX.app"; sourceTree = BUILT_PRODUCTS_DIR; }; - 9AF9B7E81B9C769C00016854 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 9AF9B7E91B9C769C00016854 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; - 9AF9B7EA1B9C769C00016854 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; - 9AF9B7EC1B9C769C00016854 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; - 9AF9B7EE1B9C769C00016854 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; - 9AF9B7EF1B9C769C00016854 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; - 9AF9B7F11B9C769C00016854 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; - 9AF9B7F41B9C769C00016854 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; - 9AF9B7FA1B9C769C00016854 /* NSGIF-OSXTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "NSGIF-OSXTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; - 9AF9B7FF1B9C769C00016854 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 9AF9B8001B9C769C00016854 /* NSGIF_OSXTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NSGIF_OSXTests.m; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 9A7C0A311B9262A800556C5A /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 9A7C0A4A1B9262A800556C5A /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 9AF9B7E21B9C769C00016854 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 9A2069F61B9D138500E886E8 /* WebKit.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 9AF9B7F71B9C769C00016854 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 9A7C0A2B1B9262A800556C5A = { - isa = PBXGroup; - children = ( - 9AF8884B1B985F5B005E0F14 /* NSGIF.h */, - 9AF8884C1B985F5B005E0F14 /* NSGIF.m */, - 9A2069F01B9D0AEE00E886E8 /* video.mp4 */, - 9A7C0A361B9262A800556C5A /* NSGIF */, - 9A7C0A501B9262A800556C5A /* NSGIFTests */, - 9AF9B7E61B9C769C00016854 /* NSGIF-OSX */, - 9AF9B7FD1B9C769C00016854 /* NSGIF-OSXTests */, - 9A7C0A351B9262A800556C5A /* Products */, - ); - sourceTree = ""; - }; - 9A7C0A351B9262A800556C5A /* Products */ = { - isa = PBXGroup; - children = ( - 9A7C0A341B9262A800556C5A /* NSGIF.app */, - 9A7C0A4D1B9262A800556C5A /* NSGIFTests.xctest */, - 9AF9B7E51B9C769C00016854 /* NSGIF-OSX.app */, - 9AF9B7FA1B9C769C00016854 /* NSGIF-OSXTests.xctest */, - ); - name = Products; - sourceTree = ""; - }; - 9A7C0A361B9262A800556C5A /* NSGIF */ = { - isa = PBXGroup; - children = ( - 9A7C0A3B1B9262A800556C5A /* AppDelegate.h */, - 9A7C0A3C1B9262A800556C5A /* AppDelegate.m */, - 9A7C0A3E1B9262A800556C5A /* ViewController.h */, - 9A7C0A3F1B9262A800556C5A /* ViewController.m */, - 9A7C0A411B9262A800556C5A /* Main.storyboard */, - 9A7C0A441B9262A800556C5A /* Images.xcassets */, - 9A7C0A461B9262A800556C5A /* LaunchScreen.xib */, - 9A7C0A371B9262A800556C5A /* Supporting Files */, - ); - path = NSGIF; - sourceTree = ""; - }; - 9A7C0A371B9262A800556C5A /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 9A7C0A381B9262A800556C5A /* Info.plist */, - 9A7C0A391B9262A800556C5A /* main.m */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - 9A7C0A501B9262A800556C5A /* NSGIFTests */ = { - isa = PBXGroup; - children = ( - 9A7C0A531B9262A800556C5A /* NSGIFTests.m */, - 9A7C0A511B9262A800556C5A /* Supporting Files */, - ); - path = NSGIFTests; - sourceTree = ""; - }; - 9A7C0A511B9262A800556C5A /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 9A7C0A521B9262A800556C5A /* Info.plist */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - 9AF9B7E61B9C769C00016854 /* NSGIF-OSX */ = { - isa = PBXGroup; - children = ( - 9AF9B7E91B9C769C00016854 /* AppDelegate.h */, - 9AF9B7EA1B9C769C00016854 /* AppDelegate.m */, - 9AF9B7EE1B9C769C00016854 /* ViewController.h */, - 9AF9B7EF1B9C769C00016854 /* ViewController.m */, - 9AF9B7F11B9C769C00016854 /* Images.xcassets */, - 9AF9B7F31B9C769C00016854 /* Main.storyboard */, - 9AF9B7E71B9C769C00016854 /* Supporting Files */, - ); - path = "NSGIF-OSX"; - sourceTree = ""; - }; - 9AF9B7E71B9C769C00016854 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 9A2069F51B9D138500E886E8 /* WebKit.framework */, - 9AF9B7E81B9C769C00016854 /* Info.plist */, - 9AF9B7EC1B9C769C00016854 /* main.m */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - 9AF9B7FD1B9C769C00016854 /* NSGIF-OSXTests */ = { - isa = PBXGroup; - children = ( - 9AF9B8001B9C769C00016854 /* NSGIF_OSXTests.m */, - 9AF9B7FE1B9C769C00016854 /* Supporting Files */, - ); - path = "NSGIF-OSXTests"; - sourceTree = ""; - }; - 9AF9B7FE1B9C769C00016854 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 9AF9B7FF1B9C769C00016854 /* Info.plist */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 9A7C0A331B9262A800556C5A /* NSGIF */ = { - isa = PBXNativeTarget; - buildConfigurationList = 9A7C0A571B9262A800556C5A /* Build configuration list for PBXNativeTarget "NSGIF" */; - buildPhases = ( - 9A7C0A301B9262A800556C5A /* Sources */, - 9A7C0A311B9262A800556C5A /* Frameworks */, - 9A7C0A321B9262A800556C5A /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = NSGIF; - productName = NSGIF; - productReference = 9A7C0A341B9262A800556C5A /* NSGIF.app */; - productType = "com.apple.product-type.application"; - }; - 9A7C0A4C1B9262A800556C5A /* NSGIFTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 9A7C0A5A1B9262A800556C5A /* Build configuration list for PBXNativeTarget "NSGIFTests" */; - buildPhases = ( - 9A7C0A491B9262A800556C5A /* Sources */, - 9A7C0A4A1B9262A800556C5A /* Frameworks */, - 9A7C0A4B1B9262A800556C5A /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - 9A7C0A4F1B9262A800556C5A /* PBXTargetDependency */, - ); - name = NSGIFTests; - productName = NSGIFTests; - productReference = 9A7C0A4D1B9262A800556C5A /* NSGIFTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; - 9AF9B7E41B9C769C00016854 /* NSGIF-OSX */ = { - isa = PBXNativeTarget; - buildConfigurationList = 9AF9B8061B9C769C00016854 /* Build configuration list for PBXNativeTarget "NSGIF-OSX" */; - buildPhases = ( - 9AF9B7E11B9C769C00016854 /* Sources */, - 9AF9B7E21B9C769C00016854 /* Frameworks */, - 9AF9B7E31B9C769C00016854 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "NSGIF-OSX"; - productName = "NSGIF-OSX"; - productReference = 9AF9B7E51B9C769C00016854 /* NSGIF-OSX.app */; - productType = "com.apple.product-type.application"; - }; - 9AF9B7F91B9C769C00016854 /* NSGIF-OSXTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 9AF9B8071B9C769C00016854 /* Build configuration list for PBXNativeTarget "NSGIF-OSXTests" */; - buildPhases = ( - 9AF9B7F61B9C769C00016854 /* Sources */, - 9AF9B7F71B9C769C00016854 /* Frameworks */, - 9AF9B7F81B9C769C00016854 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - 9AF9B7FC1B9C769C00016854 /* PBXTargetDependency */, - ); - name = "NSGIF-OSXTests"; - productName = "NSGIF-OSXTests"; - productReference = 9AF9B7FA1B9C769C00016854 /* NSGIF-OSXTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 9A7C0A2C1B9262A800556C5A /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0730; - ORGANIZATIONNAME = "Sebastian Dobrincu"; - TargetAttributes = { - 9A7C0A331B9262A800556C5A = { - CreatedOnToolsVersion = 6.4; - }; - 9A7C0A4C1B9262A800556C5A = { - CreatedOnToolsVersion = 6.4; - TestTargetID = 9A7C0A331B9262A800556C5A; - }; - 9AF9B7E41B9C769C00016854 = { - CreatedOnToolsVersion = 6.4; - }; - 9AF9B7F91B9C769C00016854 = { - CreatedOnToolsVersion = 6.4; - TestTargetID = 9AF9B7E41B9C769C00016854; - }; - }; - }; - buildConfigurationList = 9A7C0A2F1B9262A800556C5A /* Build configuration list for PBXProject "NSGIF" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = 9A7C0A2B1B9262A800556C5A; - productRefGroup = 9A7C0A351B9262A800556C5A /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 9A7C0A331B9262A800556C5A /* NSGIF */, - 9A7C0A4C1B9262A800556C5A /* NSGIFTests */, - 9AF9B7E41B9C769C00016854 /* NSGIF-OSX */, - 9AF9B7F91B9C769C00016854 /* NSGIF-OSXTests */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 9A7C0A321B9262A800556C5A /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 9A2069F11B9D0AEE00E886E8 /* video.mp4 in Resources */, - 9A7C0A431B9262A800556C5A /* Main.storyboard in Resources */, - 9A7C0A481B9262A800556C5A /* LaunchScreen.xib in Resources */, - 9A7C0A451B9262A800556C5A /* Images.xcassets in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 9A7C0A4B1B9262A800556C5A /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 9AF9B7E31B9C769C00016854 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 9A2069F21B9D0AEE00E886E8 /* video.mp4 in Resources */, - 9AF9B7F21B9C769C00016854 /* Images.xcassets in Resources */, - 9AF9B7F51B9C769C00016854 /* Main.storyboard in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 9AF9B7F81B9C769C00016854 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 9A7C0A301B9262A800556C5A /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 9A7C0A401B9262A800556C5A /* ViewController.m in Sources */, - 9AF8884D1B985F5B005E0F14 /* NSGIF.m in Sources */, - 9A7C0A3D1B9262A800556C5A /* AppDelegate.m in Sources */, - 9A7C0A3A1B9262A800556C5A /* main.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 9A7C0A491B9262A800556C5A /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 9A7C0A541B9262A800556C5A /* NSGIFTests.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 9AF9B7E11B9C769C00016854 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 9AF9B7F01B9C769C00016854 /* ViewController.m in Sources */, - 9AF9B80A1B9C82C100016854 /* NSGIF.m in Sources */, - 9AF9B7ED1B9C769C00016854 /* main.m in Sources */, - 9AF9B7EB1B9C769C00016854 /* AppDelegate.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 9AF9B7F61B9C769C00016854 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 9AF9B8011B9C769C00016854 /* NSGIF_OSXTests.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - 9A7C0A4F1B9262A800556C5A /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 9A7C0A331B9262A800556C5A /* NSGIF */; - targetProxy = 9A7C0A4E1B9262A800556C5A /* PBXContainerItemProxy */; - }; - 9AF9B7FC1B9C769C00016854 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 9AF9B7E41B9C769C00016854 /* NSGIF-OSX */; - targetProxy = 9AF9B7FB1B9C769C00016854 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin PBXVariantGroup section */ - 9A7C0A411B9262A800556C5A /* Main.storyboard */ = { - isa = PBXVariantGroup; - children = ( - 9A7C0A421B9262A800556C5A /* Base */, - ); - name = Main.storyboard; - sourceTree = ""; - }; - 9A7C0A461B9262A800556C5A /* LaunchScreen.xib */ = { - isa = PBXVariantGroup; - children = ( - 9A7C0A471B9262A800556C5A /* Base */, - ); - name = LaunchScreen.xib; - sourceTree = ""; - }; - 9AF9B7F31B9C769C00016854 /* Main.storyboard */ = { - isa = PBXVariantGroup; - children = ( - 9AF9B7F41B9C769C00016854 /* Base */, - ); - name = Main.storyboard; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - 9A7C0A551B9262A800556C5A /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.4; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - }; - name = Debug; - }; - 9A7C0A561B9262A800556C5A /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.4; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - 9A7C0A581B9262A800556C5A /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_ENABLE_MODULES = YES; - INFOPLIST_FILE = NSGIF/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.sebastiandobrincu.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Debug; - }; - 9A7C0A591B9262A800556C5A /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_ENABLE_MODULES = YES; - INFOPLIST_FILE = NSGIF/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.sebastiandobrincu.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; - 9A7C0A5B1B9262A800556C5A /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - ); - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - INFOPLIST_FILE = NSGIFTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.sebastiandobrincu.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = "$(TARGET_NAME)"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/NSGIF.app/NSGIF"; - }; - name = Debug; - }; - 9A7C0A5C1B9262A800556C5A /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - ); - INFOPLIST_FILE = NSGIFTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = "com.sebastiandobrincu.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = "$(TARGET_NAME)"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/NSGIF.app/NSGIF"; - }; - name = Release; - }; - 9AF9B8021B9C769C00016854 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CODE_SIGN_IDENTITY = "-"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = dwarf; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - INFOPLIST_FILE = "NSGIF-OSX/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 10.10; - PRODUCT_BUNDLE_IDENTIFIER = "com.sebastiandobrincu.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = macosx; - }; - name = Debug; - }; - 9AF9B8031B9C769C00016854 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CODE_SIGN_IDENTITY = "-"; - COMBINE_HIDPI_IMAGES = YES; - INFOPLIST_FILE = "NSGIF-OSX/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 10.10; - PRODUCT_BUNDLE_IDENTIFIER = "com.sebastiandobrincu.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = macosx; - }; - name = Release; - }; - 9AF9B8041B9C769C00016854 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = dwarf; - FRAMEWORK_SEARCH_PATHS = ( - "$(DEVELOPER_FRAMEWORKS_DIR)", - "$(inherited)", - ); - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - INFOPLIST_FILE = "NSGIF-OSXTests/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 10.11; - PRODUCT_BUNDLE_IDENTIFIER = "com.sebastiandobrincu.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = macosx; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/NSGIF-OSX.app/Contents/MacOS/NSGIF-OSX"; - }; - name = Debug; - }; - 9AF9B8051B9C769C00016854 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - COMBINE_HIDPI_IMAGES = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(DEVELOPER_FRAMEWORKS_DIR)", - "$(inherited)", - ); - INFOPLIST_FILE = "NSGIF-OSXTests/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 10.11; - PRODUCT_BUNDLE_IDENTIFIER = "com.sebastiandobrincu.$(PRODUCT_NAME:rfc1034identifier)"; - PRODUCT_NAME = "$(TARGET_NAME)"; - SDKROOT = macosx; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/NSGIF-OSX.app/Contents/MacOS/NSGIF-OSX"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 9A7C0A2F1B9262A800556C5A /* Build configuration list for PBXProject "NSGIF" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 9A7C0A551B9262A800556C5A /* Debug */, - 9A7C0A561B9262A800556C5A /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 9A7C0A571B9262A800556C5A /* Build configuration list for PBXNativeTarget "NSGIF" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 9A7C0A581B9262A800556C5A /* Debug */, - 9A7C0A591B9262A800556C5A /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 9A7C0A5A1B9262A800556C5A /* Build configuration list for PBXNativeTarget "NSGIFTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 9A7C0A5B1B9262A800556C5A /* Debug */, - 9A7C0A5C1B9262A800556C5A /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 9AF9B8061B9C769C00016854 /* Build configuration list for PBXNativeTarget "NSGIF-OSX" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 9AF9B8021B9C769C00016854 /* Debug */, - 9AF9B8031B9C769C00016854 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 9AF9B8071B9C769C00016854 /* Build configuration list for PBXNativeTarget "NSGIF-OSXTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 9AF9B8041B9C769C00016854 /* Debug */, - 9AF9B8051B9C769C00016854 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 9A7C0A2C1B9262A800556C5A /* Project object */; -} diff --git a/DemoProject/NSGIF.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/DemoProject/NSGIF.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 4f43783..0000000 --- a/DemoProject/NSGIF.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/DemoProject/NSGIF/AppDelegate.h b/DemoProject/NSGIF/AppDelegate.h deleted file mode 100644 index d908ecd..0000000 --- a/DemoProject/NSGIF/AppDelegate.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// AppDelegate.h -// NSGIF -// -// Created by Sebastian Dobrincu on 30/08/15. -// Copyright (c) 2015 Sebastian Dobrincu. All rights reserved. -// - -#import - -@interface AppDelegate : UIResponder - -@property (strong, nonatomic) UIWindow *window; - - -@end - diff --git a/DemoProject/NSGIF/AppDelegate.m b/DemoProject/NSGIF/AppDelegate.m deleted file mode 100644 index 9c66657..0000000 --- a/DemoProject/NSGIF/AppDelegate.m +++ /dev/null @@ -1,45 +0,0 @@ -// -// AppDelegate.m -// NSGIF -// -// Created by Sebastian Dobrincu on 30/08/15. -// Copyright (c) 2015 Sebastian Dobrincu. All rights reserved. -// - -#import "AppDelegate.h" - -@interface AppDelegate () - -@end - -@implementation AppDelegate - - -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - // Override point for customization after application launch. - return YES; -} - -- (void)applicationWillResignActive:(UIApplication *)application { - // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. - // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. -} - -- (void)applicationDidEnterBackground:(UIApplication *)application { - // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. - // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. -} - -- (void)applicationWillEnterForeground:(UIApplication *)application { - // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. -} - -- (void)applicationDidBecomeActive:(UIApplication *)application { - // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. -} - -- (void)applicationWillTerminate:(UIApplication *)application { - // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. -} - -@end diff --git a/DemoProject/NSGIF/Base.lproj/LaunchScreen.xib b/DemoProject/NSGIF/Base.lproj/LaunchScreen.xib deleted file mode 100644 index ea57aa3..0000000 --- a/DemoProject/NSGIF/Base.lproj/LaunchScreen.xib +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/DemoProject/NSGIF/Base.lproj/Main.storyboard b/DemoProject/NSGIF/Base.lproj/Main.storyboard deleted file mode 100644 index 3862f06..0000000 --- a/DemoProject/NSGIF/Base.lproj/Main.storyboard +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/DemoProject/NSGIF/Images.xcassets/AppIcon.appiconset/Contents.json b/DemoProject/NSGIF/Images.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index 118c98f..0000000 --- a/DemoProject/NSGIF/Images.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "images" : [ - { - "idiom" : "iphone", - "size" : "29x29", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "29x29", - "scale" : "3x" - }, - { - "idiom" : "iphone", - "size" : "40x40", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "40x40", - "scale" : "3x" - }, - { - "idiom" : "iphone", - "size" : "60x60", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "60x60", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/DemoProject/NSGIF/Info.plist b/DemoProject/NSGIF/Info.plist deleted file mode 100644 index fab4b93..0000000 --- a/DemoProject/NSGIF/Info.plist +++ /dev/null @@ -1,44 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - LSRequiresIPhoneOS - - UILaunchStoryboardName - LaunchScreen - UIMainStoryboardFile - Main - UIRequiredDeviceCapabilities - - armv7 - - UIStatusBarStyle - UIStatusBarStyleLightContent - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UIViewControllerBasedStatusBarAppearance - - - diff --git a/DemoProject/NSGIF/ViewController.h b/DemoProject/NSGIF/ViewController.h deleted file mode 100644 index 171de05..0000000 --- a/DemoProject/NSGIF/ViewController.h +++ /dev/null @@ -1,23 +0,0 @@ -// -// ViewController.h -// NSGIF -// -// Created by Sebastian Dobrincu on 30/08/15. -// Copyright (c) 2015 Sebastian Dobrincu. All rights reserved. -// - -#import - -@interface ViewController : UIViewController - -@property (strong, nonatomic) IBOutlet UIButton *button1; -@property (strong, nonatomic) IBOutlet UIButton *button2; - -@property (strong, nonatomic) IBOutlet UIWebView *webView; -@property (strong, nonatomic) IBOutlet UIActivityIndicatorView *activityIndicator; - -- (IBAction)button1Tapped:(id)sender; -- (IBAction)button2Tapped:(id)sender; - -@end - diff --git a/DemoProject/NSGIF/ViewController.m b/DemoProject/NSGIF/ViewController.m deleted file mode 100644 index 7aceb70..0000000 --- a/DemoProject/NSGIF/ViewController.m +++ /dev/null @@ -1,105 +0,0 @@ -// -// ViewController.m -// NSGIF -// -// Created by Sebastian Dobrincu on 30/08/15. (My birthday 🎉) -// Copyright (c) 2015 Sebastian Dobrincu. All rights reserved. -// - -#import "ViewController.h" -#import -#import "NSGIF.h" - -@implementation ViewController - -- (void)viewDidLoad { - [super viewDidLoad]; - - self.view.backgroundColor = [UIColor colorWithRed:0.13 green:0.16 blue:0.19 alpha:1]; - self.webView.backgroundColor = [UIColor colorWithRed:0.13 green:0.16 blue:0.19 alpha:1]; -} - --(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { - [self dismissViewControllerAnimated:YES completion:nil]; - - NSURL *url = info[UIImagePickerControllerMediaURL]; - if (url){ - - [self.activityIndicator startAnimating]; - self.button1.enabled = NO; - self.button2.enabled = NO; - - [NSGIF optimalGIFfromURL:url loopCount:0 completion:^(NSURL *GifURL) { - - NSLog(@"Finished generating GIF: %@", GifURL); - - [self.activityIndicator stopAnimating]; - [UIView animateWithDuration:0.3 animations:^{ - self.button1.alpha = 0.0f; - self.button2.alpha = 0.0f; - self.webView.alpha = 1.0f; - }]; - [self.webView loadRequest:[NSURLRequest requestWithURL:GifURL]]; - - UIAlertView *alert; - if (GifURL) - alert = [[UIAlertView alloc] initWithTitle:@"Yaay!" message:@"You successfully created your GIF!" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil]; - else - alert = [[UIAlertView alloc] initWithTitle:@"Ooops!" message:@"Hmm... Something went wrong here!" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil]; - [alert show]; - }]; - } -} - -- (void)didReceiveMemoryWarning { - [super didReceiveMemoryWarning]; - - NSLog(@"Received memory warning. Try to tweak your GIF parameters to optimise the converting process."); - - // Dispose of any resources that can be recreated. - [[NSURLCache sharedURLCache] removeAllCachedResponses]; -} - -- (IBAction)button1Tapped:(id)sender { - - [self.activityIndicator startAnimating]; - self.button1.enabled = NO; - self.button2.enabled = NO; - - NSURL *videoURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"video" ofType:@"mp4"]]; - [NSGIF optimalGIFfromURL:videoURL loopCount:0 completion:^(NSURL *GifURL) { - - NSLog(@"Finished generating GIF: %@", GifURL); - - [self.activityIndicator stopAnimating]; - [UIView animateWithDuration:0.3 animations:^{ - self.button1.alpha = 0.0f; - self.button2.alpha = 0.0f; - self.webView.alpha = 1.0f; - }]; - [self.webView loadRequest:[NSURLRequest requestWithURL:GifURL]]; - }]; -} - -- (IBAction)button2Tapped:(id)sender { - - #if TARGET_IPHONE_SIMULATOR - UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Oops!" message:@"You can't use the camera demo in the simulator. Try the video demo." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil]; - [alert show]; - return; - #endif - - dispatch_async(dispatch_get_main_queue(), ^{ - - UIImagePickerController *picker = [[UIImagePickerController alloc]init]; - picker.videoQuality = UIImagePickerControllerQualityTypeMedium; - picker.delegate = self; - picker.sourceType = UIImagePickerControllerSourceTypeCamera; - picker.mediaTypes = @[(NSString *)kUTTypeMovie]; - - // Present the picker - [self presentViewController:picker animated:YES completion:nil]; - }); -} - -@end diff --git a/DemoProject/NSGIF/main.m b/DemoProject/NSGIF/main.m deleted file mode 100644 index 2dac00a..0000000 --- a/DemoProject/NSGIF/main.m +++ /dev/null @@ -1,15 +0,0 @@ -// -// main.m -// NSGIF -// -// Created by Sebastian Dobrincu on 30/08/15. -// Copyright (c) 2015 Sebastian Dobrincu. All rights reserved. -// -#import -#import "AppDelegate.h" - -int main(int argc, char * argv[]) { - @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); - } -} diff --git a/DemoProject/NSGIFTests/Info.plist b/DemoProject/NSGIFTests/Info.plist deleted file mode 100644 index ba72822..0000000 --- a/DemoProject/NSGIFTests/Info.plist +++ /dev/null @@ -1,24 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - BNDL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - - diff --git a/DemoProject/NSGIFTests/NSGIFTests.m b/DemoProject/NSGIFTests/NSGIFTests.m deleted file mode 100644 index 78902c5..0000000 --- a/DemoProject/NSGIFTests/NSGIFTests.m +++ /dev/null @@ -1,40 +0,0 @@ -// -// NSGIFTests.m -// NSGIFTests -// -// Created by Sebastian Dobrincu on 30/08/15. -// Copyright (c) 2015 Sebastian Dobrincu. All rights reserved. -// - -#import -#import - -@interface NSGIFTests : XCTestCase - -@end - -@implementation NSGIFTests - -- (void)setUp { - [super setUp]; - // Put setup code here. This method is called before the invocation of each test method in the class. -} - -- (void)tearDown { - // Put teardown code here. This method is called after the invocation of each test method in the class. - [super tearDown]; -} - -- (void)testExample { - // This is an example of a functional test case. - XCTAssert(YES, @"Pass"); -} - -- (void)testPerformanceExample { - // This is an example of a performance test case. - [self measureBlock:^{ - // Put the code you want to measure the time of here. - }]; -} - -@end diff --git a/DemoProject/video.mp4 b/DemoProject/video.mp4 deleted file mode 100644 index fcbdcbe..0000000 Binary files a/DemoProject/video.mp4 and /dev/null differ diff --git a/NSGIF.podspec b/NSGIF.podspec index b3a5de4..9550200 100755 --- a/NSGIF.podspec +++ b/NSGIF.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| # s.name = "NSGIF" - s.version = "1.2.2" + s.version = "1.2.4" s.summary = "iOS Library for converting your videos into beautiful animated GIFs." s.homepage = "https://github.com/sebyddd/NSGIF" s.screenshots = "https://dl.dropboxusercontent.com/s/0rq3fr0dtpvwd4h/NSGIF-header.png?dl=0" @@ -28,7 +28,7 @@ Pod::Spec.new do |s| s.platform = :osx s.ios.deployment_target = '7.0' s.osx.deployment_target = '10.9' - s.source = { :git => 'https://github.com/sebyddd/NSGIF.git', :tag => "#{s.version}" } + s.source = { :git => 'https://github.com/NSRare/NSGIF.git', :tag => "#{s.version}" } s.source_files = "NSGIF/*.{h,m}" s.requires_arc = true diff --git a/NSGIF/NSGIF.h b/NSGIF/NSGIF.h index 8c9cb25..7e9e81d 100644 --- a/NSGIF/NSGIF.h +++ b/NSGIF/NSGIF.h @@ -19,8 +19,12 @@ @interface NSGIF : NSObject -+ (void)optimalGIFfromURL:(NSURL*)videoURL loopCount:(int)loopCount completion:(void(^)(NSURL *GifURL))completionBlock; ++ (void)optimalGIFfromURL:(NSURL *)videoURL loopCount:(int)loopCount progress:(void(^)(CGFloat progress))progressBlock completion:(void(^)(NSURL *GifURL))completionBlock; -+ (void)createGIFfromURL:(NSURL*)videoURL withFrameCount:(int)frameCount delayTime:(float)delayTime loopCount:(int)loopCount completion:(void(^)(NSURL *GifURL))completionBlock; ++ (void)createGIFfromURL:(NSURL *)videoURL withFrameCount:(int)frameCount delayTime:(float)delayTime loopCount:(int)loopCount progress:(void(^)(CGFloat progress))progressBlock completion:(void(^)(NSURL *GifURL))completionBlock; + ++ (void)createGIFfromImages:(NSArray *)imagesArray withDelayTime:(float)delayTime loopCount:(int)loopCount progress:(void(^)(CGFloat progress))progressBlock completion:(void(^)(NSURL *GifURL))completionBlock; + ++ (void)cancel; @end diff --git a/NSGIF/NSGIF.m b/NSGIF/NSGIF.m index f423ede..eecf5e4 100644 --- a/NSGIF/NSGIF.m +++ b/NSGIF/NSGIF.m @@ -23,8 +23,12 @@ typedef NS_ENUM(NSInteger, GIFSize) { #pragma mark - Public methods -+ (void)optimalGIFfromURL:(NSURL*)videoURL loopCount:(int)loopCount completion:(void(^)(NSURL *GifURL))completionBlock { +static BOOL isCancel = NO; ++ (void)optimalGIFfromURL:(NSURL*)videoURL loopCount:(int)loopCount progress:(void(^)(CGFloat progress))progressBlock completion:(void(^)(NSURL *GifURL))completionBlock { + + isCancel = NO; + float delayTime = 0.02f; // Create properties dictionaries @@ -69,7 +73,7 @@ + (void)optimalGIFfromURL:(NSURL*)videoURL loopCount:(int)loopCount completion:( __block NSURL *gifURL; dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - gifURL = [self createGIFforTimePoints:timePoints fromURL:videoURL fileProperties:fileProperties frameProperties:frameProperties frameCount:frameCount gifSize:optimalSize]; + gifURL = [self createGIFforTimePoints:timePoints fromURL:videoURL fileProperties:fileProperties frameProperties:frameProperties frameCount:frameCount gifSize:optimalSize progress:progressBlock ]; dispatch_group_leave(gifQueue); }); @@ -81,7 +85,9 @@ + (void)optimalGIFfromURL:(NSURL*)videoURL loopCount:(int)loopCount completion:( } -+ (void)createGIFfromURL:(NSURL*)videoURL withFrameCount:(int)frameCount delayTime:(float)delayTime loopCount:(int)loopCount completion:(void(^)(NSURL *GifURL))completionBlock { ++ (void)createGIFfromURL:(NSURL*)videoURL withFrameCount:(int)frameCount delayTime:(float)delayTime loopCount:(int)loopCount progress:(void(^)(CGFloat progress))progressBlock completion:(void(^)(NSURL *GifURL))completionBlock { + + isCancel = NO; // Convert the video at the given URL to a GIF, and return the GIF's URL if it was created. // The frames are spaced evenly over the video, and each has the same duration. @@ -115,7 +121,7 @@ + (void)createGIFfromURL:(NSURL*)videoURL withFrameCount:(int)frameCount delayTi __block NSURL *gifURL; dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - gifURL = [self createGIFforTimePoints:timePoints fromURL:videoURL fileProperties:fileProperties frameProperties:frameProperties frameCount:frameCount gifSize:GIFSizeMedium]; + gifURL = [self createGIFforTimePoints:timePoints fromURL:videoURL fileProperties:fileProperties frameProperties:frameProperties frameCount:frameCount gifSize:GIFSizeMedium progress:progressBlock ]; dispatch_group_leave(gifQueue); }); @@ -127,18 +133,89 @@ + (void)createGIFfromURL:(NSURL*)videoURL withFrameCount:(int)frameCount delayTi } ++ (void)createGIFfromImages:(NSArray *)imagesArray withDelayTime:(float)delayTime loopCount:(int)loopCount progress:(void (^)(CGFloat))progressBlock completion:(void (^)(NSURL *))completionBlock { + // Prepare group for firing completion block + + NSMutableArray *scaledPhotos = [NSMutableArray arrayWithCapacity:imagesArray.count]; + for (UIImage *image in imagesArray) { + UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, UIScreen.mainScreen.bounds.size.width, UIScreen.mainScreen.bounds.size.width*(375/390.0))]; + imageView.contentMode = UIViewContentModeScaleAspectFit; + imageView.image = image; + + CGFloat scale = [UIScreen mainScreen].scale; + UIGraphicsBeginImageContextWithOptions(imageView.frame.size, NO, scale); + [imageView.layer renderInContext:UIGraphicsGetCurrentContext()]; + UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); + UIGraphicsEndImageContext(); + + [scaledPhotos addObject:image]; + } + + dispatch_group_t gifQueue = dispatch_group_create(); + dispatch_group_enter(gifQueue); + + __block NSURL *gifURL; + dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ + NSString *timeEncodedFileName = [NSString stringWithFormat:@"%@-%lu.gif", fileName, (unsigned long)([[NSDate date] timeIntervalSince1970]*10.0)]; + NSURL *fileURL = [[[[NSFileManager defaultManager] URLForDirectory:NSLibraryDirectory inDomain:NSUserDomainMask appropriateForURL:nil create:NO error:nil] URLByAppendingPathComponent:@"Gif"] URLByAppendingPathComponent:timeEncodedFileName]; + CFURLRef cfurl = CFBridgingRetain(fileURL); + CGImageDestinationRef imageDestination = CGImageDestinationCreateWithURL(cfurl, kUTTypeGIF, scaledPhotos.count, nil); + CFRelease(cfurl); + if (imageDestination) { + NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithCapacity:4]; + [dict setObject:[NSNumber numberWithBool:YES] forKey:(NSString*)kCGImagePropertyGIFHasGlobalColorMap]; + [dict setObject:(NSString *)kCGImagePropertyColorModelRGB forKey:(NSString *)kCGImagePropertyColorModel]; + [dict setObject:[NSNumber numberWithFloat:16] forKey:(NSString*)kCGImagePropertyDepth]; + [dict setObject:[NSNumber numberWithInt:loopCount] forKey:(NSString *)kCGImagePropertyGIFLoopCount]; + NSDictionary *gifProperties = [NSDictionary dictionaryWithObject:dict forKey:(NSString *)kCGImagePropertyGIFDictionary]; + //设置gif的信息,播放间隔时间,基本数据,和delay时间 + NSDictionary *frameProperties = [NSDictionary dictionaryWithObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat:delayTime], (NSString *)kCGImagePropertyGIFDelayTime, nil] forKey:(NSString *)kCGImagePropertyGIFDictionary]; + + //合成gif + for (int i = 0; i < scaledPhotos.count; i++) { + if (isCancel) { + return; + } + UIImage* img = scaledPhotos[i]; + CGImageDestinationAddImage(imageDestination, img.CGImage, (__bridge CFDictionaryRef)frameProperties); + + CGFloat progress = i/(CGFloat)scaledPhotos.count; + progressBlock(progress); + } + + CGImageDestinationSetProperties(imageDestination, (__bridge CFDictionaryRef)gifProperties); + if (!CGImageDestinationFinalize(imageDestination)) { + NSLog(@"failed to finalize image destination"); + } else { + CFRelease(imageDestination); + gifURL = fileURL; + } + } + + dispatch_group_leave(gifQueue); + }); + + dispatch_group_notify(gifQueue, dispatch_get_main_queue(), ^{ + // Return GIF URL + completionBlock(gifURL); + }); +} + ++ (void)cancel { + isCancel = YES; +} + #pragma mark - Base methods -+ (NSURL *)createGIFforTimePoints:(NSArray *)timePoints fromURL:(NSURL *)url fileProperties:(NSDictionary *)fileProperties frameProperties:(NSDictionary *)frameProperties frameCount:(int)frameCount gifSize:(GIFSize)gifSize{ ++ (NSURL *)createGIFforTimePoints:(NSArray *)timePoints fromURL:(NSURL *)url fileProperties:(NSDictionary *)fileProperties frameProperties:(NSDictionary *)frameProperties frameCount:(int)frameCount gifSize:(GIFSize)gifSize progress:(void(^)(CGFloat progress))progressBlock { NSString *timeEncodedFileName = [NSString stringWithFormat:@"%@-%lu.gif", fileName, (unsigned long)([[NSDate date] timeIntervalSince1970]*10.0)]; - NSString *temporaryFile = [NSTemporaryDirectory() stringByAppendingString:timeEncodedFileName]; - NSURL *fileURL = [NSURL fileURLWithPath:temporaryFile]; + NSURL *fileURL = [[[[NSFileManager defaultManager] URLForDirectory:NSLibraryDirectory inDomain:NSUserDomainMask appropriateForURL:nil create:NO error:nil] URLByAppendingPathComponent:@"Gif"] URLByAppendingPathComponent:timeEncodedFileName]; if (fileURL == nil) return nil; CGImageDestinationRef destination = CGImageDestinationCreateWithURL((__bridge CFURLRef)fileURL, kUTTypeGIF , frameCount, NULL); - + CGImageDestinationSetProperties(destination, (CFDictionaryRef)fileProperties); AVURLAsset *asset = [AVURLAsset URLAssetWithURL:url options:nil]; AVAssetImageGenerator *generator = [AVAssetImageGenerator assetImageGeneratorWithAsset:asset]; @@ -150,7 +227,12 @@ + (NSURL *)createGIFforTimePoints:(NSArray *)timePoints fromURL:(NSURL *)url fil NSError *error = nil; CGImageRef previousImageRefCopy = nil; - for (NSValue *time in timePoints) { + for (int i = 0; i< timePoints.count; i++) { + if (isCancel) { + return nil; + } + NSValue *time = timePoints[i]; + CGImageRef imageRef; #if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR @@ -173,10 +255,12 @@ + (NSURL *)createGIFforTimePoints:(NSArray *)timePoints fromURL:(NSURL *)url fil } CGImageDestinationAddImage(destination, imageRef, (CFDictionaryRef)frameProperties); CGImageRelease(imageRef); + + CGFloat progress = i/(CGFloat)timePoints.count; + progressBlock(progress); } CGImageRelease(previousImageRefCopy); - CGImageDestinationSetProperties(destination, (CFDictionaryRef)fileProperties); // Finalize the GIF if (!CGImageDestinationFinalize(destination)) { NSLog(@"Failed to finalize GIF destination: %@", error); diff --git a/README.md b/README.md index c88a129..9f775bc 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,9 @@ pod "NSGIF", "~> 1.0" ## Practical use ```objective-c -[NSGIF optimalGIFfromURL:url loopCount:0 completion:^(NSURL *GifURL) { +[NSGIF optimalGIFfromURL:url loopCount:0 progress:^(CGFloat progress) { +NSLog(@"Progress generating GIF: %.2f", progress); +}] completion:^(NSURL *GifURL) { NSLog(@"Finished generating GIF: %@", GifURL); }]; ``` @@ -39,7 +41,9 @@ This generates a GIF from the provided video, by automatically setting the best If you want some more flexibility you can use: ```objective-c -[NSGIF createGIFfromURL:url withFrameCount:30 delayTime:.010 loopCount:0 completion:^(NSURL *GifURL) { +[NSGIF createGIFfromURL:url withFrameCount:30 delayTime:.010 loopCount:0 progress:^(CGFloat progress) { +NSLog(@"Progress generating GIF: %.2f", progress); +}] completion:^(NSURL *GifURL) { NSLog(@"Finished generating GIF: %@", GifURL); }]; ``` @@ -52,12 +56,6 @@ loopCount - is the number of times the GIF will repeat. Defaults to 0, which me ``` I recommend you to play with those values and find the best ones for your video. -## Demo - -Check out the demo project for a quick example of how NSGIF works. After you capture your video, this is what you have to do, to retrieve the GIF: - -![NSGIF](https://dl.dropboxusercontent.com/s/p02c6l7rzk6mf6m/NSGIF-HT.gif?dl=0) - ## Todo - [X] Add MacOS Demo - [X] Auto-calculate the frame count