开发者

Low-level multimedia and mouse support in Cocoa?

I'm in the planning phase for a new application I'm writing for OS X. This would be my first app开发者_如何学Golication using Cocoa. The app requires API functionality to perform the following tasks:

  • Capture arbitrary portions of the screen (up to several frames per second) (also displaying the mouse pointer, if possible)
  • Capture all audio output being generated by the sound card
  • Manipulate the mouse programmatically (move and click)

Does Cocoa have API functionality for these requirements? If not, what would be a good alternative?

(Note: From my requirements, it may seem that the application could be malware. However, I assure you it is not - it will be a sort of macro recorder/playback mechanism for streamlining media consumption). Thanks, everyone! :)


  • Here's some sample code for screen recording using OpenGL: http://developer.apple.com/library/mac/#samplecode/OpenGLScreenCapture/Introduction/Intro.html#//apple_ref/doc/uid/DTS10004445 It doesn't capture the mouse, but you can artificially superimpose it using NSImage.

  • For audio recording, there's an opensource application called Soundflower that reroutes the computer's audio output and makes the OS treat it like input device. Warning, it is very very complicated as is most programatic audio manipulation in OS X.

  • Mouse manipulation can be done with CGPostMouseEvent:

    CGPostMouseEvent(CGPoint mouseCursorPosition, boolean_t updateMouseCursorPosition, CGButtonCount buttonCount, boolean_t mouseButtonDown)
    
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜