I am getting an error –9405, couldntGetRequiredComponent
, with
SGNewChannel(m_Grabber, VideoMediaType, &m_Channel)
on Mac system 10.9.1. This code works on older systems. Is anyone else having this issue?
Edit - Initialization code:
// standard SG initialization
err = OpenADefaultComponent(SeqGrabComponentType, 0, &m_Grabber);
err = SGInitialize(m_Grabber);
err = SGSetDataRef(m_Grabber, 0, 0, seqGrabDontMakeMovie);
After spending some time reverse engineering what SGNewChannel
does on both OS X 10.8 and 10.9 I have found what might be the cause of the new behavior on 10.9.
The SGNewChannel
function tries to open a video digitizer component with some code roughly equivalent to this (minus the logs):
ComponentDescription componentDescription = {'vdig', 0, 0, 0, 0};
Component component = FindNextComponent(NULL, &componentDescription);
while (component)
{
Handle componentName = NewHandle(255);
Handle componentInfo = NewHandle(255);
GetComponentInfo(component, NULL, componentName, componentInfo, NULL);
ComponentInstance ci;
OSErr err = OpenAComponent(component, &ci);
printf("*** %5d (%p) %p %s -- %s\n", err, ci, component, P2CStr((StringPtr)*componentName), P2CStr((StringPtr)*componentInfo));
DisposeHandle(componentName);
DisposeHandle(componentInfo);
component = FindNextComponent(component, &componentDescription);
}
If you run this on 10.9, you will get this result:
DVFreeThread - CFMachPortCreateWithPort hack = 0x18caf0, fPowerNotifyPort= 0x18ce90
*** -9408 (0x0) 0x10207 DV Video -- This component is the FireWire Video Digitizer
*** 704 (0x0) 0x10216 IIDC FireWire Video -- This is the Apple IIDC FireWire Video Digitizer.
*** 704 (0x0) 0x10323 USB Video Class Video -- This is the Apple USB Video Class Video Digitizer.
The three calls to OpenAComponent
fail (once with error -9408 and twice with error 704).
If you run this on 10.8, you will get this result:
DVFreeThread - CFMachPortCreateWithPort hack = 0x5751a0, fPowerNotifyPort= 0x576cd0
*** -9408 (0x0) 0x10208 DV Video -- This component is the FireWire Video Digitizer
*** 704 (0x0) 0x10217 IIDC FireWire Video -- This is the Apple IIDC FireWire Video Digitizer.
*** 0 (0x830000) 0x10324 USB Video Class Video -- This is the Apple USB Video Class Video Digitizer.
Notice that the last calls succeeds!
The Apple USB Video Class Video Digitizer component is located at /System/Library/QuickTime/QuickTimeUSBVDCDigitizer.component
. So I looked at what’s different on 10.8 and 10.9 in this component by setting a symbolic breakpoint in lldb on APWVDOUSBVDCDigitizerEntry
which is the entry point of this component.
It turns out it may be a sandbox related issue. On 10.9, there is a call to sandbox_check
for device-camera
that doesn’t exist on 10.8. So I suggest that you try to add an entitlement to access the camera and see if that solves the problem.