mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-09-20 04:42:18 +02:00
add pixel format check for iosurfaces
This commit is contained in:
parent
d97250933b
commit
d9e1362cce
@ -259,6 +259,11 @@ texture_t texture_create_from_iosurface(device_t device, void *iosurf)
|
||||
struct gs_texture_2d *tex = bmalloc(sizeof(struct gs_texture_2d));
|
||||
memset(tex, 0, sizeof(struct gs_texture_2d));
|
||||
|
||||
OSType pf = IOSurfaceGetPixelFormat(ref);
|
||||
if (pf != 'BGRA')
|
||||
blog(LOG_ERROR, "Unexpected pixel format: %d (%c%c%c%c)", pf,
|
||||
pf >> 24, pf >> 16, pf >> 8, pf);
|
||||
|
||||
const enum gs_color_format color_format = GS_BGRA;
|
||||
|
||||
tex->base.device = device;
|
||||
@ -325,6 +330,11 @@ bool texture_rebind_iosurface(texture_t texture, void *iosurf)
|
||||
struct gs_texture_2d *tex = (struct gs_texture_2d*)texture;
|
||||
IOSurfaceRef ref = (IOSurfaceRef)iosurf;
|
||||
|
||||
OSType pf = IOSurfaceGetPixelFormat(ref);
|
||||
if (pf != 'BGRA')
|
||||
blog(LOG_ERROR, "Unexpected pixel format: %d (%c%c%c%c)", pf,
|
||||
pf >> 24, pf >> 16, pf >> 8, pf);
|
||||
|
||||
if (tex->width != IOSurfaceGetWidth(ref) ||
|
||||
tex->height != IOSurfaceGetHeight(ref))
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user