3

I am developing a Desktop application that lists the webcams connected to the system. When the user selects the web-cam app streams from the device to the QTCaptureView. I have registered to the notification QTCaptureDeviceWasDisconnectedNotification and QTCaptureDeviceWasConnectedNotification so that I remove and add the device to the list whenever device is disconnected and connected.

The problem is that QTCaptureDeviceWasConnectedNotification is posted twice when a device is connected. What is the reason for this?

Also, in one of my Mac Book I get the following problem frequently. The device obtained from QTCaptureDeviceWasConnectedNotification 2nd notification (I get two notifications) does not have the localized description name. Could you please tell me what might have gone wrong here?

4

2 に答える 2

1

私も同じ問題を抱えていました。私の場合、このような興味深い動作の理由は、マイクが内蔵された Web カメラでした。そのため、このような多目的デバイスを接続すると、2 つの通知が表示されます。1 つはビデオ キャプチャ デバイス用で、もう 1 つは内蔵マイク用です。

これは、状況を理解するのを妨げた私の一般的な欠点のリストです (おそらく役立つでしょう):

  • マイク内蔵のウェブカメラを使用した
  • [QTCaptureDevice inputDevices] の代わりに [QTCaptureDevice inputDevicesWithMediaType:] が使用されました。そのため、接続されている他のタイプのデバイス (マイクなど) が表示されませんでした。
  • 私のテストでは、「ビデオ」デバイスがない場合は何も記録しませんでした。これが、接続された 2 つの通知 (ビデオ、ビデオ + マイク) と切断された通知 (-mic、-video) が 1 つだけ表示された理由です。最初は混乱しました。

ここに私のテストからのログがあります。

デバイス接続の最初の通知は次のとおりです。

Device++ #0: "AppleHDAEngineInput:1B,0,1,1:4" - "AppleHDA:12"
Device++ #1: "AppleHDAEngineInput:1B,0,1,0:3" - "AppleHDA:12"
Device++ #2: "0xfd100000046d0990" - "UVC Camera VendorID_1133 ProductID_2448"

UVCカメラ単体でご覧いただけます。2 番目の通知は次のとおりです。

Device++ #0: "AppleHDAEngineInput:1B,0,1,1:4" - "AppleHDA:12"
Device++ #1: "AppleUSBAudioEngine:Unknown Manufacturer:Logitech Camera:5895DC4F:3" - "AppleUSBAudioDevice:Logitech Camera"
Device++ #2: "AppleHDAEngineInput:1B,0,1,0:3" - "AppleHDA:12"
Device++ #3: "0xfd100000046d0990" - "UVC Camera VendorID_1133 ProductID_2448"

UVC カメラと AppleUSBAudioEngine (マイク) が表示されます。

デバイスのデタッチ時にも 2 つの通知があります。最初の1つ:

Device-- #0: "AppleHDAEngineInput:1B,0,1,1:4" - "AppleHDA:12"
Device-- #1: "AppleHDAEngineInput:1B,0,1,0:3" - "AppleHDA:12"
Device-- #2: "0xfd100000046d0990" - "UVC Camera VendorID_1133 ProductID_2448"

マイクはありませんが、UVC カメラはまだあります。2 回目の通知:

Device-- #0: "AppleHDAEngineInput:1B,0,1,1:4" - "AppleHDA:12"
Device-- #1: "AppleHDAEngineInput:1B,0,1,0:3" - "AppleHDA:12"

UVCカメラもマイクもありません。

また、QTKit は通知を「マージ」できる可能性があります。これは、通知が 1 つしかない場合があるため (接続用に 1 つ、切断用に 1 つ)、実際の通知数は、接続または切断された (サブ) デバイスの数だけではありません。

localizedDisplayName の場合 - まだ問題はありません。

于 2011-02-14T17:57:13.080 に答える