开发者

Is there an easy way to change a device in QTCaptureSession

Is there an easy way to change an audio/video device in QTCaptureSession other than enumarating over an array of devices from...

[captureSession inputs]; 

Checking to see whether the device is QTMediaTypeSound or QTMediaTypeVideo and d开发者_开发问答eleting them?


That depends on what you mean by "easy".

From the top of my head, there are the following options:

  1. Have an instance variable for the inputs you want to remove later, in the first place.
  2. Query the array returned from -[QTCaptureSession inputs] by sending filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"device.mediaType == \"%@\"", type] to it.
  3. If you are targeting ≥ 10.6 you have the added option of using indexesOfObjectsPassingTest: to determine the inputs you want to remove.

But there is no way (at least none, that I know of) of saying removeInputsWithMediaType:.

HTH

Daniel

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜