~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Open Mash Cross Reference
mash/tcl/vd/test/switcher.tcl

Component: ~ [ mash ] ~ [ apps ] ~ [ gsm ] ~ [ lib ] ~ [ otcl ] ~ [ srm ] ~ [ tcl8.3 ] ~ [ tclcl ] ~ [ tk8.3 ] ~ [ tutorials ] ~

  1 # switcher.tcl --
  2 #
  3 #       Used to control video source connections in 405
  4 #
  5 # Copyright (c) 2000-2002 The Regents of the University of California.
  6 # All rights reserved.
  7 #
  8 # Redistribution and use in source and binary forms, with or without
  9 # modification, are permitted provided that the following conditions are met:
 10 #
 11 # A. Redistributions of source code must retain the above copyright notice,
 12 #    this list of conditions and the following disclaimer.
 13 # B. Redistributions in binary form must reproduce the above copyright notice,
 14 #    this list of conditions and the following disclaimer in the documentation
 15 #    and/or other materials provided with the distribution.
 16 # C. Neither the names of the copyright holders nor the names of its
 17 #    contributors may be used to endorse or promote products derived from this
 18 #    software without specific prior written permission.
 19 #
 20 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
 21 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 22 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 23 # ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
 24 # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 25 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 26 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 27 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 28 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 29 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 30 
 31 global g_app g_inputSource g_outputSource g_useScan g_quickSwitch
 32 
 33 Import enable
 34 
 35 import Application 405Client
 36 
 37 Class MatrixSwitchApp -superclass Application
 38 
 39 MatrixSwitchApp instproc init {argv} {
 40     $self instvar amx_
 41 
 42     $self next $argv
 43     $self initUI
 44 #    $self initAmx garfield.cs.berkeley.edu 6905
 45     $self initAmx htsr.bmrc.berkeley.edu 6901
 46 }
 47 
 48 #
 49 # GUI stuff
 50 #
 51 
 52 MatrixSwitchApp instproc initUI {} {
 53     global g_inputSource g_outputSource g_useScan g_quickSwitch
 54 
 55     wm title . "Video Matrix Switcher"
 56     wm minsize . 150 0
 57 
 58     frame .entry
 59     pack .entry -side top -pady 10
 60 
 61     frame .entry.in
 62     pack .entry.in -side left
 63 
 64     label .entry.in.label  -text "Input" -foreground blue
 65     pack .entry.in.label -side top
 66     set parent ".entry.in"
 67 
 68     lappend inputs [list "wideCamera" "Wide Camera"]
 69     lappend inputs [list "speakerCamera" "Speaker Camera"]
 70     lappend inputs [list "audienceCamera" "Audience Camera"]
 71     lappend inputs [list "frontPC" "Front PC"]
 72     lappend inputs [list "frontVCR" "Front VCR"]
 73     lappend inputs [list "elmo" "Elmo"]
 74     lappend inputs [list "laptop" "Laptop"]
 75     lappend inputs [list "sgiPC" "SGI PC"]
 76     lappend inputs [list "rackVCR" "Rack VCR"]
 77     lappend inputs [list "mbonePC" "MBone PC"]
 78     lappend inputs [list "liveboard" "Liveboard"]
 79     foreach item $inputs {
 80         set name [lindex $item 0]
 81         set desc [lindex $item 1]
 82         frame $parent.but$name
 83         pack $parent.but$name -side top -fill x
 84         radiobutton $parent.but$name.but -text "$desc" -variable g_inputSource -value "$name" -command "$self doQuickSwitch"
 85         pack $parent.but$name.but -side left
 86     }
 87 
 88     set g_inputSource wideCamera
 89 
 90     frame .entry.out
 91     pack .entry.out -side top
 92 
 93     label .entry.out.label  -text "Output" -foreground blue
 94     pack .entry.out.label -side top
 95     set parent ".entry.out"
 96 
 97     lappend outputs [list "realNetworks" "Real Networks"]
 98     lappend outputs [list "htsr" "HTSR"]
 99     lappend outputs [list "htsr2" "HTSR 2"]
100     lappend outputs [list "projector" "Projector"]
101     lappend outputs [list "testMonitor" "405 Closet Monitor"]
102     foreach item $outputs {
103         set name [lindex $item 0]
104         set desc [lindex $item 1]
105         frame $parent.but$name
106         pack $parent.but$name -side top -fill x
107         radiobutton $parent.but$name.but -text "$desc" -variable g_outputSource -value "$name" -command "$self doQuickSwitch"
108         pack $parent.but$name.but -side left
109     }
110 
111     set g_outputSource htsr
112 
113     checkbutton $parent.scanConvert -text "Proj use Scan Converter" -variable g_useScan
114     pack $parent.scanConvert -side top
115     set g_useScan 0
116 
117     frame .but
118     pack .but -side top -pady 10
119 
120     checkbutton .but.quick -text "Switch when radio button changed" -variable g_quickSwitch
121     pack .but.quick -side top
122     set g_quickSwitch 0
123 
124     frame .but2
125     pack .but2 -side top -pady 10
126 
127     button .but2.send -text "Switch" -command "$self doSwitch"
128     pack .but2.send -side left
129 
130     # make exit button
131     button .exit -text "Exit" -command "$self exitApp"
132     pack .exit -side bottom
133 }
134 
135 MatrixSwitchApp instproc initAmx { {hostname htsr.bmrc.berkeley.edu} {port 6901}} {
136     $self instvar amx_
137 
138     set amx_ [new 405Client]
139 }
140 
141 MatrixSwitchApp instproc exitApp {} {
142     $self instvar amx_
143 
144     $amx_ closeConnection
145     exit
146 }
147 
148 MatrixSwitchApp public doSwitch {} {
149     global g_inputSource g_outputSource g_useScan
150     $self instvar amx_
151 
152 #    puts stdout "routing $g_inputSource to $g_outputSource"
153 
154     $amx_ matrix_switchVideoStream $g_inputSource $g_outputSource $g_useScan
155 }
156 
157 MatrixSwitchApp public doQuickSwitch {} {
158     global g_inputSource g_outputSource g_useScan g_quickSwitch
159     $self instvar amx_
160 
161     if {$g_quickSwitch} {
162 #       puts stdout "routing $g_inputSource to $g_outputSource"
163 
164         $amx_ matrix_switchVideoStream $g_inputSource $g_outputSource $g_useScan
165     }
166 }
167 
168 #
169 # driver engine
170 #
171 
172 set g_app [new MatrixSwitchApp $argv]
173 
174 # next line is very important!!!
175 vwait forever
176 
177 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.