Skip to content

Commit

Permalink
By default, now send an indefinite frame time with GPUImageUIElement …
Browse files Browse the repository at this point in the history
…updates to prevent freezing of the output. -updateUsingCurrentTime still lets you record movies from UI elements.
  • Loading branch information
BradLarson committed May 2, 2014
1 parent 0cdf63d commit 429ccbd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
2 changes: 2 additions & 0 deletions framework/Source/GPUImageUIElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@
// Layer management
- (CGSize)layerSizeInPixels;
- (void)update;
- (void)updateUsingCurrentTime;
- (void)updateWithTimestamp:(CMTime)frameTime;

@end
16 changes: 13 additions & 3 deletions framework/Source/GPUImageUIElement.m
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,11 @@ - (CGSize)layerSizeInPixels;

- (void)update;
{
[GPUImageContext useImageProcessingContext];

[self updateWithTimestamp:kCMTimeIndefinite];
}

- (void)updateUsingCurrentTime;
{
if(CMTIME_IS_INVALID(time)) {
time = CMTimeMakeWithSeconds(0, 600);
actualTimeOfLastUpdate = [NSDate timeIntervalSinceReferenceDate];
Expand All @@ -71,6 +74,13 @@ - (void)update;
time = CMTimeAdd(time, CMTimeMakeWithSeconds(diff, 600));
actualTimeOfLastUpdate = now;
}

[self updateWithTimestamp:time];
}

- (void)updateWithTimestamp:(CMTime)frameTime;
{
[GPUImageContext useImageProcessingContext];

CGSize layerPixelSize = [self layerSizeInPixels];

Expand Down Expand Up @@ -105,7 +115,7 @@ - (void)update;
NSInteger textureIndexOfTarget = [[targetTextureIndices objectAtIndex:indexOfObject] integerValue];

[currentTarget setInputSize:layerPixelSize atIndex:textureIndexOfTarget];
[currentTarget newFrameReadyAtTime:time atIndex:textureIndexOfTarget];
[currentTarget newFrameReadyAtTime:frameTime atIndex:textureIndexOfTarget];
}
}
}
Expand Down

0 comments on commit 429ccbd

Please sign in to comment.