47 lines
1.3 KiB
Objective-C
Executable File
47 lines
1.3 KiB
Objective-C
Executable File
#import "GPUImageTextureInput.h"
|
|
|
|
@implementation GPUImageTextureInput
|
|
|
|
#pragma mark -
|
|
#pragma mark Initialization and teardown
|
|
|
|
- (id)initWithTexture:(GLuint)newInputTexture size:(CGSize)newTextureSize;
|
|
{
|
|
if (!(self = [super init]))
|
|
{
|
|
return nil;
|
|
}
|
|
|
|
runSynchronouslyOnVideoProcessingQueue(^{
|
|
[GPUImageContext useImageProcessingContext];
|
|
});
|
|
|
|
textureSize = newTextureSize;
|
|
|
|
runSynchronouslyOnVideoProcessingQueue(^{
|
|
outputFramebuffer = [[GPUImageFramebuffer alloc] initWithSize:newTextureSize overriddenTexture:newInputTexture];
|
|
});
|
|
|
|
return self;
|
|
}
|
|
|
|
#pragma mark -
|
|
#pragma mark Image rendering
|
|
|
|
- (void)processTextureWithFrameTime:(CMTime)frameTime;
|
|
{
|
|
runAsynchronouslyOnVideoProcessingQueue(^{
|
|
for (id<GPUImageInput> currentTarget in targets)
|
|
{
|
|
NSInteger indexOfObject = [targets indexOfObject:currentTarget];
|
|
NSInteger targetTextureIndex = [[targetTextureIndices objectAtIndex:indexOfObject] integerValue];
|
|
|
|
[currentTarget setInputSize:textureSize atIndex:targetTextureIndex];
|
|
[currentTarget setInputFramebuffer:outputFramebuffer atIndex:targetTextureIndex];
|
|
[currentTarget newFrameReadyAtTime:frameTime atIndex:targetTextureIndex];
|
|
}
|
|
});
|
|
}
|
|
|
|
@end
|