72 CVOpenGLTextureCacheCreateTextureFromImage(NULL, _sci->textureCache, pixelBuffer, NULL, &texture);
128 if ( (rectangle.center.x-rectangle.size.x/2.) >= screen.width
129 || (rectangle.center.y-rectangle.size.y/2.) >= screen.height)
141 sci->
queue = dispatch_queue_create(
"org.vuo.VuoScreenCapture", NULL);
144 dispatch_sync(dispatch_get_main_queue(), ^{
150 sci->
session.sessionPreset = AVCaptureSessionPresetPhoto;
153 AVCaptureScreenInput *input = [[AVCaptureScreenInput alloc] initWithDisplayID:screen.id];
154 input.minFrameDuration = CMTimeMake(1, 120);
156 double width = rectangle.size.x;
158 width = screen.width;
160 double height = rectangle.size.y;
162 height = screen.height;
164 input.cropRect = CGRectMake(
165 (
int)(rectangle.center.x - rectangle.size.x/2.),
166 (
int)(screen.height - (rectangle.center.y - rectangle.size.y/2.) - height),
170 [sci->session addInput:input];
175 AVCaptureVideoDataOutput *output = [AVCaptureVideoDataOutput new];
176 [output setAlwaysDiscardsLateVideoFrames:YES];
177 [output setSampleBufferDelegate:sci->delegate queue:sci->queue];
178 [sci->session addOutput:output];
184#pragma clang diagnostic push
185#pragma clang diagnostic ignored "-Wdeprecated-declarations"
187 __block CVReturn ret;
189 ret = CVOpenGLTextureCacheCreate(NULL,
191 (NSString *)kCVOpenGLTextureCacheChromaSamplingModeKey: (NSString *)kCVOpenGLTextureCacheChromaSamplingModeBestPerformance
194 CGLReleasePixelFormat(pf);
195#pragma clang diagnostic pop
197 if (ret != kCVReturnSuccess)
199 VUserLog(
"Error: Couldn't create texture cache: %d", ret);
207 dispatch_sync(dispatch_get_main_queue(), ^{
209 [sci->session startRunning];