Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

TIP: Video input in compositions



I was browsing around some cool CI kernel demos on sam's blog - congrats by the way :)
http://www.samkass.com/blog/C1936590049/
and many of them requires a video input - I've seen some other compositions on the web do the same. Problem is that, if the camera is not connected or use by another app, you get no feedback at all, which can be strange to the user, so here's a trick:


Use a multiplexer (with its type set to Images in the Settings Inspector pane) to choose between the image coming from the video camera and a text image saying for instance "you need a video camera - please sure one is connected and no other application uses it". Now, all we need to do is to select one or the either depending on weither the video camera is available or not.

The multiplexer expects an Index value to select its current input and we cannot directly connect an image to an index input. However, an image can be converted to a Boolean: True if it exists, False if it does not, and a Boolean can be converted to an index: False -> 0 and True -> 1 (you still with me?). So just insert a Splitter (with its type set to Boolean in the Settings Inspector pane) and off you go:

If the Video Input patch produces images, the Splitter outputs True, and the Multiplexer selects input #1 which is the video. If the Video patch does not produce any imags, the Splitter outputs False and the Multiplexer selects input #0 which is our placeholder image.


PNG image



________________________________________________________
Pierre-Olivier Latour                            email@hidden
Quartz Composer Architect                Graphic & Imaging Team

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.