From a2bf12741e0cdc01351f3833a5d3d1a8e3d343da Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Wed, 29 Apr 2020 22:11:05 +0200 Subject: [PATCH] Screen cap. mac: capture RGB --- src/video_capture/screen_osx.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/video_capture/screen_osx.c b/src/video_capture/screen_osx.c index 477c060a3..fbb0d3f18 100644 --- a/src/video_capture/screen_osx.c +++ b/src/video_capture/screen_osx.c @@ -3,7 +3,7 @@ * @author Martin Pulec */ /* - * Copyright (c) 2012-2013 CESNET, z.s.p.o. + * Copyright (c) 2012-2020 CESNET, z.s.p.o. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -95,7 +95,7 @@ static void initialize(struct vidcap_screen_osx_state *s) { s->tile->height = CGImageGetHeight(image); CFRelease(image); - s->frame->color_spec = RGBA; + s->frame->color_spec = RGB; if(s->fps > 0.0) { s->frame->fps = s->fps; } else { @@ -225,14 +225,15 @@ static struct video_frame * vidcap_screen_osx_grab(void *state, struct audio_fra CFDataRef data = CGDataProviderCopyData(CGImageGetDataProvider(image)); const unsigned char *pixels = CFDataGetBytePtr(data); - int linesize = s->tile->width * 4; + int src_linesize = s->tile->width * 4; + int dst_linesize = vc_get_linesize(s->tile->width, s->frame->color_spec); int y; unsigned char *dst = (unsigned char *) s->tile->data; const unsigned char *src = (const unsigned char *) pixels; for(y = 0; y < (int) s->tile->height; ++y) { - vc_copylineRGBA (dst, src, linesize, 16, 8, 0); - src += linesize; - dst += linesize; + vc_copylineRGBAtoRGBwithShift(dst, src, dst_linesize, 16, 8, 0); + src += src_linesize; + dst += dst_linesize; } CFRelease(data);