У меня возникают проблемы при рисовании NSCIImageRep, который я получаю через QTKit mCaptureDecompressedVideoOutput.
Поскольку я не хочу рисовать изображение с использованием OpenGL, я попытался создать подкласс NSView и нарисовать там изображение:
- (void) drawRect:(NSRect)dirtyRect
{
NSLog(@"DrawInRect");
CGContextRef myContext = [[NSGraphicsContext currentContext] graphicsPort];
if (imageRep != nil)
{
CGImageRef image = [imageRep CGImageForProposedRect: &dirtyRect context: [NSGraphicsContext currentContext] hints:nil];
CGContextDrawImage(myContext, dirtyRect, image);
CGImageRelease(image);
}
}
imageRep - указатель на CGImageRef, который я получаю черезОбратный вызов mCaptureDecompressedVideoOutput
- (void)captureOutput:(QTCaptureOutput *)captureOutput didOutputVideoFrame:(CVImageBufferRef)videoFrame withSampleBuffer:(QTSampleBuffer *)sampleBuffer fromConnection:(QTCaptureConnection *)connection`.
Этот код дает сбой моей машине.Какие-либо предложения?