1

Which API would be appropriate to display the normal screen in a view? Conceptually, I would like to take the live video that would normally be the full screen, and display that in a view in a kiosk kind of mode? Would that be out of stream and impossible with public APIs?

Any suggestions or pointers would be greatly appreciated.

smokris
  • 11,740
  • 2
  • 39
  • 59
uchuugaka
  • 12,679
  • 6
  • 37
  • 55

1 Answers1

2

The Core Graphics API provides a set of functions enabling a block to be invoked every time a new screen frame is ready:

You could take the IOSurface provided by that API and display it in your own kiosk window.

This question provides some sample code for the CGDisplayStream API, and this sample code demonstrates how to render an IOSurface to an NSOpenGLView.

Community
  • 1
  • 1
smokris
  • 11,740
  • 2
  • 39
  • 59
  • This sounds right on course. Would this potentially allow creating a virtual display in a view or window? Or am I thinking in black holes? – uchuugaka Dec 27 '13 at 16:20
  • I looked at the stream API and it looks geared toward streaming a display's buffer somewhere but trying to do it on the same display would be crazy unless I could create a context that renders out of stream. I would almost need to render every other frame and stream in between frames... Does it make sense? – uchuugaka Dec 27 '13 at 16:24
  • What I'm thinking of is how iChat / Messages renders my screen in a tiny window while viewing another persons shared screen. – uchuugaka Dec 27 '13 at 16:25
  • @uchuugaka: You could take the image CGDisplayStream gives you (it's basically an OpenGL texture) and render it to a window, or render it full-screen on a different display. – smokris Dec 27 '13 at 19:55
  • But if the destination is on the same display, it will be a video feedback loop (infinite tunnel) at best. Unless there is a way to exclude a window or context from being in the stream. – uchuugaka Dec 28 '13 at 00:28
  • If you want to exclude certain windows from the capture, you could instead use the CGWindow API. See [this sample code](https://developer.apple.com/library/mac/samplecode/SonOfGrab/Introduction/Intro.html). – smokris Dec 28 '13 at 16:33