0

I'm trying to do some screen capturing on Mac OS using the standard CGDisplayStreamCreateWithDispatchQueue API, however I keep getting a NULL stream Ref when I call the API, and there is apparently no error information so I can't figure ut why it is failing.

I have tried code from these two sources (with minor tweaks when needed):

Capture screen with CGDisplayStream https://github.com/diederickh/screen_capture/blob/master/src/test/test_mac_api_research.m

I have also tried CGDisplayStreamCreate(), and using a variety of resolutions and pixel formats. I have also confirmed CGGetActiveDisplayList is returning back one CGDirectDisplayID which I am passing to the API call.

Can anyone suggest what might be causing this silent failure?

Thanks.

Locksleyu
  • 5,192
  • 8
  • 52
  • 77

1 Answers1

0

I figured out the problem. It appears either I had accidentally clicked 'No' to the screen sharing permissions, or it hadn't come up. In any case, using the command in this question I was able to reset things and now it works.

How to trigger screen recording permission system modal dialog on macOS Catalina

Locksleyu
  • 5,192
  • 8
  • 52
  • 77