1 # ui-vat.tcl --
2 #
3 # FIXME: This file needs a description here.
4 #
5 # Copyright (c) 1997-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 # @(#) $Header: /usr/mash/src/repository/mash/mash-1/tcl/msp/ui-vat.tcl,v 1.22 2002/02/03 04:28:01 lim Exp $
32
33
34 import VatUI AddressBlock AudioAgent
35
36 #
37 # The audio component of the user interface for the MSP (mash streaming player).
38 # Status: alpha
39 # Author: Suchitra Raman
40
41 # Class VatApplication -superclass RTPApplication
42
43
44 # Set up the vat user interface and start mega if necessary
45 MSP_Application instproc start_vat argv {
46 $self instvar ui_ vat_
47 $self instvar glob_chan_
48
49 set o [$self options]
50
51 $self init_vat_args
52 #$self parse_args $argv
53 set argv [$o parse_args $argv]
54
55 $self parse_hostspec $argv
56
57 $self init_local
58
59
60 set spec [$self get_option defaultHostSpec]
61 set pspec [split $spec /]
62 set mspec [lindex $pspec 0]/[lindex $pspec 1]/[lindex $pspec 3]
63
64 $self add_option audioSessionSpec $mspec
65 if {[$self get_option megaVideoSession] != "" } {
66 set spec ""
67 }
68 set vat_(agent) [new AudioAgent $self $spec "$self reset_audio"]
69
70 if { $spec != "" } {
71 # vat doesn't want traffic looped back (like vic does)
72 #$vat_(agent) set-loopback 0
73 $vat_(agent) app_loopback 0
74 }
75
76 $self init_confbus
77
78 global mash
79 if { ![info exists mash(environ)] || $mash(environ)!="mplug" } {
80 wm withdraw .
81 }
82 update idletasks
83 global minwidth minheight iconPrefix
84 set minwidth [winfo reqwidth .]
85 set minheight [winfo reqheight .]
86 wm minsize . $minwidth $minheight
87 $self add_option audioFormat PCM2
88 # frame .main.vat
89 set vat_(ui) [new VatUI $ui_(main).av.vat $glob_chan_ $vat_(agent) "$self exit_vat" $spec]
90 # pack .top -expand 1 -fill both
91
92 update idletasks
93 if { ![info exists mash(environ)] || $mash(environ)!="mplug" } {
94 wm deiconify .
95 }
96 $vat_(agent) attach $vat_(ui)
97
98 # set the window & icon title from the conference name
99 set prefix [$self get_option iconPrefix]
100 if { $spec == "" } {
101 set conf "Contacting MeGa..."
102 } else {
103 set conf [$self get_option conferenceName]
104 }
105 $vat_(ui) window-title [$self resource iconPrefix] $conf
106
107 $self user_hook
108 }
109
110 # Data address has changed, so reset vat
111 MSP_Application instproc reset_vat argv {
112 $self instvar vat_
113 $self parse_hostspec $argv
114
115 set spec [$self get_option defaultHostSpec]
116 set pspec [split $spec /]
117 set mspec [lindex $pspec 0]/[lindex $pspec 1]/[lindex $pspec 3]
118
119 $self add_option audioSessionSpec $mspec
120 if { [$self get_option megaVideoSession] != "" } {
121 # MARS playback addr has changed, so need to repoint audio gw
122 $vat_(agent) reset_mega
123 } else {
124 $vat_(agent) reset_spec $spec
125 }
126 }
127
128
129 # Called from RTPAgent
130 MSP_Application instproc reset_audio {ab} {
131 $self instvar vat_
132
133 if [info exists vat_(ui)] {
134 $vat_(ui) reset
135 }
136 }
137
138 #
139 MSP_Application instproc exit_vat {} {
140 $self instvar vat_
141 # FIXME: should delete everything else as well
142 delete $vat_(ui)
143 # FIXME: note this exits the application!
144 $vat_(agent) shutdown
145
146 # should not be here
147 exit 0
148 }
149
150 #
151 MSP_Application instproc init_vat_args {} {
152 $self instvar vat_arg_resource_
153 set vat_arg_resource_(-B) maxbw
154 set vat_arg_resource_(-C) conferenceName
155 set vat_arg_resource_(-c) dither
156 set vat_arg_resource_(-D) device
157 set vat_arg_resource_(-f) audioFormat
158 set vat_arg_resource_(-F) maxfps
159 set vat_arg_resource_(-I) confBusChannel
160 set vat_arg_resource_(-K) sessionKey
161 set vat_arg_resource_(-M) colorFile
162 set vat_arg_resource_(-m) mtu
163 set vat_arg_resource_(-n) network
164 set vat_arg_resource_(-o) outfile
165 set vat_arg_resource_(-q) jpegQfactor
166 set vat_arg_resource_(-t) defaultTTL
167 set vat_arg_resource_(-T) softJPEGthresh
168 set vat_arg_resource_(-U) stampInterval
169 set vat_arg_resource_(-V) visual
170
171 set vat_arg_resource_(-confid) confid
172
173 # MeGa resources
174 set vat_arg_resource_(-rport) megaRecvAudioPort
175 set vat_arg_resource_(-ofmt) megaAudioFormat
176 set vat_arg_resource_(-usemega) megaVideoSession
177 set vat_arg_resource_(-megactrl) megaAudioCtrl
178 set vat_arg_resource_(-sspec) audioSessionSpec
179 set vat_arg_resource_(-maxsbw) maxAudioSessionBW
180 set vat_arg_resource_(-sbw) audioSessionBW
181 }
182
183
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.