Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Golgafrincham

macrumors newbie
Original poster
Jan 29, 2014
17
27
UK
Hi,

I have finally taken the leap into actively developing code on OS X, but struggling to find answers regarding how certain aspects of the framework behaves under the covers. Does anybody know under what circumstances the AVFoundation framework refreshes it's view of the world with respect to available devices as returned by AVCaptureDevice devices and other related methods?

Whilst I can write stand alone programs based on the Apple documentation and many examples, able to spot the removal or addition of USB or other input devices if I attempt to perform the same operations from the internal code of a dynamically loaded library plugin (generic POSIX threads spawned at library load / initialisation time, however NSThread does indicate that the application is multi threaded) loaded into an existing third party OS X application the first call to AVCaptureDevice devices returns the appropriate information but subsequent calls return stale data, i.e.the data returned from the first call.

1) I am reasonably happy that the returned AVCaptureDevice objects are correctly released within my enumeration method, but I can revisit this if somebody knows AVFoundation does not do anything special to cache device information using a different mechanism.

2) Should I be dispatching some / all of the AVCaptureDevice devices enumeration code on the thread of the main application runloop?

3) Could this be an autorelease pool usage issue? I have tried various pool configurations in my code without any change in behaviour.

This feels like an oversight on my part due to my limited Objective-C experience, but, I am also attempting to do something a little out of the scope of the AVFoundation documentation and examples owing to the dynamic library plugin and contexts within the process, hence me reaching out for advice on where to look next. The usual Google / Stack Overflow / Mac Rumors forum searches are currently drawing a blank.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.