home *** CD-ROM | disk | FTP | other *** search
- (in-package :oou)
- (oou-provide :MR-vd)
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;; MR-vd.lisp
- ;;
- ;; Copyright ⌐ 1992 Northwestern University Institute for the Learning Sciences
- ;; All Rights Reserved
- ;;
- ;; author: Michael S. Engber
- ;; based on MACL 1.32 written by Mike Engber & Mike Korcuska
- ;;
- ;; video digitizer object for controling MoonRaker video digitizer boards
- ;; Note: MoonRaker boards require the WTI-VideoMgr init
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
- (oou-dependencies
- :video-digitizer
- :+Devices
- :traps-u
- :records-u
- )
-
- (export '(MR-vd
- use-gray-p sync-on-green-p ctSize MRvd-optimize-colors
- ))
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
- (eval-when (:compile-toplevel :load-toplevel :execute)
-
- (defrecord (MRCsParam :pointer)
- ;;MRCsParam records are passed into Control calls to the MoonRaker
- ;;driver. This argument is a pointer to a 22 block of memory which
- ;;corresponds to the csParam field of a ParamBlockRec which is
- ;;defined as: array[0..10] of integer. The use of these 22 bytes
- ;;varies, depending on the csCode.
- (variant
- ((csParam (array :integer 11)))
- ((ptr pointer))
- ((sv2-in1 integer) (sv2-in2 integer) (sv2-dst1 pointer) (sv2-dst2 pointer))
- ((cv2-src1 pointer) (cv2-dst1 pointer) (cv2-scr2 pointer) (cv2-dst2 pointer))
- ((cc-src pointer) (cc-dst pointer) (cc-offs longint) (cc-fcnt longint))
- ))
-
- (defrecord (MR_Status :pointer)
- (signalThere boolean)
- (boardBusy boolean)
- (oddField boolean)
- (hasConverter boolean)
- (hasAudio boolean)
- (slot integer))
-
- (defrecord (MR_TheMRCtl :pointer)
- (UseGray boolean)
- (VideoStd boolean)
- (VideoSource integer)
- (SyncOnGreen boolean)
- (Contrast integer)
- (Hue integer)
- (Saturation integer))
-
- (defrecord (MR_ScanLinRec :pointer)
- (srcbegin point)
- (srcLength integer)
- (dstbegin point)
- (dstLength integer)
- (reverse boolean))
-
- (defrecord (MR_ScanTable :pointer)
- (numLines integer)
- (scanList longint))
-
- (defconstant MR_cSetVidPort 22)
- (defconstant MR_cNumofCards 23)
- (defconstant MR_cSetActCard 24)
- (defconstant MR_cGetActCard 25)
- (defconstant MR_cGetVidControls 26)
- (defconstant MR_cGetOptCTab 27)
- (defconstant MR_cUploadITab 28)
- (defconstant MR_cCopyVideo 29)
- (defconstant MR_cStopVideo 30)
- (defconstant MR_cSetMaskPort 32)
- (defconstant MR_cSetVid2Port 33)
- (defconstant MR_cCpy2Videos 34)
- (defconstant MR_cSetVidControls 35)
- (defconstant MR_cVideoStatus 36)
- (defconstant MR_cSetIntVector 37)
- (defconstant MR_cMREffect 38)
-
- (defconstant MR-error-code-alist
- '((-10001 . "PmapErr - CGrafPort's pixMap's pixel resolution not supported")
- (-10002 . "StructErr - can't understand the CGrafPort's structure")
- (-10003 . "badCardNo - trying to switch to nonexistent card")
- (-10004 . "memFullErr - not enough memory")
- (-10005 . "noSignal - no detectable video signal on the input(s)")
- (-10006 . "noColrSrc - B/W input was specified or mixing B/W & color inputs")
- (-10007 . "badres - the count value is out of range or the inverse table resolution <> 5")
- (-10008 . "noGrafPort - Moonraker does not know the CGrafPort into which to xfer video")
- (-10009 . "ScaleErr - a dimension of the dstRect is bigger than a dimension of the srcRect")
- (-10010 . "SrcErr - srcRect inconsistent with video rect or not specified")
- (-10011 . "BadFrameCnt - FrameCnt<0 or FrameCnt=0 & Offset<>0")
- (-10012 . "wrongInt - requested interrupt does not exist")
- (-10013 . "Wrong_Input - the input specification is not understood")
- (-10014 . "Busy - board is busy & cannot respond")
- ))
- )
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
- (defclass MR-vd (video-digitizer)
- ((drvr-refnum :reader drvr-refnum
- :allocation :class)
- (ref-count :initform 0
- :allocation :class)
- (use-gray-p :initarg :use-gray-p
- :accessor use-gray-p)
- (sync-on-green-p :initarg :sync-on-green-p
- :accessor sync-on-green-p)
- (ctSize :initarg :ctSize
- :reader ctSize))
- (:default-initargs
- :use-gray-p nil
- :sync-on-green-p nil
- :ctSize 255
- :hue #.(ash 8 12)
- :saturation #.(ash 8 12)
- :contrast #.(ash 12 12)
- ))
-
- (defmethod initialize-instance :after ((vd MR-vd) &rest initargs)
- (declare (dynamic-extent initargs)
- (ignore initargs))
- (when (minusp (slot-value vd 'ref-count))
- (setf (slot-value vd 'ref-count) 0)
- (error "ref-count class slot went negative - now reset to zero")))
-
- (defmethod vd-error-code-alist ((vd MR-vd))
- (declare (ignore vd))
- MR-error-code-alist)
-
- (defmethod vd-init :before ((vd MR-vd))
- (when (zerop (slot-value vd 'ref-count))
- (setf (slot-value vd 'drvr-refnum) (MRvd-open-driver)))
- (incf (slot-value vd 'ref-count)))
-
- (defmethod vd-dispose :after ((vd MR-vd))
- (decf (slot-value vd 'ref-count))
- (when (zerop (slot-value vd 'ref-count))
- (let ((refnum (slot-value vd 'drvr-refnum)))
- (slot-makunbound vd 'drvr-refnum)
- (trap-nz-echeck (#~CloseDriver refnum)))))
-
- (defmethod vd-GDevice ((vd MR-vd))
- (#_GetMainDevice))
-
- (defmethod vd-max-src-rect-corners ((vd MR-vd))
- (ecase (input-standard vd)
- (:NTSC (values #@(0 0) #@(640 484)))
- (:PAL (values #@(0 0) #@(768 512)))))
-
- (defmethod vd-digitizing-p ((vd MR-vd))
- (and (call-next-method) (MRvd-board-busy-p vd)))
-
- (defmethod vd-start-digitizing :after ((vd MR-vd))
- (rlet ((dig-rect :Rect
- :topLeft (dig-rect-topLeft vd)
- :botRight (dig-rect-botRight vd))
- (dest-rect :Rect
- :topLeft (dest-rect-topLeft vd)
- :botRight (dest-rect-botRight vd)))
- (MRvd-copy-video vd dig-rect dest-rect 0 0)))
-
- (defmethod vd-stop-digitizing :after ((vd MR-vd))
- (MRvd-stop-video vd))
-
- (defmethod vd-grab-one-frame :after ((vd MR-vd))
- (rlet ((dig-rect :Rect
- :topLeft (dig-rect-topLeft vd)
- :botRight (dig-rect-botRight vd))
- (dest-rect :Rect
- :topLeft (dest-rect-topLeft vd)
- :botRight (dest-rect-botRight vd)))
- (MRvd-copy-video vd dig-rect dest-rect 0 1)))
-
- (defmethod vd-install-settings :after ((vd MR-vd))
- (MRvd-set-active-card vd (card-num vd))
- (MRvd-set-use-gray vd (use-gray-p vd))
- (MRvd-set-sync-on-green vd (sync-on-green-p vd))
- (#_ActivatePalette (dest-wptr vd))
- (MRvd-set-vid-port vd (dest-wptr vd)))
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;; set functions for video control values
-
- ;;MoonRaker doesn't store away the various rect's so these calls don't
- ;;really make sense, except in the case that the board is currently
- ;;digitizing - you want to see the changes right away.
-
-
- ;;vd-set-src-rect
- ;;MoonRaker doesn't support a distinct a source & digitizer rect
-
- (defmethod vd-set-dig-rect ((vd MR-vd) topLeft botRight)
- (when (vd-digitizing-p vd)
- (rlet ((dig-rect :Rect
- :topLeft topLeft
- :botRight botRight)
- (dest-rect :Rect
- :topLeft (dest-rect-topLeft vd)
- :botRight (dest-rect-botRight vd)))
- (MRvd-copy-video vd dig-rect dest-rect 0 0))))
-
- (defmethod vd-set-dest-rect ((vd MR-vd) topLeft botRight)
- (when (vd-digitizing-p vd)
- (rlet ((dig-rect :Rect
- :topLeft (dig-rect-topLeft vd)
- :botRight (dig-rect-botRight vd))
- (dest-rect :Rect
- :topLeft topLeft
- :botRight botRight))
- (MRvd-copy-video vd dig-rect dest-rect 0 0))))
-
- (defmethod vd-set-input-format ((vd MR-vd) format)
- (MRvd-set-video-source vd format)
- format)
-
- (defmethod vd-get-input-format ((vd MR-vd))
- (MRvd-get-video-source vd))
-
- (defmethod vd-set-input-standard ((vd MR-vd) standard)
- (MRvd-set-video-standard vd standard)
- standard)
-
- (defmethod vd-get-input-standard ((vd MR-vd))
- (MRvd-get-video-standard vd))
-
- (defmethod vd-set-contrast ((vd MR-vd) contrast)
- (MRvd-set-contrast vd (ash contrast -12))
- contrast)
-
- ;;;;;;;;;;
- ;;MoonRaker uses a 0-15 range for contrast,hue,saturation
- ;; ash +/- 12 converts to/from the QuickTime range (0-65535)
-
- (defmethod vd-get-contrast ((vd MR-vd))
- (ash (MRvd-get-contrast vd) 12))
-
- (defmethod vd-set-hue ((vd MR-vd) hue)
- (MRvd-set-hue vd (ash hue -12))
- hue)
-
- (defmethod vd-get-hue ((vd MR-vd))
- (ash (MRvd-get-hue vd) 12))
-
- (defmethod vd-set-saturation ((vd MR-vd) saturation)
- (MRvd-set-saturation vd (ash saturation -12))
- saturation)
-
- (defmethod vd-get-saturation ((vd MR-vd))
- (ash (MRvd-get-saturation vd) 12))
-
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;MR specific settings
-
- (defmethod (setf sync-on-green-p) :after (new-sync-on-green (vd MR-vd))
- (when (vd-digitizing-p vd)
- (MRvd-set-sync-on-green vd new-sync-on-green)))
-
- (defmethod (setf use-gray-p) :after (new-use-gray (vd MR-vd))
- (when (vd-digitizing-p vd)
- (MRvd-set-use-gray vd new-use-gray)))
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;; MR functions
-
- (defun MRvd-open-driver ()
- ;opens the MoonRaker driver and returns its refNum
- (with-pstrs ((MR-drvr-name_p ".MOONRAKER"))
- (rlet ((refNum_p :integer))
- (unless (zerop (#~OpenDriver MR-drvr-name_p refNum_p))
- (error "Unable to open MoonRaker driver.~%Make sure the WTI-VideoMgr init is installed."))
- (%get-signed-word refNum_p))))
-
-
- (defmethod MRvd-set-vid-port ((vd MR-vd) cPort)
- ;sets the CGrafPtr the MR board uses. Needs to be called whenever changes to
- ;the color window which contains the MR-video-view changes. e.g. new color table,
- ;repositioning, new clip region, etc. Note: it causes digitizing to stop
- (rlet ((csParamPtr :MRCsParam
- :ptr cPort))
- (vd-nz-error-check vd (#~Control (drvr-refnum vd) MR_cSetVidPort csParamPtr))))
-
-
- (defmethod MRvd-number-of-cards ((vd MR-vd)) ()
- ;returns the number of MR cards (#1 in the lowest numbered slot, ...)
- (rlet ((card-count_p :integer)
- (csParamPtr :MRCsParam
- :ptr card-count_p))
- (vd-nz-error-check vd (#~Control (drvr-refnum vd) MR_cNumofCards csParamPtr))
- (%get-signed-word card-count_p)))
-
-
- (defmethod MRvd-set-active-card ((vd MR-vd) active-card-num)
- ;sets the card the MR driver is using
- (rlet ((csParamPtr :MRCsParam
- :sv2-in1 active-card-num))
- (vd-nz-error-check vd (#~Control (drvr-refnum vd) MR_cSetActCard csParamPtr))))
-
- (defmethod MRvd-get-active-card ((vd MR-vd) )
- ;sets the card the MR driver is using
- (rlet ((active-card-num_p :integer)
- (csParamPtr :MRCsParam
- :ptr active-card-num_p))
- (vd-nz-error-check vd (#~Control (drvr-refnum vd) MR_cGetActCard csParamPtr))
- (%get-signed-word active-card-num_p)))
-
-
- (defmethod MRvd-get-opt-ctab ((vd MR-vd) color-table_h)
- (vd-nz-error-check vd (#~Control (drvr-refnum vd) MR_cGetOptCTab color-table_h)))
-
-
- (defmethod MRvd-optimize-colors ((vd MR-vd))
- ;;assumes the destination CGrafPort is current & it's window is selected
- (with-slots (dest-wptr ctSize) vd
- (let ((on-p (vd-digitizing-p vd)))
- (when on-p (vd-stop-digitizing vd))
-
- (with-macptrs ((color-table_h (#_NewHandle (+ (* (rlength :ColorSpec) (1+ ctSize)) 8)))
- (palette_h (#_GetPalette dest-wptr)))
- (when (%null-ptr-p color-table_h)
- (error "unable to allocate color table (ctSize = ~a)" ctSize))
-
- (unwind-protect
- (progn
- (hset color-table_h :ColorTable.ctSize ctSize)
- (with-dereferenced-handles ((color-table_p color-table_h))
- (with-macptrs ((ctTable (pref color-table_p :ColorTable.ctTable)))
-
- (if (MRvd-get-use-gray vd)
- ;;if use gray mode - hand calculate the optimal color table
- (with-macptrs ((color-spec ctTable))
- (dotimes (i (1+ ctSize))
- (pset color-spec :colorSpec.value i)
- (let ((rgb-val (ash (- 255 i) 8)))
- (pset color-spec :colorSpec.rgb.red rgb-val)
- (pset color-spec :colorSpec.rgb.green rgb-val)
- (pset color-spec :colorSpec.rgb.blue rgb-val))
- (%incf-ptr color-spec (rlength :ColorSpec))))
- ;; else, color mode - MoonRaker computes optimal color table via get-opt-ctab
- (with-macptrs ((last-color-spec (%inc-ptr ctTable (* (rlength :ColorSpec) ctSize))))
- (MRvd-get-opt-ctab vd color-table_h)
- ;; set last color table entry to green (used by text overlay function)
- (pset last-color-spec :colorSpec.rgb.red 16384)
- (pset last-color-spec :colorSpec.rgb.green #xFFFF)
- (pset last-color-spec :colorSpec.rgb.blue 10000)))))
-
- (when (%null-ptr-p palette_h)
- (%setf-macptr palette_h (#_NewPalette (1+ ctSize) color-table_h #.#$pmTolerant 0))
- (when (%null-ptr-p palette_h)
- (error "unable to allocate new palette (~a entries)" (1+ ctSize)))
- (#_SetPalette dest-wptr palette_h t))
-
- (#_CTab2Palette color-table_h palette_h #.#$pmTolerant 0))
-
- (#_DisposeHandle color-table_h))
-
- (when on-p
- (#_ActivatePalette dest-wptr)
- (MRvd-set-vid-port vd dest-wptr)
- (vd-start-digitizing vd))))))
-
-
- (defmethod MRvd-upload-itable ((vd MR-vd) inverse-table_h)
- (vd-nz-error-check vd (#~Control (drvr-refnum vd) MR_cUploadITab inverse-table_h)))
-
-
- (defmethod MRvd-copy-video ((vd MR-vd) dig-rect dest-rect offset frame-count)
- ;start digitizing video from scr-rect into dest-rect. Frame-count specifies
- ;how many frames to digitize (0 for continuous). Offset can be used along with
- ;a non-zero frame-count capture video sequences in Mac memory at successive
- ;offsets in the CGRapPort's portPix.
- (rlet ((csParamPtr :MRCsParam
- :cc-src dig-rect
- :cc-dst dest-rect
- :cc-offs offset
- :cc-fcnt frame-count))
- (vd-nz-error-check vd (#~Control (drvr-refnum vd) MR_cCopyVideo csParamPtr))))
-
-
- (defmethod MRvd-stop-video ((vd MR-vd) )
- ;stops a continuous video stream started by copy-video
- (rletz ((csParamPtr :MRCsParam))
- (vd-nz-error-check vd (#~Control (drvr-refnum vd) MR_cStopVideo csParamPtr))))
-
-
- (defmethod MRvd-set-mask-port ((vd MR-vd) )
- ;make the masking GrafPort the current port
- (rletz ((csParamPtr :MRCsParam))
- (vd-nz-error-check vd (#~Control (drvr-refnum vd) MR_cSetMaskPort csParamPtr))))
-
-
- (defmethod MRvd-set-vid-controls ((vd MR-vd) control-record)
- ;set the MR control values. (stored in non-volatile RAM)
- (rlet ((csParamPtr :MRCsParam
- :ptr control-record))
- (vd-nz-error-check vd (#~Control (drvr-refnum vd) MR_cSetVidControls csParamPtr))))
-
-
- (defmethod MRvd-get-vid-controls ((vd MR-vd) control-record)
- ;fills the supplied control-record with the current MR control values
- (rlet ((csParamPtr :MRCsParam
- :ptr control-record))
- (vd-nz-error-check vd (#~Control (drvr-refnum vd) MR_cGetVidControls csParamPtr))))
-
-
- (defmethod MRvd-get-video-status ((vd MR-vd) status-record)
- ;fills the supplied status-record with the current MR status values
- (rlet ((csParamPtr :MRCsParam
- :ptr status-record))
- (vd-nz-error-check vd (#~Control (drvr-refnum vd) MR_cVideoStatus csParamPtr))))
-
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;; predicate functions for individual control values
-
- (defmethod MRvd-set-use-gray ((vd MR-vd) use-gray-p)
- (rlet ((control-record :MR_TheMRCtl))
- (MRvd-get-vid-controls vd control-record)
- (pset control-record :MR_theMRCtl.useGray use-gray-p)
- (MRvd-set-vid-controls vd control-record))
- use-gray-p)
-
- (defmethod MRvd-get-use-gray ((vd MR-vd))
- (rlet ((control-record :MR_TheMRCtl))
- (MRvd-get-vid-controls vd control-record)
- (pref control-record :MR_TheMRCtl.useGray)))
-
- (defmethod MRvd-set-video-standard ((vd MR-vd) standard)
- (rlet ((control-record :MR_TheMRCtl))
- (MRvd-get-vid-controls vd control-record)
- (pset control-record :MR_theMRCtl.videoStd (ecase standard (:NTSC t) (:PAL nil)))
- (MRvd-set-vid-controls vd control-record))
- standard)
-
- (defmethod MRvd-get-video-standard ((vd MR-vd))
- (rlet ((control-record :MR_TheMRCtl))
- (MRvd-get-vid-controls vd control-record)
- (if (pref control-record :MR_TheMRCtl.videoStd) :NTSC :PAL)))
-
- (defmethod MRvd-set-video-source ((vd MR-vd) format)
- (rlet ((control-record :MR_TheMRCtl))
- (MRvd-get-vid-controls vd control-record)
- (pset control-record :MR_theMRCtl.videoSource
- (ecase format (:RGB 0) (:RGB1 0) (:RGB2 1) (:s-video 2) (:composite 3)))
- (MRvd-set-vid-controls vd control-record))
- format)
-
- (defmethod MRvd-get-video-source ((vd MR-vd))
- (rlet ((control-record :MR_TheMRCtl))
- (MRvd-get-vid-controls vd control-record)
- (ecase (pref control-record :MR_TheMRCtl.videoSource)
- (0 :RGB1)
- (1 :RGB2)
- (2 :s-video)
- (3 :composite))))
-
- (defmethod MRvd-set-sync-on-green ((vd MR-vd) sync-on-green-p)
- (ecase (input-format vd)
- ((:RGB1 :RGB2)
- (rlet ((control-record :MR_TheMRCtl))
- (MRvd-get-vid-controls vd control-record)
- (pset control-record :MR_theMRCtl.SyncOnGreen sync-on-green-p)
- (MRvd-set-vid-controls vd control-record)))
- ((:S-Video :Composite)
- (when sync-on-green-p (error "Sync-on-green requires RGB input"))))
- sync-on-green-p)
-
- (defmethod MRvd-get-sync-on-green ((vd MR-vd))
- (rlet ((control-record :MR_TheMRCtl))
- (MRvd-get-vid-controls vd control-record)
- (pref control-record :MR_TheMRCtl.syncOnGreen)))
-
- ;;;;;;;;;;
- ;;MoonRaker uses a 0-15 range for contrast,hue,saturation
-
- (defmethod MRvd-set-contrast ((vd MR-vd) contrast)
- (rlet ((control-record :MR_TheMRCtl))
- (MRvd-get-vid-controls vd control-record)
- (pset control-record :MR_theMRCtl.contrast contrast)
- (MRvd-set-vid-controls vd control-record))
- contrast)
-
- (defmethod MRvd-get-contrast ((vd MR-vd))
- (rlet ((control-record :MR_TheMRCtl))
- (MRvd-get-vid-controls vd control-record)
- (pref control-record :MR_TheMRCtl.contrast)))
-
- (defmethod MRvd-set-hue ((vd MR-vd) hue)
- (rlet ((control-record :MR_TheMRCtl))
- (MRvd-get-vid-controls vd control-record)
- (pset control-record :MR_theMRCtl.hue hue)
- (MRvd-set-vid-controls vd control-record))
- hue)
-
- (defmethod MRvd-get-hue ((vd MR-vd))
- (rlet ((control-record :MR_TheMRCtl))
- (MRvd-get-vid-controls vd control-record)
- (pref control-record :MR_TheMRCtl.hue)))
-
- (defmethod MRvd-set-saturation ((vd MR-vd) saturation)
- (rlet ((control-record :MR_TheMRCtl))
- (MRvd-get-vid-controls vd control-record)
- (pset control-record :MR_theMRCtl.saturation saturation)
- (MRvd-set-vid-controls vd control-record))
- saturation)
-
- (defmethod MRvd-get-saturation ((vd MR-vd))
- (rlet ((control-record :MR_TheMRCtl))
- (MRvd-get-vid-controls vd control-record)
- (pref control-record :MR_TheMRCtl.saturation)))
-
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;; predicate functions for individual status values
-
- (defmethod MRvd-signal-there-p ((vd MR-vd))
- (rlet ((status-record :MR_Status))
- (MRvd-get-video-status vd status-record)
- (pref status-record :MR_Status.signalThere)))
-
- (defmethod MRvd-board-busy-p ((vd MR-vd))
- (rlet ((status-record :MR_Status))
- (MRvd-get-video-status vd status-record)
- (pref status-record :MR_Status.boardBusy)))
-
- (defmethod MRvd-odd-field-p ((vd MR-vd))
- (rlet ((status-record :MR_Status))
- (MRvd-get-video-status vd status-record)
- (pref status-record :MR_Status.oddField)))
-
- (defmethod MRvd-has-converter-p ((vd MR-vd))
- (rlet ((status-record :MR_Status))
- (MRvd-get-video-status vd status-record)
- (pref status-record :MR_Status.hasConverter)))
-
- (defmethod MRvd-has-audio-p ((vd MR-vd))
- (rlet ((status-record :MR_Status))
- (MRvd-get-video-status vd status-record)
- (pref status-record :MR_Status.hasAudio)))
-
- (defmethod MRvd-get-slot ((vd MR-vd))
- ;;slots are numbered #x9 to #xE (see IM V - Device Mgr)
- (rlet ((status-record :MR_Status))
- (MRvd-get-video-status vd status-record)
- (pref status-record :MR_Status.slot)))
-
- #|
-
- ;; a modest example - which currently illustrate a bug in the MR driver.
- ;; the left two video are incorrectly clipped.
-
- (oou-dependencies :video-digitizer-svm)
-
- (defclass vview (video-digitizer-svm view) () )
- (defclass vsview (video-digitizer-svm simple-view) () )
-
- (progn
- (defvar *MR-test-w*)
- (setf *MR-test-w*
- (make-instance 'window
- :window-type :document
- :view-position #@(10 40)
- :view-size #@(400 200)
- :window-title "video demo"
- :color-p t
- ))
-
- (add-subviews *MR-test-w* (make-instance 'view
- :view-position #@(20 20)
- :view-size #@(345 175)
- :view-nick-name :v
- ))
-
- (add-subviews (view-named :v *MR-test-w*) (make-instance 'vview
- :view-position #@(20 5)
- :view-size #@(100 150)
- :view-nick-name :vview
- :digitizer-class 'mr-vd
- ))
- (add-subviews (view-named :v *MR-test-w*) (make-instance 'vsview
- :view-position #@(130 5)
- :view-size #@(100 150)
- :view-nick-name :vview2
- :digitizer-class 'mr-vd
- ))
- (add-subviews *MR-test-w* (make-instance 'vsview
- :view-position #@(260 25)
- :view-size #@(100 150)
- :view-nick-name :vview3
- :digitizer-class 'mr-vd
- )))
-
- (let* ((v (view-named :vview (view-named :v *MR-test-w*)))
- (v2 (view-named :vview2 (view-named :v *MR-test-w*)))
- (v3 (view-named :vview3 *MR-test-w*)))
- (grab-one-frame v)
- (grab-one-frame v2)
- (grab-one-frame v3))
-
- (start-digitizing (view-named :vview3 *MR-test-w*))
-
- (stop-digitizing (view-named :vview3 *MR-test-w*))
-
- |#