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

Open Mash Cross Reference
mash/tcl/tgw/ui-Real.tcl

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

  1 # ui-Real.tcl --
  2 #
  3 #       This is the code that creates the windows used to add/configure a new
  4 #       Real Transcoder.
  5 #
  6 # This file has the main ui component of the tgw application. Also, it contains
  7 # many of the slightly modified superclasses to make things work... This is the
  8 # main file with all the code in it.
  9 #
 10 # Copyright (c) 2000-2002 The Regents of the University of California.
 11 # All rights reserved.
 12 #
 13 # Redistribution and use in source and binary forms, with or without
 14 # modification, are permitted provided that the following conditions are met:
 15 #
 16 # A. Redistributions of source code must retain the above copyright notice,
 17 #    this list of conditions and the following disclaimer.
 18 # B. Redistributions in binary form must reproduce the above copyright notice,
 19 #    this list of conditions and the following disclaimer in the documentation
 20 #    and/or other materials provided with the distribution.
 21 # C. Neither the names of the copyright holders nor the names of its
 22 #    contributors may be used to endorse or promote products derived from this
 23 #    software without specific prior written permission.
 24 #
 25 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
 26 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 27 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 28 # ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
 29 # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 30 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 31 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 32 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 33 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 34 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 35 
 36 import ServerProfileWindow ServerProfileSave StreamProfileSave StreamProfileWindow AudioAgentTGW TopLevelWindow OutgoingSession
 37 
 38 # this class is not currently used, but I didn't want to delete it...
 39 Class NewTGWtranscoderScreen -superclass TopLevelWindow -configuration { }
 40 
 41 NewTGWtranscoderScreen instproc init { mainUI } {
 42     $self next .newOutput
 43     $self instvar ui_ 
 44     set ui_ $mainUI
 45 }
 46 
 47 NewTGWtranscoderScreen instproc build w {
 48     $self instvar ui_
 49     $self create-window $w "New Output"
 50     wm withdraw $w
 51 
 52     set x [winfo rootx .]
 53     set y [winfo rooty .]
 54     incr y [winfo height .]
 55     incr y -[winfo reqheight $w]
 56     incr y -20
 57     # adjust for virtual desktops
 58     incr x [winfo vrootx .]
 59     incr y [winfo vrooty .]
 60     if { $y < 0 } { set y 0 }
 61     if { $x < 0 } {
 62         set x 0
 63     } else {
 64         set right [expr [winfo screenwidth .] - \
 65                 [winfo reqwidth $w]]
 66         if { $x > $right } {
 67             set x $right
 68         }
 69     }
 70     wm geometry $w +$x+$y
 71     
 72     button $w.newReal -text "New Real Transcoder" -relief raised \
 73             -font [$self get_option smallfont] -highlightthickness 1 \
 74             -command "$ui_ showNewRealScreen"
 75     button $w.newH261 -text "New Bandwidth Limiter" -relief raised \
 76             -font [$self get_option smallfont] -highlightthickness 1 \
 77             -command "$ui_ showNewH261screen"
 78     button $w.newRedirector -text "New Redirector" -relief raised \
 79             -font [$self get_option smallfont] -highlightthickness 1 \
 80             -command "$ui_ showNewRedirector"
 81     button $w.cancel -text "Cancel" -relief raised \
 82             -font [$self get_option smallfont] -highlightthickness 1 \
 83             -command "wm withdraw $w"
 84     pack $w.newReal $w.newH261 $w.newRedirector $w.cancel -padx 1 -pady 1
 85 }
 86 
 87 # asks for the server,port, username and password of the Real
 88 # server you are going to use.
 89 Class RealServerUI -superclass TopLevelWindow -configuration { }
 90 
 91 RealServerUI instproc init { mainUI } {
 92     $self next .realServer
 93     $self instvar ui_ loadScreen_ saveServer_
 94     set ui_ $mainUI
 95     set loadScreen_ [new ServerProfileWindow $self]
 96     set saveServer_ [new ServerProfileSave]
 97 }
 98 
 99 RealServerUI instproc setServerInfo { sName sPort uName uPass } {
100     global inputtedSName inputtedSPort inputtedUName inputtedPass
101     set inputtedSName $sName
102     set inputtedSPort $sPort
103     set inputtedUName $uName
104     set inputtedPass $uPass
105 }
106 
107 RealServerUI instproc build w {
108     $self instvar ui_ loadScreen_ saveServer_
109     $self create-window $w "RealServer Info"
110     wm withdraw $w
111     global inputtedSName inputtedSPort inputtedUName inputtedPass
112 
113     frame $w.top
114     label $w.top.sname -anchor w -text "Server Name:"
115     entry $w.top.snameEntry -textvariable inputtedSName -relief sunken
116     grid $w.top.sname $w.top.snameEntry -stick news
117     label $w.top.sport -anchor w -text "Server Port:"
118     entry $w.top.sportEntry -textvariable inputtedSPort -relief sunken
119     grid $w.top.sport $w.top.sportEntry -stick news
120     label $w.top.uname -anchor w -text "User Name:"
121     entry $w.top.unameEntry -textvariable inputtedUName -relief sunken
122     grid $w.top.uname $w.top.unameEntry -stick news
123     label $w.top.pass -anchor w -text "Password:"
124     entry $w.top.passEntry -textvariable inputtedPass -relief sunken -show *
125     grid $w.top.pass $w.top.passEntry -stick news
126 #    label $w.warning -anchor w -text "Leave blank if not broadcasting live"
127     frame $w.bottom
128     button $w.bottom.load -text "Load" -relief raised \
129             -font [$self get_option smallfont] -highlightthickness 1 \
130             -command "$loadScreen_ toggle"
131     button $w.bottom.save -text "Save" -relief raised \
132             -font [$self get_option smallfont] -highlightthickness 1 \
133             -command "$saveServer_ toggle"
134     button $w.bottom.ok -text "OK" -relief raised \
135             -font [$self get_option smallfont] -highlightthickness 1 \
136             -command "$self callNewRealSession"
137     button $w.bottom.cancel -text "Cancel" -relief raised \
138             -font [$self get_option smallfont] -highlightthickness 1 \
139             -command "$self toggle"
140     grid $w.bottom.load $w.bottom.save $w.bottom.ok $w.bottom.cancel -stick news
141 #    pack $w.top $w.warning $w.bottom
142     pack $w.top $w.bottom
143 }
144 
145 RealServerUI instproc toggle { {comb {}} } {
146     global inputtedSName inputtedSPort inputtedUName inputtedPass
147     $self instvar combine_
148 
149     set inputtedSName ""
150     set inputtedSPort ""
151     set inputtedUName ""
152     set inputtedPass ""
153     set combine_ $comb
154 
155     $self next
156 }
157 
158 RealServerUI instproc callNewRealSession { } {
159     $self instvar ui_ combine_
160     global inputtedSName inputtedSPort inputtedUName inputtedPass
161     if { $combine_ == "combine"} {
162         $ui_ newCombiner $inputtedSName $inputtedSPort $inputtedUName $inputtedPass
163     } else {
164         $ui_ newRealSession $inputtedSName $inputtedSPort $inputtedUName $inputtedPass
165     }
166     $self toggle
167 }
168 
169 # this is the window used to configure different specifications
170 # when transcoding a stream to RealMedia...
171 Class RealConfigUI -superclass TopLevelWindow -configuration { }
172 
173 RealConfigUI instproc init { mainUI } {
174     $self next .realConfig
175     $self instvar ui_ saveStream_ loadStream_
176     set ui_ $mainUI
177     set saveStream_ [new StreamProfileSave]
178     set loadStream_ [new StreamProfileWindow]
179 }
180 
181 RealConfigUI instproc build w {
182     global use56K use128K use256K use512K other otherInputted useSS outputFPS title author copyright sendtoRealServer streamName saveAsFile fileName sendAudio audioAddr
183     $self instvar saveStream_ loadStream_
184     
185     $self create-window $w "Config RealStream"
186     wm withdraw $w
187     frame $w.datarate
188     label $w.datarate.label -anchor w -text "DataRate:"
189     checkbutton $w.datarate.56K -text "56K" -variable use56K
190     checkbutton $w.datarate.512K -text "512K" -variable use512K
191     grid $w.datarate.label $w.datarate.56K $w.datarate.512K -sticky news
192     checkbutton $w.datarate.128K -text "128K" -variable use128K
193     checkbutton $w.datarate.other -text "Other:" -variable other -state disabled
194     entry $w.datarate.otherEntry -textvariable otherInputted -relief sunken -width 4
195     grid $w.datarate.128K -col 1 -row 1
196     grid $w.datarate.other -col 2 -row 1
197     grid $w.datarate.otherEntry -col 3 -row 1
198     checkbutton $w.datarate.256K -text "256K" -variable use256K
199     grid $w.datarate.256K -sticky news -col 1
200     frame $w.streamsettings
201     checkbutton $w.streamsettings.useSS -text "Use Sure Stream" -variable useSS
202     grid $w.streamsettings.useSS -sticky w
203     label $w.streamsettings.fps -anchor w -text "Frames Per Sec:"
204     entry $w.streamsettings.fpsEntry -textvariable outputFPS -relief sunken -width 2
205     grid $w.streamsettings.fps $w.streamsettings.fpsEntry -sticky w
206     frame $w.authorsettings
207     label $w.authorsettings.titLabel -anchor w -text "Title:"
208     entry $w.authorsettings.title -textvariable title -relief sunken
209     grid $w.authorsettings.titLabel $w.authorsettings.title -sticky w
210     label $w.authorsettings.autLabel -anchor w -text "Author:"
211     entry $w.authorsettings.author -textvariable author -relief sunken
212     grid $w.authorsettings.autLabel $w.authorsettings.author -sticky w
213     label $w.authorsettings.copyLabel -anchor w -text "Copyright:"
214     entry $w.authorsettings.copyright -textvariable copyright -relief sunken
215     grid $w.authorsettings.copyLabel $w.authorsettings.copyright -sticky w
216     frame $w.sendto
217     checkbutton $w.sendto.server -text "Send to RealServer" -variable sendtoRealServer
218     grid $w.sendto.server -sticky w
219     label $w.sendto.servlabel -anchor c -text "Streamname:"
220     entry $w.sendto.streamName -textvariable streamName -relief sunken
221     grid $w.sendto.servlabel $w.sendto.streamName
222     checkbutton $w.sendto.file -text "Save as file" -variable saveAsFile
223     grid $w.sendto.file -sticky w
224     label $w.sendto.fileLabel -anchor c -text "Filename:"
225     entry $w.sendto.fileName -textvariable fileName -relief sunken
226     button $w.sendto.browseButt -text "Browse" -relief raised \
227             -font [$self get_option smallfont] -highlightthickness 1 \
228             -command { set fileName [tk_getSaveFile -defaultextension .rm -filetypes {{{RealMedia File} {.rm}}} -title "Save As..." ] }
229     grid $w.sendto.fileLabel $w.sendto.fileName $w.sendto.browseButt
230     checkbutton $w.sendto.audio -text "Send Audio" -variable sendAudio
231     grid $w.sendto.audio -sticky w
232     label $w.sendto.audioLabel -anchor c -text "Audio Source:"
233     entry $w.sendto.audioAddr -textvariable audioAddr -relief sunken
234     grid $w.sendto.audioLabel $w.sendto.audioAddr
235     frame $w.buttons
236     button $w.buttons.load -text "Load" -relief raised \
237             -font [$self get_option smallfont] -highlightthickness 1 \
238             -command "$loadStream_ toggle"
239     button $w.buttons.save -text "Save" -relief raised \
240             -font [$self get_option smallfont] -highlightthickness 1 \
241             -command "$saveStream_ toggle"
242     button $w.buttons.ok -text "OK" -relief raised \
243             -font [$self get_option smallfont] -highlightthickness 1 \
244             -command "$self okPressed"
245     button $w.buttons.cancel -text "Cancel" -relief raised \
246             -font [$self get_option smallfont] -highlightthickness 1 \
247             -command "$self toggle"
248     pack $w.buttons.load $w.buttons.save $w.buttons.ok $w.buttons.cancel -side left
249     pack $w.datarate $w.streamsettings $w.authorsettings $w.sendto $w.buttons -anchor w
250 }
251 
252 RealConfigUI instproc okPressed { } {
253     $self instvar currentSrc_
254     global use56K use128K use256K use512K other otherInputted useSS outputFPS title author copyright sendtoRealServer streamName saveAsFile fileName sendAudio audioAddr
255 
256     $currentSrc_ setOptions $use56K $use128K $use256K $use512K $other $otherInputted $useSS $outputFPS $title $author $copyright $sendtoRealServer $streamName $saveAsFile $fileName $sendAudio $audioAddr
257     $self toggle
258 }
259 
260 RealConfigUI instproc toggle { { src 0 } } {
261     $self instvar currentSrc_
262     if { $src != 0 } { 
263         set currentSrc_ $src
264         $currentSrc_ getOptions
265     }
266     $self next
267 }
268 
269 # the default outgoing session (parent class for all specific
270 # outgoing sessions for each kind of transcoder).
271 Class OutgoingSession
272 
273 OutgoingSession instproc setFormat { type } {
274     $self instvar format_
275     set format_ $type
276 }
277 
278 OutgoingSession instproc queryFormat { } {
279     $self instvar format_
280     return $format_
281 }
282 
283 # the outgoingSession when using a Real transcoder.
284 Class OutgoingReal -superclass OutgoingSession
285 
286 # when the cell is created, you are passed this info from the main tgw-ui class.
287 OutgoingReal instproc init { sname sport uname pass } {
288     $self instvar server_ port_ user_ pass_
289     $self setFormat "Real"
290     set server_ $sname
291     set port_ $sport
292     set user_ $uname
293     set pass_ $pass
294 }
295 
296 # called by updateUI
297 OutgoingReal instproc makeUI { w ui src rownum} {
298     $self instvar server_ port_ user_ pass_
299     new RealMatrixUI $server_ $port_ $user_ $pass_ $w $ui $src
300 }
301 
302 # the actually cell in the matrix.
303 Class RealMatrixUI
304 
305 RealMatrixUI instproc init { sname sport uname pass window ui src } {
306     $self instvar server_ port_ user_ pass_ w ui_ src_
307     set server_ $sname
308     set port_ $sport
309     set user_ $uname
310     set pass_ $pass
311     set w $window
312     set ui_ $ui
313     set src_ $src
314     
315     frame $w.buttons
316     button $w.buttons.start -text Start -relief raised -font [$self get_option smallfont] -highlightthickness 1 -command "$self startRealTranscoding" -state disabled -width 10
317     button $w.buttons.config -text Config -relief raised -font [$self get_option smallfont] -highlightthickness 1 -command "[$ui_ set configReal_] toggle $self" -width 10
318     pack $w.buttons.start $w.buttons.config -side left
319     grid $w.buttons -row 4
320 #    pack $w -side left
321 }
322 
323 # gets the specifications of what to display in the cell.
324 RealMatrixUI instproc getOptions { } {
325     global use56K use128K use256K use512K other otherInputted useSS outputFPS title author copyright sendtoRealServer streamName saveAsFile fileName sendAudio audioAddr
326     $self instvar datarate_ fps_ title_ author_ copyright_ sendToServer_ streamName_ saveAsFile_ fileName_ sendAudio_ audioAddr_ w
327 
328     if { [info exists fps_] } {
329         set outputFPS $fps_
330     } else {
331         set outputFPS ""
332     }
333     if { [info exists title_] } {
334         set title $title_       
335     } else {
336         set title ""
337     }
338     if { [info exists author_] } {
339         set author $author_
340     } else {
341         set author ""
342     }
343     if { [info exists copyright_] } {
344         set copyright $copyright_
345     } else {
346         set copyright ""
347     }
348     if { [info exists sendToServer_] } {
349         set sendtoRealServer $sendToServer_
350     } else {
351         set sendtoRealServer 0
352     }
353     if { [info exists streamName_] } {
354         set streamName $streamName_
355     } else {
356         set streamName ""
357     }
358     if { [info exists saveAsFile_] } {
359         set saveAsFile $saveAsFile_
360     } else {
361         set saveAsFile 0
362     }
363     if { [info exists fileName_] } {
364         set fileName $fileName_
365     } else {
366         set fileName ""
367     }
368     if { [info exists sendAudio_] } {
369         set sendAudio $sendAudio_
370     } else {
371         set sendAudio 0
372     }
373     if { [info exists audioAddr_] } {
374         set audioAddr $audioAddr_
375     } else {
376         set audioAddr ""
377     }
378     if { ![info exists datarate_] } {
379         set datarate_ ""
380     }
381 
382     set useSS 0
383     set use56K 0
384     set use128K 0
385     set use256K 0
386     set use512K 0
387     set tempDataRate $datarate_
388     while { [string length $tempDataRate] > 0 } {
389         if { [string compare "SS" [string range $tempDataRate 0 1]] == 0 } {
390             set useSS 1
391             set tempDataRate [string range $tempDataRate 2 [string length $tempDataRate]]
392         } elseif { [string compare "56," [string range $tempDataRate 0 2]] == 0 } {
393             set use56K 1
394             set tempDataRate [string range $tempDataRate 3 [string length $tempDataRate]]
395         } elseif { [string compare "128," [string range $tempDataRate 0 3]] == 0 } {
396             set use128K 1
397             set tempDataRate [string range $tempDataRate 4 [string length $tempDataRate]]
398         } elseif { [string compare "256," [string range $tempDataRate 0 3]] == 0 } {
399             set use256K 1
400             set tempDataRate [string range $tempDataRate 4 [string length $tempDataRate]]
401         } elseif { [string compare "512," [string range $tempDataRate 0 3]] == 0 } {
402             set use512K 1
403             set tempDataRate [string range $tempDataRate 4 [string length $tempDataRate]]
404         } else {
405             set other 1
406             set tempDataRate [string trimright $tempDataRate ","]
407             set otherInputted $tempDataRate
408             set tempDataRate ""
409         }
410     }
411 }
412 
413 # sets the specifications for what to display in the cell
414 # called when the RealConfigUI window is closed.
415 RealMatrixUI instproc setOptions { use56K use128K use256K use512K other otherInputted useSS outputFPS title author copyright sendtoRealServer streamName saveAsFile fileName sendAudio audioAddr } {
416     $self instvar datarate_ fps_ title_ author_ copyright_ sendToServer_ streamName_ saveAsFile_ fileName_ sendAudio_ audioAddr_ w
417     set fps_ $outputFPS
418     set title_ $title
419     set author_ $author
420     set copyright_ $copyright
421     set sendToServer_ $sendtoRealServer
422     set streamName_ $streamName
423     set saveAsFile_ $saveAsFile
424     set fileName_ $fileName
425     set sendAudio_ $sendAudio
426     set audioAddr_ $audioAddr
427     if { $useSS == 1 } {
428         set datarate_ "SS"
429     } else {
430         set datarate_ ""
431     }
432     if { $use56K == 1 } {
433         append datarate_ "56,"
434     }
435     if { $use128K == 1 } {
436         append datarate_ "128,"
437     }
438     if { $use256K == 1 } {
439         append datarate_ "256,"
440     }
441     if { $use512K == 1 } {
442         append datarate_ "512,"
443     }
444     if { $other == 1 } {
445         append datarate_ "$otherInputted"
446         append datarate_ ","
447     }
448 
449     if { [llength [info commands $w.sname]] != 0 } {
450         destroy $w.sname
451     }
452     if { $sendToServer_ == 1 } {
453         set temp "Stream: $streamName_"
454         label $w.sname -anchor w -text $temp -font [$self get_option smallfont] -pady 0 -borderwidth 0
455         grid $w.sname -row 0
456     }
457     if { [llength [info commands $w.fname]] != 0 } {
458         destroy $w.fname
459     }
460     if { $saveAsFile_ == 1 } {
461         set temp2 "File: $fileName_"
462         label $w.fname -anchor w -text $temp2 -font [$self get_option smallfont] -pady 0 -borderwidth 0
463         grid $w.fname -row 1
464     }
465     if { [llength [info commands $w.specs]] != 0 } {
466         destroy $w.specs
467     }
468     set temp3 "Spec: $fps_"
469     set printedDatarate [string trimright $datarate_ ","]
470     append temp3 "fps, $printedDatarate"
471     label $w.specs -anchor w -text $temp3 -font [$self get_option smallfont] -pady 0 -borderwidth 0
472     grid $w.specs -row 2
473     if { [llength [info commands $w.audio]] != 0 } {
474         destroy $w.audio
475     }
476     if { $sendAudio_ == 1 } {
477         set temp4 "Audio: $audioAddr_"
478         label $w.audio -anchor w -text $temp4 -font [$self get_option smallfont] -pady 0 -borderwidth 0
479         grid $w.audio -row 3
480     }    
481     $w.buttons.start configure -state normal
482 }
483 
484 # called when start is clicked.
485 RealMatrixUI instproc startRealTranscoding { } {
486     $self instvar datarate_ fps_ title_ author_ copyright_ sendToServer_ streamName_ saveAsFile_ fileName_ sendAudio_ audioAddr_ ui_ src_ server_ port_ user_ pass_ w rend_ audio_
487 
488     set outputTypes 0
489     if { $sendToServer_ == 1 } {
490         if { $saveAsFile_ == 1 } {
491             set outputTypes 1
492         }    
493     } else {
494         set outputTypes 2
495     }
496 
497     if { $sendAudio_ == 1 } {
498         set avOptions "A/V"
499     } else {
500         set avOptions "V"
501     }
502 
503     set rend_ [new RealWindow $server_ $streamName_ $user_ $pass_ $port_ $fps_ $datarate_ $outputTypes $fileName_ $title_ $author_ $copyright_ $avOptions]
504     if { $sendAudio_ == 1 } {
505         set audio_ [new AudioAgentTGW TGW $audioAddr_ $rend_]
506     }
507     set dec [$src_ data-handler]
508     $rend_ setColorModel [$dec csss]
509     $dec attach $rend_
510     $w.buttons.start configure -text Stop -command "$self stopRealTranscoding"
511     $w.buttons.config configure -state disabled
512 }
513 
514 # called when stop is clicked.
515 RealMatrixUI instproc stopRealTranscoding { } {
516     $self instvar rend_ ui_ src_ sendAudio_ audio_ w
517     [$src_ data-handler] detach $rend_
518     if { $sendAudio_ == 1 } {
519         $audio_ destroy
520     }
521     $w.buttons.start configure -state disabled
522     delete $rend_    
523 }
524 
525 # =======================================
526 
527 Class OutgoingCombiner -superclass OutgoingSession
528 
529 OutgoingCombiner instproc init { comb sname sport uname pass } {
530     $self instvar realEnc_ server_ port_ user_ pass_
531     $self setFormat "Real"
532     set realEnc_ $comb
533     set server_ $sname
534     set port_ $sport
535     set user_ $uname
536     set pass_ $pass
537 }
538 
539 OutgoingCombiner instproc makeUI { w ui src rownum } {
540     $self instvar realEnc_ server_ port_ user_ pass_ w_
541     set w_ $w
542     set dec [$src data-handler]
543     set combiner_link [new CombinerSource $realEnc_ $src [$dec csss]]
544     
545     #if this is the first row then display a little gui to set up the real transcoder
546     if { $rownum == 1 } {
547         new RealMatrixUIComb $realEnc_ $server_ $port_ $user_ $pass_ $w $ui $src
548     }
549 
550     frame $w.sideselector
551     button $w.sideselector.left -text L -relief raised -font [$self get_option smallfont] -highlightthickness 1 -command "$self sideSelectButtonClick 1 $src $w" -width 3
552     button $w.sideselector.right -text R -relief raised -font [$self get_option smallfont] -highlightthickness 1 -command "$self sideSelectButtonClick 2 $src $w" -width 3
553     pack $w.sideselector.left $w.sideselector.right -side left
554     grid $w.sideselector -row 5
555 
556     [$src data-handler] attach $combiner_link
557 }
558 
559 OutgoingCombiner instproc sideSelectButtonClick { pos src w } {
560     $self instvar realEnc_
561     $realEnc_ setSide $pos $src
562     if { $pos == 1 } {
563         $w.sideselector.right configure -state disabled
564     } else {
565         $w.sideselector.left configure -state disabled
566     }
567 }
568 
569 Class RealMatrixUIComb -superclass RealMatrixUI
570 
571 RealMatrixUIComb instproc init { comb sname sport uname pass window ui src } {
572     $self instvar combiner_
573     set combiner_ $comb
574     $self next $sname $sport $uname $pass $window $ui $src
575 }
576 
577 # called when start is clicked.
578 RealMatrixUIComb instproc startRealTranscoding { } {
579     $self instvar datarate_ fps_ title_ author_ copyright_ sendToServer_ streamName_ saveAsFile_ fileName_ sendAudio_ audioAddr_ ui_ src_ server_ port_ user_ pass_ w rend_ audio_ combiner_
580 
581     set outputTypes 0
582     if { $sendToServer_ == 1 } {
583         if { $saveAsFile_ == 1 } {
584             set outputTypes 1
585         }    
586     } else {
587         set outputTypes 2
588     }
589 
590     if { $sendAudio_ == 1 } {
591         set avOptions "A/V"
592     } else {
593         set avOptions "V"
594     }
595 
596     if { [$combiner_ ready] == "yes" } {
597         set rend_ [new RealWindow $server_ $streamName_ $user_ $pass_ $port_ $fps_ $datarate_ $outputTypes $fileName_ $title_ $author_ $copyright_ $avOptions]
598         if { $sendAudio_ == 1 } {
599             set audio_ [new AudioAgentTGW TGW $audioAddr_ $rend_]
600         }
601         $rend_ setColorModel 420
602     
603         $combiner_ linkEncoder $rend_
604         $w.buttons.start configure -text Stop -command "$self stopRealTranscoding"
605         $w.buttons.config configure -state disabled
606     } else {
607         puts "You need to select the location of the two sources first"
608     }
609 }
610 
611 # called when stop is clicked.
612 RealMatrixUIComb instproc stopRealTranscoding { } {
613     $self instvar rend_ ui_ src_ sendAudio_ audio_ w combiner_
614     $combiner_ unlinkEncoder
615     if { $sendAudio_ == 1 } {
616         $audio_ destroy
617     }
618     $w.buttons.start configure -state disabled
619     delete $rend_    
620 }
621 

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