On Jul 18, 2006, at 3:09 PM, Pierre-Olivier Latour wrote:
You could publish a port with this information.
Your best bet would be to connect the output of the Video Input
patch to an Input Splitter whose type is boolean. If the sequence
grabber initialization fails, it will output nil images which are
typecast to false over the Input Splitter. Publish the output of
the splitter and use -valueForOutputKey in your code.
Thanks for the very clever suggestion! It works fine in QC, but
from my app -valueForOutputKey: seems to return before the video
is quite established, giving a false negative. Not sure how I
would go about stalling or delaying the output of a published
port... Or is there another QC way? Right now, in my app, I have
to detach a thread, sleep, and then do -valueForOutputKey: from
the thread, which is ugly, to say the least.
That is not accessing QC in a thread-safe manner which is a
potential crasher. Just do [self performSelector:afterDelay:] on
your app controller object.
Wow, I never noticed the afterDelay: form of performSelector:. This
works great now.
Thanks, Pierre!