1 # temporal-selector-input.tcl --
2 #
3 # FIXME: This file needs a description here.
4 #
5 # Copyright (c) 1998-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 Class TemporalSelectorInput
32
33 TemporalSelectorInput instproc init {tselect_obj id} {
34 $self next;
35
36 $self instvar tselect_obj_;
37 $self instvar callback_;
38 $self instvar subgraph_list_;
39 $self instvar id_;
40
41 set tselect_obj_ $tselect_obj;
42 set callback_ "";
43 set id_ $id;
44 set subgraph_list_ "";
45 }
46
47 TemporalSelectorInput instproc destroy {} {
48 $self next;
49 }
50
51 TemporalSelectorInput instproc set_callback cb {
52 $self instvar callback_;
53
54 set callback_ $cb;
55 }
56
57 TemporalSelectorInput instproc add_subgraph s {
58 $self instvar subgraph_list_;
59
60 if {[lsearch $subgraph_list_ $s] == -1} {
61 lappend subgraph_list_ $s;
62 }
63 }
64
65 TemporalSelectorInput instproc del_subgraph s {
66 $self instvar subgraph_list_;
67
68 set idx [lsearch $subgraph_list_ $s]
69 if {$idx == -1} {
70 set subgraph_list_ [lreplace $subgraph_list_ $idx $idx];
71 }
72 }
73
74 TemporalSelectorInput instproc update_subgraph s {
75 }
76
77 TemporalSelectorInput instproc get_current_ts {} {
78 # No default for this.
79 }
80
81 Class TemporalSelectorInput/JPEG -superclass TemporalSelectorInput
82
83 TemporalSelectorInput/JPEG instproc init {args} {
84 eval $self next $args;
85
86 $self instvar decoder_;
87
88 set decoder_ [new Module/Selector/Temporal/Indep];
89 }
90
91 TemporalSelectorInput/JPEG instproc destroy {} {
92
93 $self instvar decoder_;
94
95 if {$decoder_ != ""} {
96 delete $decoder_;
97 }
98
99 $self next;
100 }
101
102 TemporalSelectorInput/JPEG instproc get_decoder {} {
103 $self instvar decoder_;
104
105 return $decoder_;
106 }
107
108 TemporalSelectorInput/JPEG instproc set_callback cb {
109 $self next $cb;
110
111 $self instvar decoder_;
112
113 $decoder_ set_callback $cb;
114 }
115
116 TemporalSelectorInput/JPEG instproc update_subgraph s {
117
118 $self instvar decoder_;
119 $self instvar subgraph_info_;
120
121 if {$s != ""} {
122 $decoder_ update $subgraph_info_($s,srcid);
123 }
124 }
125
126 TemporalSelectorInput/JPEG instproc add_subgraph s {
127 $self next $s;
128
129 $self instvar tselect_obj_;
130 $self instvar subgraph_info_;
131 $self instvar decoder_;
132 $self instvar id_;
133
134 set spec [$tselect_obj_ GenerateSpec];
135 set spec_split [split $spec "/"];
136
137 set addr [lindex $spec_split 0];
138 set port [lindex $spec_split 1];
139
140 set subgraph_info_($s,vagent) [new PsvpVideoAgent $addr/$port];
141 [$subgraph_info_($s,vagent) get_transmitter] set loopback_ 0;
142
143 set subgraph_info_($s,srcid) [$subgraph_info_($s,vagent) get_local_srcid];
144
145 global kpatel_debug;
146
147 if {[info exists kpatel_debug]} {
148 set logger [new Module/RTPPktLogger];
149 $logger target [$subgraph_info_($s,vagent) get_transmitter];
150 $decoder_ register $subgraph_info_($s,srcid) $logger;
151 } else {
152 $decoder_ register $subgraph_info_($s,srcid) [$subgraph_info_($s,vagent) get_transmitter];
153 }
154
155 $tselect_obj_ set_subgraph_input_spec $s $id_ $addr/$port/$subgraph_info_($s,srcid);
156 }
157
158 TemporalSelectorInput/JPEG instproc trigger_sr {src} {
159 $self instvar subgraph_list_
160 $self instvar subgraph_info_;
161
162 set in_layer [lindex [$src set layers_] 0];
163
164 foreach s $subgraph_list_ {
165 if {[info exists subgraph_info_($s,vagent)]} {
166 set out_layer [lindex [[$subgraph_info_($s,vagent) set local_] set layers_] 0];
167
168 $out_layer set ref_mts_ [$in_layer set mts_];
169 $out_layer set ref_ntp_sec_ [$in_layer set ntp_ts_sec_];
170 $out_layer set ref_ntp_fsec_ [$in_layer set ntp_ts_fsec_];
171 }
172 }
173 }
174
175 TemporalSelectorInput/JPEG instproc del_subgraph s {
176 $self next $s;
177
178 $self instvar decoder_;
179
180 $decoder_ unregister $subgraph_info_($s,srcid);
181
182 delete $subgraph_info_($s,vagent);
183
184 unset subgraph_info_($s,vagent);
185 unset subgraph_info_($s,srcid);
186 }
187
188 TemporalSelectorInput/JPEG instproc get_current_ts {} {
189 $self instvar decoder_;
190
191 return [$decoder_ get_current_ts];
192 }
193
194
195 Class TemporalSelectorInput/H261 -superclass TemporalSelectorInput
196
197 TemporalSelectorInput/H261 instproc init {args} {
198 eval $self next $args;
199
200 $self instvar decoder_;
201 $self instvar out_srcid_;
202
203 set out_srcid_ "";
204 set decoder_ [new Module/Selector/Temporal/Indep];
205 }
206
207 TemporalSelectorInput/H261 instproc destroy {} {
208 $self instvar decoder_;
209
210 if {$decoder_ != ""} {
211 delete $decoder;
212 }
213
214 $self next;
215 }
216
217 TemporalSelectorInput/H261 instproc get_decoder {} {
218 $self instvar decoder_;
219
220 return $decoder_;
221 }
222
223 TemporalSelectorInput/H261 instproc set_callback cb {
224 $self next $cb;
225
226 $self instvar decoder_;
227
228 $decoder_ set_callback $cb;
229 }
230
231 TemporalSelectorInput/H261 instproc update_subgraph s {
232 $self instvar decoder_;
233
234 $self instvar out_srcid_;
235
236 $decoder_ update $out_srcid_;
237 }
238
239 TemporalSelectorInput/H261 instproc trigger_sr {src} {
240 $self instvar out_vagent_;
241
242 if {[info exists out_vagent_]} {
243 set in_layer [lindex [$src set layers_] 0];
244 set out_layer [lindex [[$out_vagent_ set local_] set layers_] 0];
245 $out_layer set ref_mts_ [$in_layer set mts_];
246 $out_layer set ref_ntp_sec_ [$in_layer set ntp_ts_sec_];
247 $out_layer set ref_ntp_fsec_ [$in_layer set ntp_ts_fsec_];
248 }
249 }
250
251 TemporalSelectorInput/H261 instproc add_subgraph s {
252 $self next $s;
253
254 $self instvar tselect_obj_;
255 $self instvar out_srcid_;
256 $self instvar out_vagent_;
257 $self instvar id_;
258 $self instvar decoder_;
259 $self instvar out_addr_;
260 $self instvar out_port_;
261
262 if {$out_srcid_ == ""} {
263 set spec [$tselect_obj_ GenerateSpec];
264 set spec_split [split $spec "/"];
265
266 set out_addr_ [lindex $spec_split 0];
267 set out_port_ [lindex $spec_split 1];
268
269 set out_vagent_ [new PsvpVideoAgent $out_addr_/$out_port_];
270 [$out_vagent_ get_transmitter] set loopback_ 0;
271
272 set out_srcid_ [$out_vagent_ get_local_srcid];
273
274 global kpatel_debug;
275
276 if {[info exists kpatel_debug]} {
277 set logger [new Module/RTPPktLogger];
278 $logger target [$out_vagent_ get_transmitter];
279 $decoder_ register $out_srcid_ $logger;
280 } else {
281 $decoder_ register $out_srcid_ [$out_vagent_ get_transmitter];
282 }
283 }
284
285 $tselect_obj_ set_subgraph_input_spec $s $id_ $out_addr_/$out_port_/$out_srcid_;
286 }
287
288 TemporalSelectorInput/H261 instproc get_current_ts {} {
289 $self instvar decoder_;
290
291 return [$decoder_ get_current_ts];
292 }
293
294
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.