Mac 10.9.1上的SGNewChannel错误-9405

时间:2013-12-18 21:59:41

标签: macos video-capture macos-carbon

我收到错误-9405,couldntGetRequiredComponent

SGNewChannel(m_Grabber, VideoMediaType, &m_Channel)

在Mac系统10.9.1上。此代码适用于较旧的系统。还有其他人有这个问题吗?

修改 - 初始化代码:

// standard SG initialization 
err = OpenADefaultComponent(SeqGrabComponentType, 0, &m_Grabber); 
err = SGInitialize(m_Grabber); 
err = SGSetDataRef(m_Grabber, 0, 0, seqGrabDontMakeMovie);

1 个答案:

答案 0 :(得分:10)

花了一些时间对OS X 10.8和10.9上的SGNewChannel进行逆向工程后,我发现可能是10.9上新行为的原因。

SGNewChannel函数尝试打开视频数字化仪组件,其中一些代码与此大致相当(减去日志):

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);
}

如果你在10.9上运行它,你将得到这个结果:

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.

OpenAComponent的三次调用失败(一次错误-9408,两次错误704)。

如果你在10.8上运行它,你会得到这个结果:

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.

请注意,最后一次调用成功!

Apple USB视频类视频数字转换器组件位于/System/Library/QuickTime/QuickTimeUSBVDCDigitizer.component。所以我通过在APWVDOUSBVDCDigitizerEntry上的lldb中设置符号断点来查看此组件中10.8和10.9的不同之处,这是该组件的入口点。

事实证明这可能是与沙盒相关的问题。在10.9上,对sandbox_check的{​​{1}}的调用在10.8上不存在。因此,我建议您尝试添加权限以访问摄像头,看看是否能解决问题。