1 # ui-H261Transcoder.tcl --
2 #
3 # Files relating to the UI for adding a bandwidth limiter transcoder.
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 import Module/VideoEncoder/Pixel/H261 TopLevelWindow OutgoingSession
32
33 Class H261TranscoderAddrInput -superclass TopLevelWindow -configuration { }
34
35 H261TranscoderAddrInput instproc init { mainUI } {
36 $self next .h261TranscoderInput
37 $self instvar ui_
38 set ui_ $mainUI
39 }
40
41 H261TranscoderAddrInput instproc build w {
42 $self instvar ui_
43 $self create-window $w "H261 Transcoder Info"
44 wm withdraw $w
45
46 global inputtedH261DestAddr inputtedH261MaxBW
47
48 frame $w.top
49 label $w.top.label -anchor w -text "Destination Address:"
50 entry $w.top.entry -textvariable inputtedH261DestAddr -relief sunken
51 grid $w.top.label $w.top.entry -stick news
52 frame $w.middle
53 label $w.middle.label -anchor w -text "Maximum Bandwidth(bps):"
54 entry $w.middle.entry -textvariable inputtedH261MaxBW -relief sunken
55 grid $w.middle.label $w.middle.entry -stick news
56 frame $w.bottom
57 button $w.bottom.ok -text "OK" -relief raised \
58 -font [$self get_option smallfont] -highlightthickness 1 \
59 -command "$self callNewH261Transcoder"
60 button $w.bottom.cancel -text "Cancel" -relief raised \
61 -font [$self get_option smallfont] -highlightthickness 1 \
62 -command "$self toggle"
63 grid $w.bottom.ok $w.bottom.cancel -stick news
64 pack $w.top $w.middle $w.bottom
65 }
66
67 H261TranscoderAddrInput instproc toggle { } {
68 global inputtedH261DestAddr inputtedH261MaxBW
69 set inputtedH261DestAddr ""
70 set inputtedH261MaxBW ""
71 $self next
72 }
73
74 H261TranscoderAddrInput instproc callNewH261Transcoder { } {
75 $self instvar ui_
76 global inputtedH261DestAddr inputtedH261MaxBW
77 $ui_ newH261Session $inputtedH261DestAddr $inputtedH261MaxBW
78 $self toggle
79 }
80
81 Class OutgoingH261 -superclass OutgoingSession
82
83 OutgoingH261 instproc init { osess maxBW auctionHouse addr } {
84 $self instvar osess_ maxBW_ auctionHouse_ addr_
85 $self setFormat "H261Transcoder"
86 set osess_ $osess
87 set maxBW_ $maxBW
88 set auctionHouse_ $auctionHouse
89 set addr_ $addr
90 }
91
92 OutgoingH261 instproc makeUI { w ui src rownum } {
93 $self instvar transmitBoxes_ bufferPool_ osess_ auctionHouse_ addr_
94 new OutgoingH261TransmitBox $w $src $addr_ $osess_ $auctionHouse_
95 }
96
97 Class OutgoingH261TransmitBox
98
99 OutgoingH261TransmitBox instproc init { w src addr osess auctionHouse} {
100 $self instvar src_ addr_ auctionHouse_ renderer_
101 global bandwidths
102 set src_ $src
103 set addr_ $addr
104 set auctionHouse_ $auctionHouse
105
106 set bufferPool [new BufferPool/RTP]
107 $bufferPool srcid [$src srcid]
108
109 set out_encoder [new Module/VideoEncoder/Pixel/H261]
110 $out_encoder buffer-pool $bufferPool
111 $out_encoder target $osess
112
113 set renderer_ [new Module/Renderer/PipeRenderer]
114 $renderer_ attach_encoder $out_encoder
115 $renderer_ use_auction_house $auctionHouse_
116 $renderer_ bandwidth_display $self
117 [$src_ data-handler] attach $renderer_
118
119 # this makes the GUI for the H261 Transcoder
120
121 # priorities_ auction_houses_ sources_
122
123 set f "helvetica -10 bold"
124
125 set extra $w
126 frame $extra.right
127 frame $extra.right.top
128 label $extra.right.top.prior -text "Priority" -width 10 -font $f
129 scale $extra.right.top.priority -from 0 -to 100 -width 12 -orient horizontal -relief groove -command "$self set_priority"
130 frame $extra.right.bottom
131 label $extra.right.bottom.bw -text "Bandwidth" -width 10 -font $f
132 # label $extra.right.bottom.currentbw -textvariable [$ui_ set bandwidths_($renderer)] -width 12 -font $f
133 label $extra.right.bottom.currentbw -textvariable bandwidths($src_,$addr_) -width 3 -font $f
134 label $extra.right.bottom.bwUnits -text "Kbps" -width 3 -font $f
135 pack $extra.right.top.priority $extra.right.top.prior -side right
136 pack $extra.right.bottom.bwUnits $extra.right.bottom.currentbw $extra.right.bottom.bw -side right
137 pack $extra.right.bottom $extra.right.top -side bottom -anchor w
138 # frame $extra.left
139 # radiobutton $extra.left.1 -variable priorities_($src,$addr) -text "Speaker" -value 0 -command "$auction_houses_($addr) set_characteristic $src 0" -font $f -width 8
140 # radiobutton $extra.left.2 -variable priorities_($src,$addr) -text "Audience" -value 1 -command "$auction_houses_($addr) set_characteristic $src 1" -font $f -width 8
141 # radiobutton $extra.left.3 -variable priorities_($src,$addr) -text "Slides" -value 2 -command "$auction_houses_($addr) set_characteristic $src 2" -font $f -width 8
142 # pack $extra.left.1 $extra.left.2 $extra.left.3 -side top
143 # pack $extra.left $extra.right -side left
144 pack $extra.right
145 # pack $extra -side left
146 }
147
148 # this is a helper function to display the current bandwidth usage (get's called from C++)
149
150 OutgoingH261TransmitBox instproc change_bwUsage { x } {
151 $self instvar src_ addr_
152 global bandwidths
153 set bandwidths($src_,$addr_) $x
154 }
155
156 # this is a helper function to set the priority (usage) of a given source (calls down to C++)
157 # not in use!!!
158 OutgoingH261TransmitBox instproc set_priority { x } {
159 $self instvar auctionHouse_ renderer_
160 $auctionHouse_ set_priority $renderer_ $x
161 }
162
163
164
165
166
167
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.