simple uvc implementation for os x
Libuvcc in no way implements all of the uvc-standard. It's main purpose is help people control some of the basic functions available in their webcams.
This is very much an alpha-release, return values and function arguments may very well change in future releases.
Bug reports are always welcome at email@example.com@firstname.lastname@example.org
uvccInit() (normally when your program starts).
Get a hold of your cam using one of the uvccGetCam... functions.
Make sure your cam supports the request you want to send by calling uvccCamSupportsRequest(). You can also use uvccSendInfoRequest() with the appropiet params and & the result with Info flags, this however is much slower as it includes sending a request to the cam which in turn means you have to open it first.
Open the cam using uvccOpenCam() when you want to send requests to it. Don't keep it open if you don't need it, opening it means you have exclusive access to the default control pipe on the video control interface.
If you're setting a numerical value (not on/off) get the min/max/res values and make sure your value is usable by
valuen = n * (max - min) / res where
min ≤ valuen ≤ max.
uvccCloseCam() when you're done sending requests. You can open/close a cam as many times as you want.
When you're done with your cam release it using uvccReleaseCam().
uvccExit() (normally when your program exits).
iSight (at least the one in the early 2013 models) does not support opening the default control pipe while streaming video.
log(int lvl, char *s, IOReturn r)then switch lvl if !logger
Using IOUSBDeviceInterface320 means IOUSBFamily v3.2.0 or above is required, that is os x >= 10.5.4. If anyone wants it's most certainly possible to rewrite for earlier versions.
The code looks a bit incoherent, think of it as everything that is directly callable by a user is ObjC-formatted and the other stuff is more c. Just wanted to point out that i'm not a big fan of oop. not a big fan at all..
Look at "Mac OS X 10.6 Core Library > Drivers, Kernel & Hardware > User-Space Device Access > USB Device Inteface Guide" (especially the SampleUSBMIDIDriver and Deva_Example projects), USBProberV2 ( http://opensource.apple.com/source/IOUSBFamily/IOUSBFamily-540.4.1/USBProberV2 ), Dominic Szablewski's uvc camera control ( http://www.phoboslab.org/log/2009/07/uvc-camera-control-for-mac-os-x ) and the libusb project ( http://libusb.org ) to see where this code came from..