Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed a couple of the warnings about not having a root view controlle…

…r in the sample applications. Made setting the video camera rotation a little more thread safe.
  • Loading branch information...
commit cf29a44c83f56f14d102035c6d50e27e21e31a8b 1 parent 9f6d775
Brad Larson authored
3  examples/CubeExample/Classes/CubeExampleAppDelegate.m
View
@@ -13,7 +13,8 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
rootViewController = [[DisplayViewController alloc] initWithNibName:nil bundle:nil];
[self.window addSubview:rootViewController.view];
-
+ self.window.rootViewController = rootViewController;
+
[self.window makeKeyAndVisible];
return YES;
1  examples/MultiViewFilterExample/MultiViewFilterExample/MultiViewAppDelegate.m
View
@@ -19,6 +19,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
rootViewController = [[MultiViewViewController alloc] initWithNibName:nil bundle:nil];
[self.window addSubview:rootViewController.view];
+ self.window.rootViewController = rootViewController;
[self.window makeKeyAndVisible];
return YES;
}
3  examples/SimpleVideoFilter/SimpleVideoFilter/SimpleVideoFilterAppDelegate.m
View
@@ -22,6 +22,9 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
[self.window addSubview:rootViewController.view];
[self.window makeKeyAndVisible];
+ [self.window layoutSubviews];
+ self.window.rootViewController = rootViewController;
+
return YES;
}
1  examples/SimpleVideoFilter/SimpleVideoFilter/SimpleVideoFilterViewController.m
View
@@ -52,6 +52,7 @@ - (void)viewDidLoad
unlink([pathToMovie UTF8String]); // If a file already exists, AVAssetWriter won't let you record new frames, so delete the old movie
NSURL *movieURL = [NSURL fileURLWithPath:pathToMovie];
movieWriter = [[GPUImageMovieWriter alloc] initWithMovieURL:movieURL size:CGSizeMake(480.0, 640.0)];
+// movieWriter = [[GPUImageMovieWriter alloc] initWithMovieURL:movieURL size:CGSizeMake(640.0, 480.0)];
// movieWriter = [[GPUImageMovieWriter alloc] initWithMovieURL:movieURL size:CGSizeMake(720.0, 1280.0)];
// movieWriter = [[GPUImageMovieWriter alloc] initWithMovieURL:movieURL size:CGSizeMake(1080.0, 1920.0)];
[filter addTarget:movieWriter];
56 framework/Source/GPUImageVideoCamera.m
View
@@ -550,37 +550,39 @@ - (void)setAudioEncodingTarget:(GPUImageMovieWriter *)newValue;
- (void)setOutputImageOrientation:(UIInterfaceOrientation)newValue;
{
- _outputImageOrientation = newValue;
-
-// From the iOS 5.0 release notes:
-// In previous iOS versions, the front-facing camera would always deliver buffers in AVCaptureVideoOrientationLandscapeLeft and the back-facing camera would always deliver buffers in AVCaptureVideoOrientationLandscapeRight.
-
- if ([self cameraPosition] == AVCaptureDevicePositionBack)
- {
- switch(_outputImageOrientation)
+ runSynchronouslyOnVideoProcessingQueue(^{
+ _outputImageOrientation = newValue;
+
+ // From the iOS 5.0 release notes:
+ // In previous iOS versions, the front-facing camera would always deliver buffers in AVCaptureVideoOrientationLandscapeLeft and the back-facing camera would always deliver buffers in AVCaptureVideoOrientationLandscapeRight.
+
+ if ([self cameraPosition] == AVCaptureDevicePositionBack)
{
- case UIInterfaceOrientationPortrait:outputRotation = kGPUImageRotateRight; break;
- case UIInterfaceOrientationPortraitUpsideDown:outputRotation = kGPUImageRotateLeft; break;
- case UIInterfaceOrientationLandscapeLeft:outputRotation = kGPUImageNoRotation; break;
- case UIInterfaceOrientationLandscapeRight:outputRotation = kGPUImageRotate180; break;
+ switch(_outputImageOrientation)
+ {
+ case UIInterfaceOrientationPortrait:outputRotation = kGPUImageRotateRight; break;
+ case UIInterfaceOrientationPortraitUpsideDown:outputRotation = kGPUImageRotateLeft; break;
+ case UIInterfaceOrientationLandscapeLeft:outputRotation = kGPUImageNoRotation; break;
+ case UIInterfaceOrientationLandscapeRight:outputRotation = kGPUImageRotate180; break;
+ }
}
- }
- else
- {
- switch(_outputImageOrientation)
+ else
{
- case UIInterfaceOrientationPortrait:outputRotation = kGPUImageRotateRight; break;
- case UIInterfaceOrientationPortraitUpsideDown:outputRotation = kGPUImageRotateLeft; break;
- case UIInterfaceOrientationLandscapeLeft:outputRotation = kGPUImageRotate180; break;
- case UIInterfaceOrientationLandscapeRight:outputRotation = kGPUImageNoRotation; break;
+ switch(_outputImageOrientation)
+ {
+ case UIInterfaceOrientationPortrait:outputRotation = kGPUImageRotateRight; break;
+ case UIInterfaceOrientationPortraitUpsideDown:outputRotation = kGPUImageRotateLeft; break;
+ case UIInterfaceOrientationLandscapeLeft:outputRotation = kGPUImageRotate180; break;
+ case UIInterfaceOrientationLandscapeRight:outputRotation = kGPUImageNoRotation; break;
+ }
}
- }
-
- for (id<GPUImageInput> currentTarget in targets)
- {
- NSInteger indexOfObject = [targets indexOfObject:currentTarget];
- [currentTarget setInputRotation:outputRotation atIndex:[[targetTextureIndices objectAtIndex:indexOfObject] integerValue]];
- }
+
+ for (id<GPUImageInput> currentTarget in targets)
+ {
+ NSInteger indexOfObject = [targets indexOfObject:currentTarget];
+ [currentTarget setInputRotation:outputRotation atIndex:[[targetTextureIndices objectAtIndex:indexOfObject] integerValue]];
+ }
+ });
}
@end
Please sign in to comment.
Something went wrong with that request. Please try again.