Permalink
Browse files

initial commit

  • Loading branch information...
0 parents commit ac80749ea017d5fa65c7b6775f0cd8e8c2f2a019 高橋 啓治郎 committed May 16, 2011
Showing with 8,439 additions and 0 deletions.
  1. +7 −0 .gitignore
  2. +14 −0 3.3.SimpleComposition/Classes/PlayerView.h
  3. +23 −0 3.3.SimpleComposition/Classes/PlayerView.m
  4. +19 −0 3.3.SimpleComposition/Classes/SimpleCompositionAppDelegate.h
  5. +85 −0 3.3.SimpleComposition/Classes/SimpleCompositionAppDelegate.m
  6. +17 −0 3.3.SimpleComposition/Classes/SimpleCompositionViewController.h
  7. +53 −0 3.3.SimpleComposition/Classes/SimpleCompositionViewController.m
  8. +444 −0 3.3.SimpleComposition/MainWindow.xib
  9. +23 −0 3.3.SimpleComposition/README.rtf
  10. BIN 3.3.SimpleComposition/Resources/Icon-72.png
  11. BIN 3.3.SimpleComposition/Resources/Icon-Small-50.png
  12. BIN 3.3.SimpleComposition/Resources/Icon-Small.png
  13. BIN 3.3.SimpleComposition/Resources/Icon-Small@2x.png
  14. BIN 3.3.SimpleComposition/Resources/Icon.png
  15. BIN 3.3.SimpleComposition/Resources/Icon@2x.png
  16. +37 −0 3.3.SimpleComposition/SimpleComposition-Info.plist
  17. +318 −0 3.3.SimpleComposition/SimpleComposition.xcodeproj/project.pbxproj
  18. +495 −0 3.3.SimpleComposition/SimpleCompositionViewController.xib
  19. +4 −0 3.3.SimpleComposition/SimpleComposition_Prefix.pch
  20. BIN 3.3.SimpleComposition/Videos/video1.mov
  21. BIN 3.3.SimpleComposition/Videos/video2.mov
  22. +14 −0 3.3.SimpleComposition/main.m
  23. +18 −0 3.3.SimpleExport/Classes/SimpleExportAppDelegate.h
  24. +85 −0 3.3.SimpleExport/Classes/SimpleExportAppDelegate.m
  25. +18 −0 3.3.SimpleExport/Classes/SimpleExportViewController.h
  26. +93 −0 3.3.SimpleExport/Classes/SimpleExportViewController.m
  27. +444 −0 3.3.SimpleExport/MainWindow.xib
  28. +20 −0 3.3.SimpleExport/README.rtf
  29. BIN 3.3.SimpleExport/Resources/Icon-72.png
  30. BIN 3.3.SimpleExport/Resources/Icon-Small-50.png
  31. BIN 3.3.SimpleExport/Resources/Icon-Small.png
  32. BIN 3.3.SimpleExport/Resources/Icon-Small@2x.png
  33. BIN 3.3.SimpleExport/Resources/Icon.png
  34. BIN 3.3.SimpleExport/Resources/Icon@2x.png
  35. +37 −0 3.3.SimpleExport/SimpleExport-Info.plist
  36. +320 −0 3.3.SimpleExport/SimpleExport.xcodeproj/project.pbxproj
  37. +581 −0 3.3.SimpleExport/SimpleExportViewController.xib
  38. +4 −0 3.3.SimpleExport/SimpleExport_Prefix.pch
  39. BIN 3.3.SimpleExport/Videos/video1.mov
  40. BIN 3.3.SimpleExport/Videos/video2.mov
  41. +14 −0 3.3.SimpleExport/main.m
  42. +14 −0 3.3.TextCrawl/Classes/PlayerView.h
  43. +23 −0 3.3.TextCrawl/Classes/PlayerView.m
  44. +19 −0 3.3.TextCrawl/Classes/TextCrawlAppDelegate.h
  45. +85 −0 3.3.TextCrawl/Classes/TextCrawlAppDelegate.m
  46. +19 −0 3.3.TextCrawl/Classes/TextCrawlViewController.h
  47. +103 −0 3.3.TextCrawl/Classes/TextCrawlViewController.m
  48. +563 −0 3.3.TextCrawl/MainWindow.xib
  49. +25 −0 3.3.TextCrawl/README.rtf
  50. BIN 3.3.TextCrawl/Resources/Icon-72.png
  51. BIN 3.3.TextCrawl/Resources/Icon-Small-50.png
  52. BIN 3.3.TextCrawl/Resources/Icon-Small.png
  53. BIN 3.3.TextCrawl/Resources/Icon-Small@2x.png
  54. BIN 3.3.TextCrawl/Resources/Icon.png
  55. BIN 3.3.TextCrawl/Resources/Icon@2x.png
  56. +37 −0 3.3.TextCrawl/TextCrawl-Info.plist
  57. +318 −0 3.3.TextCrawl/TextCrawl.xcodeproj/project.pbxproj
  58. +618 −0 3.3.TextCrawl/TextCrawlViewController.xib
  59. +4 −0 3.3.TextCrawl/TextCrawl_Prefix.pch
  60. BIN 3.3.TextCrawl/Videos/video1.mov
  61. +14 −0 3.3.TextCrawl/main.m
  62. +19 −0 3.3.TextCrawlExport/Classes/TextCrawlExportAppDelegate.h
  63. +85 −0 3.3.TextCrawlExport/Classes/TextCrawlExportAppDelegate.m
  64. +19 −0 3.3.TextCrawlExport/Classes/TextCrawlExportViewController.h
  65. +162 −0 3.3.TextCrawlExport/Classes/TextCrawlExportViewController.m
  66. +533 −0 3.3.TextCrawlExport/MainWindow.xib
  67. +20 −0 3.3.TextCrawlExport/README.rtf
  68. BIN 3.3.TextCrawlExport/Resources/Icon-72.png
  69. BIN 3.3.TextCrawlExport/Resources/Icon-Small-50.png
  70. BIN 3.3.TextCrawlExport/Resources/Icon-Small.png
  71. BIN 3.3.TextCrawlExport/Resources/Icon-Small@2x.png
  72. BIN 3.3.TextCrawlExport/Resources/Icon.png
  73. BIN 3.3.TextCrawlExport/Resources/Icon@2x.png
  74. +37 −0 3.3.TextCrawlExport/TextCrawlExport-Info.plist
  75. +316 −0 3.3.TextCrawlExport/TextCrawlExport.xcodeproj/project.pbxproj
  76. +579 −0 3.3.TextCrawlExport/TextCrawlExportViewController.xib
  77. +4 −0 3.3.TextCrawlExport/TextCrawlExport_Prefix.pch
  78. BIN 3.3.TextCrawlExport/Videos/video1.mov
  79. +14 −0 3.3.TextCrawlExport/main.m
  80. +14 −0 3.3.Xfading/Classes/PlayerView.h
  81. +23 −0 3.3.Xfading/Classes/PlayerView.m
  82. +19 −0 3.3.Xfading/Classes/XfadingAppDelegate.h
  83. +85 −0 3.3.Xfading/Classes/XfadingAppDelegate.m
  84. +17 −0 3.3.Xfading/Classes/XfadingViewController.h
  85. +130 −0 3.3.Xfading/Classes/XfadingViewController.m
  86. +444 −0 3.3.Xfading/MainWindow.xib
  87. +22 −0 3.3.Xfading/README.rtf
  88. BIN 3.3.Xfading/Resources/Icon-72.png
  89. BIN 3.3.Xfading/Resources/Icon-Small-50.png
  90. BIN 3.3.Xfading/Resources/Icon-Small.png
  91. BIN 3.3.Xfading/Resources/Icon-Small@2x.png
  92. BIN 3.3.Xfading/Resources/Icon.png
  93. BIN 3.3.Xfading/Resources/Icon@2x.png
  94. BIN 3.3.Xfading/Videos/video1.mov
  95. BIN 3.3.Xfading/Videos/video2.mov
  96. +37 −0 3.3.Xfading/Xfading-Info.plist
  97. +318 −0 3.3.Xfading/Xfading.xcodeproj/project.pbxproj
  98. +495 −0 3.3.Xfading/XfadingViewController.xib
  99. +4 −0 3.3.Xfading/Xfading_Prefix.pch
  100. +14 −0 3.3.Xfading/main.m
@@ -0,0 +1,7 @@
+.DS_Store
+.QTX-*
+*.mode1v3
+*.pbxuser
+xcuserdata
+project.xcworkspace
+*/build
@@ -0,0 +1,14 @@
+//
+// Created by 高橋啓治郎 on 11/1/1.
+// Copyright 2011 iOS 4 プログラミングブック. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@class AVPlayer;
+
+@interface PlayerView : UIView
+
+@property (nonatomic, retain) AVPlayer *player;
+
+@end
@@ -0,0 +1,23 @@
+//
+// Created by 高橋啓治郎 on 11/1/1.
+// Copyright 2011 iOS 4 プログラミングブック. All rights reserved.
+//
+
+#import <AVFoundation/AVFoundation.h>
+#import "PlayerView.h"
+
+@implementation PlayerView
+
++ (Class)layerClass {
+ return [AVPlayerLayer class];
+}
+
+- (AVPlayer *)player {
+ return [(AVPlayerLayer *)[self layer] player];
+}
+
+- (void)setPlayer:(AVPlayer *)player {
+ [(AVPlayerLayer *)[self layer] setPlayer:player];
+}
+
+@end
@@ -0,0 +1,19 @@
+//
+// Created by 高橋啓治郎 on 11/1/1.
+// Copyright 2011 iOS 4 プログラミングブック. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@class SimpleCompositionViewController;
+
+@interface SimpleCompositionAppDelegate : NSObject <UIApplicationDelegate> {
+ UIWindow *window;
+ SimpleCompositionViewController *viewController;
+}
+
+@property (nonatomic, retain) IBOutlet UIWindow *window;
+@property (nonatomic, retain) IBOutlet SimpleCompositionViewController *viewController;
+
+@end
+
@@ -0,0 +1,85 @@
+//
+// Created by 高橋啓治郎 on 11/1/1.
+// Copyright 2011 iOS 4 プログラミングブック. All rights reserved.
+//
+
+#import "SimpleCompositionAppDelegate.h"
+#import "SimpleCompositionViewController.h"
+
+@implementation SimpleCompositionAppDelegate
+
+@synthesize window;
+@synthesize viewController;
+
+
+#pragma mark -
+#pragma mark Application lifecycle
+
+- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
+
+ // Override point for customization after application launch.
+
+ // Add the view controller's view to the window and display.
+ [self.window addSubview:viewController.view];
+ [self.window makeKeyAndVisible];
+
+ 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, called instead of applicationWillTerminate: when the user quits.
+ */
+}
+
+
+- (void)applicationWillEnterForeground:(UIApplication *)application {
+ /*
+ Called as part of 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.
+ See also applicationDidEnterBackground:.
+ */
+}
+
+
+#pragma mark -
+#pragma mark Memory management
+
+- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application {
+ /*
+ Free up as much memory as possible by purging cached data objects that can be recreated (or reloaded from disk) later.
+ */
+}
+
+
+- (void)dealloc {
+ [viewController release];
+ [window release];
+ [super dealloc];
+}
+
+
+@end
@@ -0,0 +1,17 @@
+//
+// Created by 高橋啓治郎 on 11/1/1.
+// Copyright 2011 iOS 4 プログラミングブック. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@class PlayerView;
+
+@interface SimpleCompositionViewController : UIViewController;
+
+@property (nonatomic, retain) IBOutlet PlayerView *playerView;
+
+- (IBAction)rewind:(id)sender;
+
+@end
+
@@ -0,0 +1,53 @@
+//
+// Created by 高橋啓治郎 on 11/1/1.
+// Copyright 2011 iOS 4 プログラミングブック. All rights reserved.
+//
+
+#import <AVFoundation/AVFoundation.h>
+#import "SimpleCompositionViewController.h"
+#import "PlayerView.h"
+
+@implementation SimpleCompositionViewController
+
+@synthesize playerView;
+
+- (void)viewDidLoad {
+ [super viewDidLoad];
+
+ // アセット(video1.mov, video2.mov)の取得。
+ NSBundle *bundle = [NSBundle mainBundle];
+ NSURL *asset1Url = [bundle URLForResource:@"video1" withExtension:@"mov"];
+ NSURL *asset2Url = [bundle URLForResource:@"video2" withExtension:@"mov"];
+ AVURLAsset *asset1 = [AVURLAsset URLAssetWithURL:asset1Url options:nil];
+ AVURLAsset *asset2 = [AVURLAsset URLAssetWithURL:asset2Url options:nil];
+
+ // コンポジションの作成。
+ AVMutableComposition *composition = [AVMutableComposition composition];
+
+ // アセット1の0"-4"部分をコンポジションの先頭に挿入。
+ CMTimeRange range1 = CMTimeRangeMake(kCMTimeZero, CMTimeMake(4, 1));
+ [composition insertTimeRange:range1 ofAsset:asset1 atTime:kCMTimeZero error:nil];
+
+ // アセット2の4"-6"部分をコンポジションの2"に挿入。
+ CMTimeRange range2 = CMTimeRangeMake(CMTimeMake(4, 1), CMTimeMake(2, 1));
+ [composition insertTimeRange:range2 ofAsset:asset2 atTime:CMTimeMake(2, 1) error:nil];
+
+ // コンポジションをアセットとしてプレイヤーアイテムを作成。
+ AVPlayerItem *playerItem = [AVPlayerItem playerItemWithAsset:composition];
+
+ // プレイヤービューで再生を開始。
+ self.playerView.player = [AVPlayer playerWithPlayerItem:playerItem];
+ [self.playerView.player play];
+}
+
+// 巻き戻しボタンの押下。
+- (IBAction)rewind:(id)sender {
+ [self.playerView.player seekToTime:kCMTimeZero];
+ [self.playerView.player play];
+}
+
+- (void)dealloc {
+ [super dealloc];
+}
+
+@end
Oops, something went wrong.

0 comments on commit ac80749

Please sign in to comment.