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

Open Mash Cross Reference
mash/tcl/msp/ui-vic.tcl

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

  1 # ui-vic.tcl --
  2 #
  3 #       FIXME: This file needs a description here.
  4 #
  5 # Copyright (c) 1996-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-vic.tcl,v 1.30 2002/02/03 04:28:01 lim Exp $
 32 
 33 
 34 import VicUI VatUI AddressBlock VideoAgent VideoPipeline CoordinationBus Session/Scuba/Vic VideoHandler
 35 
 36 
 37 
 38 ## The video component of the user interface for the MSP (mash streaming
 39 # player).  This should eventually go away when Cyndi's UI components
 40 # can be used instead.
 41 # Status: alpha
 42 # Author: Suchitra Raman
 43 MSP_Application instproc start_vic argv {
 44 
 45 
 46         #$self init_args
 47         #$self init_vic_fonts
 48         #set argv [$self parse_args $argv]
 49         set o [$self options]
 50         $self init_args $o
 51         $self init_vic_fonts
 52         set argv [$o parse_args $argv]
 53         $self parse_hostspec $argv
 54         $self init_local
 55         $self init_confbus
 56         # Backward compat. -B flag is kb/s.
 57         set t [$self get_option maxbw]
 58         if { $t > 0 } {
 59                 $self add_option maxbw [expr 1000*$t]
 60         }
 61 
 62         if { [$self get_option audioSessionSpec] != "" } {
 63                 option add Msp.geometry 400x620 startupFile
 64         }
 65         $self instvar vic_ handler_
 66         set spec [$self get_option defaultHostSpec]
 67         set pspec [split $spec /]
 68         set mspec [lindex $pspec 0]/[lindex $pspec 1]/[lindex $pspec 3]
 69         set aspec [$self get_option audioSessionSpec]
 70         $self add_option videoSessionSpec $mspec
 71         if { $spec != "" } {
 72             set temp [new AddressBlock $spec]
 73             set temp2 [$temp set maxbw_(0)]
 74             #FIXME need to do this to size the bandwidth slider in the GUI
 75             $self add_option maxbw $temp2
 76             $self add_option audioFormat PCM2
 77         }
 78         if { [$self get_option megaVideoSession] != "" } {
 79             set spec ""
 80             set aspec ""
 81             #$self add_option megaAudioSession [$self get_option megaVideoSession]
 82         }
 83 
 84         set handler_ [new VideoHandler $spec "$self reset_video"]
 85         set vic_(agent) [$handler_ agent]
 86         set vic_(vpipe) [$handler_ vpipe]
 87         set vic_(ui) [$self init_vic_ui]
 88         if { [$self get_option useScuba] != "" } {
 89                 set scuba_sess_ [$handler_ set scuba_sess_]
 90                 $vic_(ui) set scuba_sess_ $scuba_sess_
 91         }
 92         set prefix [$self get_option iconPrefix]
 93 
 94         $self user_hook
 95 
 96 }
 97 
 98 #Data address has changed, so reset vic
 99 MSP_Application instproc reset_vic argv {
100         $self instvar vic_ handler_
101 
102         $self parse_hostspec $argv
103         set spec [$self get_option defaultHostSpec]
104         set pspec [split $spec /]
105         set mspec [lindex $pspec 0]/[lindex $pspec 1]/[lindex $pspec 3]
106         $self add_option videoSessionSpec $mspec
107         if { [$self get_option megaVideoSession] != "" } {
108             $vic_(agent) reset_mega
109         } else {
110             $vic_(agent) reset_spec $spec
111             $handler_ reset $spec
112         }
113 }
114 
115 #
116 MSP_Application instproc init_vic_ui {} {
117         $self instvar vic_ ui_
118         $self instvar local_chan_ glob_chan_
119 
120         set vic_(ui) [new VicUI $ui_(main).av.vic $local_chan_ $glob_chan_ $vic_(agent) $vic_(vpipe) "$self exit_vic" [$self get_option defaultHostSpec]]
121 
122         return $vic_(ui)
123 }
124 
125 #
126 MSP_Application instproc exit_vic {} {
127         $self instvar vic_
128         $vic_(agent) shutdown
129         exit 0
130 }
131 
132 
133 # Called from RTPAgent
134 MSP_Application instproc reset_video { ab } {
135     $self instvar handler_
136 
137     if [info exists handler_] {
138         $handler_ reset $ab
139     }
140 
141 }
142 
143 #
144 MSP_Application private parse_hostspec { argv } {
145         $self instvar name_
146         if { $argv == "" } {
147                 if { [$self get_option defaultHostSpec] == "" && \
148                      [$self get_option megaVideoSession] == "" } {
149                         puts stderr "$name_: destination address required"
150                         exit 1
151                 }
152         } elseif { [llength $argv] > 1 } {
153                 set extra [lindex $argv 0]
154                 puts stderr "$name_: extra arguments (starting with $extra)"
155                 exit 1
156         } else {
157                 $self add_option defaultHostSpec $argv
158         }
159 }
160 
161 #
162 MSP_Application instproc special_parse { arg } {
163         switch -- $arg {
164         -A {
165                 $self add_option sessionType $option
166                 set argv [lrange $argv 1 end]
167                 if { $option == "nv" } {
168                         $self add_default videoFormat nv
169                 } elseif { $option == "ivs" } {
170                         $self add_default videoFormat h.261
171                 }
172         }
173         -H {
174                 $self add_option useHardwareDecode true
175         }
176         -P {
177                 $self add_option privateColormap true
178         }
179         }
180 
181         $self next $arg
182 }
183 
184 # This should go away
185 MSP_Application instproc init_vic_fonts2 {} {
186         set foundry [$self get_option foundry]
187 
188         set helv10  [$self search_font $foundry helvetica medium 10 r]
189         set helv10b [$self search_font $foundry helvetica bold 10 r]
190         set helv10o [$self search_font $foundry helvetica bold 10 o]
191         set helv12b [$self search_font $foundry helvetica bold 12 r]
192         set times14 [$self search_font $foundry times medium 14 r]
193 
194         option add *Font $helv12b startupFile
195         option add Msp.medfont $helv12b startupFile
196         option add Msp.smallfont $helv10b startupFile
197         option add Msp.helpFont $times14 startupFile
198 
199         # FIX THIS !!
200        $self add_option smallfont $helv10b
201          $self add_option medfont $helv12b
202         ##
203 
204         # fonts used by audio widgets
205         option add Msp.audioFont $helv10 startupFile
206         option add Msp.ctrlTitleFont $helv12b startupFile
207         option add Msp.ctrlFont $helv10b startupFile
208         option add Msp.noAudioFont $helv10o startupFile
209         option add Msp.siteFont $helv12b startupFile
210 }
211 
212 #
213 MSP_Application instproc init_vic_fonts {} {
214         set foundry [$self get_option foundry]
215 
216         set helv10  [$self search_font $foundry helvetica medium 10 r]
217         set helv10b [$self search_font $foundry helvetica bold 10 r]
218         set helv10o [$self search_font $foundry helvetica bold 10 o]
219         set helv12b [$self search_font $foundry helvetica bold 12 r]
220         set times14 [$self search_font $foundry times medium 14 r]
221 
222         option add *Font $helv12b startupFile
223 
224 
225         $self add_option smallfont $helv10b
226         $self add_option medfont $helv12b
227         $self add_option helpFont $times14
228         ##
229 
230         # fonts used by audio widgets
231         $self add_option audioFont $helv10
232         $self add_option ctrlTitleFont $helv12b
233         $self add_option ctrlFont $helv10b
234         $self add_option noAudioFont $helv10o
235         $self add_option siteFont $helv12b
236 
237         #option add Msp.audioFont $helv10 startupFile
238         #option add Msp.ctrlTitleFont $helv12b startupFile
239         #option add Msp.ctrlFont $helv10b startupFile
240         #option add Msp.noAudioFont $helv10o startupFile
241         #option add Msp.siteFont $helv12b startupFile
242 }
243 
244 #
245 MSP_Application instproc init_confbus {} {
246         $self instvar local_chan_ glob_chan_
247         set local_chan_ [new CoordinationBus -channel 2]
248 
249         set ttl [$self get_option defaultTTL]
250         set glob_chan_ [new CoordinationBus -channel 3 -ttl $ttl]
251 }
252 
253 #Not used
254 MSP_Application instproc init_scuba {} {
255         $self instvar vic_ scuba_sess_ al_
256 
257         set rtpsess [$vic_(agent) set session_]
258         $rtpsess rtcp-thumbnail 1
259 
260         set spec [$self resource defaultHostSpec]
261         if { $spec != "" } {
262                 set ab [new AddressBlock $spec]
263         } else {
264                 set ab ""
265         }
266         set scuba_sess_ [new Session/Scuba/Vic $rtpsess $vic_(agent) $ab]
267         if { $ab != "" } {
268                 delete $ab
269         }
270 
271         $vic_(ui) set scuba_sess_ $scuba_sess_
272         $vic_(agent) attach $scuba_sess_
273 
274         set localbw [$self get_option videoSessionBW]
275         if { $localbw == "" } {
276                 set localbw [$self get_option maxVideoSessionBW]
277         }
278         $scuba_sess_ sessionbw $localbw
279 }
280 
281 #
282 MSP_Application instproc clean-net {} {
283         # Cleaning vic
284         $self instvar vic_
285         if [info exists vic_(agent)] {
286                 set srclist [$vic_(agent) set sources_]
287                 foreach s $srclist {
288                         delete $s
289                 }
290         }
291         if [info exists vic_(ui)] {
292                 $vic_(ui) clean_timers
293                 delete $vic_(ui)
294         }
295         Application set colormap_ ""
296 #       if [info exists vic_(agent)] {
297 #               set rtp_session [$vic_(agent) set session_]
298 #               delete $rtp_session
299 #       }
300         #
301         # Cleaning vat
302         #
303         $self instvar vat_
304         if [info exists vat_(agent)] {
305                 set srclist [$vat_(agent) set sources_]
306                 foreach s $srclist {
307                         delete $s
308                 }
309         }
310         if [info exists vat_(ui)] {
311                 $vat_(ui) clean_timers
312                 delete $vat_(ui)
313         }
314         #if [info exists vat_(agent)] {
315         #       $vat_(agent) release
316         #       set rtp_session [$vat_(agent) set session_]
317         #       set encoder [$vat_(agent) set encoder_]
318         #       set ctrller [$vat_(agent) set controller_]
319         #       delete $rtp_session
320         #       delete $encoder
321         #       delete $ctrller
322         #}
323 }
324 
325 

~ [ 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.