Ron Garret | 16 Jul 01:13

Small bug in iSight camera window code

Below is some code that displays video from an iSight camera.  It  
works, but for some reason it doesn't actually start displaying until  
you move the window.  I would have thought that the call to  
setNeedsDisplay would take care of this but it doesn't.  Any Cocoa  
experts out there tell me what I'm doing wrong?

Thanks,
rg

---

(objc:load-framework "QTKit" :qtkit)
(#/inputDevices ns:q-t-capture-device)
(setf devs (#/inputDevicesWithMediaType: ns:q-t-capture-device  
#&QTMediaTypeVideo))
(setf cam (#/objectAtIndex: devs 0))
(%stack-block ((err 8)) (#/open: cam err))
(setf caminput (make-instance ns:q-t-capture-device-input))
(#/initWithDevice: caminput cam)
(setf session (make-instance ns:q-t-capture-session))
(#/init session)
(%stack-block ((err 8)) (#/addInput:error: session caminput err))

(defparameter +standard-window-style-mask+
   (logior #$NSTitledWindowMask
           #$NSClosableWindowMask
           #$NSMiniaturizableWindowMask
           #$NSResizableWindowMask))

(defun make-ns-window (x y &optional (title "Untitled"))
(Continue reading)


Gmane