Skip to content

Commit

Permalink
Revert "Fix for #1 Color issues."
Browse files Browse the repository at this point in the history
This reverts commit e08de74.
  • Loading branch information
vade committed Dec 12, 2014
1 parent e08de74 commit 173fced
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 28 deletions.
1 change: 0 additions & 1 deletion v002 Media Tools/v002_Screen_CapturePlugIn.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
CGDisplayStreamRef displayStream;
dispatch_queue_t displayQueue;
IOSurfaceRef updatedSurface;
CGColorSpaceRef colorspaceForDisplayID;
}
// Ports
@property (assign) NSUInteger inputDisplayID;
Expand Down
33 changes: 6 additions & 27 deletions v002 Media Tools/v002_Screen_CapturePlugIn.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
@interface v002_Screen_CapturePlugIn (Private)
- (IOSurfaceRef)copyNewFrame;
- (void)emitNewFrame:(IOSurfaceRef)frame;

@end
@implementation v002_Screen_CapturePlugIn

Expand Down Expand Up @@ -96,7 +95,6 @@ - (id)init
if (self)
{
displayQueue = dispatch_queue_create("info.v002.v002ScreenCaptureQueue", DISPATCH_QUEUE_SERIAL);
colorspaceForDisplayID = NULL;
}

return self;
Expand All @@ -106,10 +104,6 @@ - (void) dealloc
{
dispatch_release(displayQueue);
if (displayStream) CFRelease(displayStream);

if(colorspaceForDisplayID)
CGColorSpaceRelease(colorspaceForDisplayID);

[super dealloc];
}

Expand Down Expand Up @@ -168,26 +162,6 @@ - (BOOL)execute:(id <QCPlugInContext>)context atTime:(NSTimeInterval)time withAr
// create a new CGDisplayStream
CGDirectDisplayID display = (CGDirectDisplayID) self.inputDisplayID;

// get the Colorspace from the displayID
for(NSScreen* screen in [NSScreen screens])
{
NSDictionary* screenDictionary = [screen deviceDescription];
NSNumber* screenID = [screenDictionary objectForKey:@"NSScreenNumber"];
CGDirectDisplayID screenDisplayID = [screenID unsignedIntValue];

if(display == screenDisplayID)
{
if(colorspaceForDisplayID)
{
CGColorSpaceRelease(colorspaceForDisplayID);
colorspaceForDisplayID = NULL;
}
colorspaceForDisplayID = CGColorSpaceRetain([screen colorSpace].CGColorSpace);

break;
}
}

CGDisplayModeRef mode = CGDisplayCopyDisplayMode(display);

size_t pixelWidth = CGDisplayModeGetPixelWidth(mode);
Expand All @@ -213,17 +187,22 @@ - (BOOL)execute:(id <QCPlugInContext>)context atTime:(NSTimeInterval)time withAr
});

CGDisplayStreamStart(displayStream);

}

IOSurfaceRef frameSurface = [self copyNewFrame];
if (frameSurface)
{
v002IOSurfaceImageProvider *output = [[v002IOSurfaceImageProvider alloc] initWithSurface:frameSurface isFlipped:YES colorSpace:colorspaceForDisplayID shouldColorMatch:YES];
CGColorSpaceRef cspace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB);

v002IOSurfaceImageProvider *output = [[v002IOSurfaceImageProvider alloc] initWithSurface:frameSurface isFlipped:YES colorSpace:cspace shouldColorMatch:YES];

// v002IOSurfaceImageProvider has retained the surface and marked it as in use, so we can unmark it and release it now
CFRelease(frameSurface);
IOSurfaceDecrementUseCount(frameSurface);

CGColorSpaceRelease(cspace);

self.outputImage = output;

[output release];
Expand Down

0 comments on commit 173fced

Please sign in to comment.