mfreerdp-server: cleanup

This commit is contained in:
C-o-r-E 2012-12-05 18:35:49 -05:00
parent 777bc6cd80
commit e9f008d161
3 changed files with 3 additions and 195 deletions

View File

@ -283,27 +283,6 @@ void mf_info_getScreenData(mfInfo* mfi, long* width, long* height, BYTE** pBits,
mf_mlion_get_pixelData(mfi->invalid.x / 2, mfi->invalid.y / 2, *width, *height, pBits);
/*
*width = (mfi->invalid.right - mfi->invalid.left);
*height = (mfi->invalid.bottom - mfi->invalid.top);
#ifdef WITH_WIN8
mf_dxgi_getPixelData(mfi, pBits, pitch, &mfi->invalid);
#else
{
long offset;
GETCHANGESBUF* changes;
changes = (GETCHANGESBUF*) mfi->changeBuffer;
*width += 1;
*height += 1;
offset = (4 * mfi->invalid.left) + (mfi->invalid.top * mfi->virtscreen_width * 4);
*pBits = ((BYTE*) (changes->Userbuffer)) + offset;
*pitch = mfi->virtscreen_width * 4;
}
#endif
*/
}
/*

View File

@ -21,8 +21,6 @@
#include <CoreGraphics/CoreGraphics.h>
#include "CoreVideo/CoreVideo.h"
//#include <pthread.h>
#include "mf_mountain_lion.h"
dispatch_semaphore_t region_sem;
@ -31,8 +29,6 @@ CGDisplayStreamRef stream;
CGDisplayStreamUpdateRef lastUpdate = NULL;
//pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
CVPixelBufferRef pxbuffer = NULL;
void *baseAddress = NULL;
@ -42,73 +38,13 @@ CGImageRef image = NULL;
void (^streamHandler)(CGDisplayStreamFrameStatus, uint64_t, IOSurfaceRef, CGDisplayStreamUpdateRef) = ^(CGDisplayStreamFrameStatus status, uint64_t displayTime, IOSurfaceRef frameSurface, CGDisplayStreamUpdateRef updateRef)
{
/*
if(displayTime - last_time < 500000000)
return;
last_time = displayTime;
*/
/*
printf("\tstatus: ");
switch(status)
{
case kCGDisplayStreamFrameStatusFrameComplete:
printf("Complete\n");
break;
case kCGDisplayStreamFrameStatusFrameIdle:
printf("Idle\n");
break;
case kCGDisplayStreamFrameStatusFrameBlank:
printf("Blank\n");
break;
case kCGDisplayStreamFrameStatusStopped:
printf("Stopped\n");
break;
}
printf("\ttime: %lld\n", displayTime);
*/
/*
const CGRect * rects;
size_t num_rects;
rects = CGDisplayStreamUpdateGetRects(updateRef, kCGDisplayStreamUpdateDirtyRects, &num_rects);
printf("\trectangles: %zd\n", num_rects);
dispatch_semaphore_wait(region_sem, DISPATCH_TIME_FOREVER);
if(clean == TRUE)
dirtyRegion = *rects;
for (size_t i = 0; i < num_rects; i++)
{
dirtyRegion = CGRectUnion(dirtyRegion, *(rects+i));
}
clean = FALSE;
dispatch_semaphore_signal(region_sem);
*/
dispatch_semaphore_wait(region_sem, DISPATCH_TIME_FOREVER);
//pthread_mutex_lock(&mutex);
if (lastUpdate == NULL)
{
CFRetain(updateRef);
lastUpdate = updateRef;
//lastUpdate = CGDisplayStreamUpdateCreateMergedUpdate(NULL, updateRef);
}
else
{
@ -119,7 +55,6 @@ void (^streamHandler)(CGDisplayStreamFrameStatus, uint64_t, IOSurfaceRef, CGDisp
}
dispatch_semaphore_signal(region_sem);
//pthread_mutex_unlock(&mutex);
};
int mf_mlion_screen_updates_init()
@ -226,7 +161,6 @@ int mf_mlion_get_dirty_region(RFX_RECT* invalid)
//it may be faster to copy the cgrect and then convert....
dispatch_semaphore_wait(region_sem, DISPATCH_TIME_FOREVER);
//pthread_mutex_lock(&mutex);
const CGRect * rects = CGDisplayStreamUpdateGetRects(lastUpdate, kCGDisplayStreamUpdateDirtyRects, &num_rects);
@ -253,7 +187,6 @@ int mf_mlion_get_dirty_region(RFX_RECT* invalid)
lastUpdate = NULL;
dispatch_semaphore_signal(region_sem);
//pthread_mutex_unlock(&mutex);
return 0;
}

View File

@ -94,19 +94,6 @@ BOOL mf_peer_check_fds(freerdp_peer* client)
mf_peer_rfx_update(client);
/*invalid_region = xfp->hdc->hwnd->invalid;
if (invalid_region->null == FALSE)
{
xf_peer_rfx_update(client, invalid_region->x, invalid_region->y,
invalid_region->w, invalid_region->h);
}
invalid_region->null = 1;
xfp->hdc->hwnd->ninvalid = 0;
*/
mf_event_free(event);
}
}
@ -124,100 +111,7 @@ void mf_peer_rfx_update(freerdp_peer* client)
if (mf_info_have_invalid_region(mfi) == false) {
return;
}
/*
printf("\tinvalid -> (%d,%d), (%d,%d)\n",
mfi->invalid.x,
mfi->invalid.y,
mfi->invalid.x + mfi->invalid.width,
mfi->invalid.y + mfi->invalid.height);
int bytewidth;
CGRect invRect;
invRect.origin.x = mfi->invalid.x /2;
invRect.origin.y = mfi->invalid.y / 2;
invRect.size.height = mfi->invalid.height / 2;
invRect.size.width = mfi->invalid.width / 2;
//CGImageRef image = CGDisplayCreateImage(kCGDirectMainDisplay); // Main screenshot capture call
CGImageRef image = CGDisplayCreateImageForRect(kCGDirectMainDisplay, invRect);
//CGSize frameSize = CGSizeMake(CGImageGetWidth(image), CGImageGetHeight(image)); // Get screenshot bounds
if (image == NULL) {
printf("image = null!!\n\n\n");
}
CGSize frameSize;
frameSize.width = 2880 / 2;
frameSize.height = 1800/ 2;
CFDictionaryRef opts;
long ImageCompatibility;
long BitmapContextCompatibility;
void * keys[3];
keys[0] = (void *) kCVPixelBufferCGImageCompatibilityKey;
keys[1] = (void *) kCVPixelBufferCGBitmapContextCompatibilityKey;
keys[2] = NULL;
void * values[3];
values[0] = (void *) &ImageCompatibility;
values[1] = (void *) &BitmapContextCompatibility;
values[2] = NULL;
opts = CFDictionaryCreate(kCFAllocatorDefault, (const void **) keys, (const void **) values, 2, NULL, NULL);
if (opts == NULL)
{
printf("failed to create dictionary\n");
//return 1;
}
CVPixelBufferRef pxbuffer = NULL;
CVReturn status = CVPixelBufferCreate(kCFAllocatorDefault, invRect.size.width,
invRect.size.height, kCVPixelFormatType_32ARGB, opts,
&pxbuffer);
if (status != kCVReturnSuccess)
{
printf("Failed to create pixel buffer! \n");
//return 1;
}
CFRelease(opts);
CVPixelBufferLockBaseAddress(pxbuffer, 0);
void *pxdata = CVPixelBufferGetBaseAddress(pxbuffer);
CGColorSpaceRef rgbColorSpace = CGColorSpaceCreateDeviceRGB();
CGContextRef context = CGBitmapContextCreate(pxdata,
invRect.size.width,
invRect.size.height, 8, 4*frameSize.width, rgbColorSpace,
kCGImageAlphaNoneSkipLast);
if (context == NULL) {
printf("context = null!!!\n\n\n");
}
printf("context = [%p], image = [%p]\n%fx%f\n",
context,
image,
invRect.size.width,
invRect.size.height);
CGContextDrawImage(context,
CGRectMake(0, 0, invRect.size.width, invRect.size.height),
//CGRectMake(invRect.origin.x, frameSize.height - invRect.origin.y, invRect.size.width, invRect.size.height),
//invRect,
image);
bytewidth = frameSize.width * 4; // Assume 4 bytes/pixel for now
bytewidth = (bytewidth + 3) & ~3; // Align to 4 bytes
*/
long width;
long height;
@ -277,6 +171,8 @@ void mf_peer_rfx_update(freerdp_peer* client)
mf_info_clear_invalid_region(mfi);
// note: need to stop getting new dirty rects until here
/*
CGColorSpaceRelease(rgbColorSpace);
CGImageRelease(image);