Skip to content

Commit

Permalink
Merge pull request BradLarson#1486 from liaomiao/master
Browse files Browse the repository at this point in the history
added processDataForTimestamp to GPUImageRawDataInput
  • Loading branch information
BradLarson committed Mar 30, 2014
2 parents 9cc022b + 3209992 commit 58708f8
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions framework/Source/GPUImageRawDataInput.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ typedef enum {
// Image rendering
- (void)updateDataFromBytes:(GLubyte *)bytesToUpload size:(CGSize)imageSize;
- (void)processData;
- (void)processDataForTimestamp:(CMTime)frameTime;
- (CGSize)outputImageSize;

@end
24 changes: 24 additions & 0 deletions framework/Source/GPUImageRawDataInput.m
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,30 @@ - (void)processData;
});
}

- (void)processDataForTimestamp:(CMTime)frameTime;
{
if (dispatch_semaphore_wait(dataUpdateSemaphore, DISPATCH_TIME_NOW) != 0)
{
return;
}

runAsynchronouslyOnVideoProcessingQueue(^{

CGSize pixelSizeOfImage = [self outputImageSize];

for (id<GPUImageInput> currentTarget in targets)
{
NSInteger indexOfObject = [targets indexOfObject:currentTarget];
NSInteger textureIndexOfTarget = [[targetTextureIndices objectAtIndex:indexOfObject] integerValue];

[currentTarget setInputSize:pixelSizeOfImage atIndex:textureIndexOfTarget];
[currentTarget newFrameReadyAtTime:frameTime atIndex:textureIndexOfTarget];
}

dispatch_semaphore_signal(dataUpdateSemaphore);
});
}

- (CGSize)outputImageSize;
{
return uploadedImageSize;
Expand Down

0 comments on commit 58708f8

Please sign in to comment.