1 # sources should contains a list of ip address patterns for the sources
2 # that we are interested in.
3
4 sources *
5
6 # Maximum number of source
7
8 num_of_sources 4
9
10 # This is the session we are interested in
11
12 input_session 233.2.171.195/59762
13
14 # This is the description of the program
15
16 description { a windowing system for up to 4 input video streams }
17
18 # These are the variables that hooks the input video to the dali program
19
20 input_frame {in inW inH}
21 output_frame {out outW outH}
22
23 # Specifies the output format of the degas program. Can be either H261/JPEG
24 # If JPEG, we can specifies the quality (0 - 100), for example {JPEG 45}.
25
26 output_format {H261}
27 output_fps {15}
28
29 # Specifies the output size of the output video. Can be either "QCIF", "CIF",
30 # "SCIF", "PAL", "1/4 PAL", "1/16 PAL", "NTSC", "1/4 NTSC", "1/16 NTSC".
31
32 output_size {CIF}
33
34 # A unique string that helps identify the source. For example if there are
35 # more than one source, we can use an array of frames, indexed by the
36 # source_id.
37
38 source_id {src}
39
40 # For server to check if they are eligible to provide service.
41 # precondition { }
42 # server_responds { }
43
44 # List of Dali packages required by this program
45
46 packages {DvmByteGeom}
47
48 # All the following are dali programs
49
50 init_callback {
51
52 proc find_display {x y outW outH} {
53 set x [expr round($x*$outW)]
54 set y [expr round($y*$outH)]
55 global slot_info
56 for {set i 0} {$i < 8} {incr i} {
57 set topX [lindex $slot_info($i) 1]
58 set topY [lindex $slot_info($i) 2]
59 set width [lindex $slot_info($i) 3]
60 set height [lindex $slot_info($i) 4]
61 if {($x >= $topX) && ($x <= ($topX + $width)) && ($y >= $topY) && ($y <= ($topY + $height))} {
62 return $i
63 }
64 }
65 return -1
66 }
67 global slot_info
68 global dest_slot
69
70 set num_of_sources 0
71 set srclist {}
72
73 set w2 [expr $outW/2]
74 set w4 [expr $outW/4]
75 set w8 [expr $outW/8]
76 set w16 [expr $outW/16]
77 set bigw [expr 3*$outW/8]
78 set h2 [expr 3*$outH/8]
79 set h4 [expr $outH/4]
80
81 set slot_info(0) "null $w16 0 $bigw $h2"
82 lappend slot_info(0) [frame_clip $out $w16 0 $bigw $h2]
83
84 set slot_info(1) "null [expr 2*$w4 + $w16] 0 $bigw $h2"
85 lappend slot_info(1) [frame_clip $out [expr 2*$w4 + $w16] 0 $bigw $h2]
86
87 set slot_info(2) "null $w16 $h2 $bigw $h2"
88 lappend slot_info(2) [frame_clip $out $w16 $h2 $bigw $h2]
89
90 set slot_info(3) "null [expr 2*$w4 + $w16] $h2 $bigw $h2"
91 lappend slot_info(3) [frame_clip $out [expr 2*$w4 + $w16] $h2 $bigw $h2]
92
93 set slot_info(4) "null 0 [expr 2*$h2] $w4 $h4"
94 lappend slot_info(4) [frame_clip $out 0 [expr 2*$h2] $w4 $h4]
95
96 set slot_info(5) "null $w4 [expr 2*$h2] $w4 $h4"
97 lappend slot_info(5) [frame_clip $out $w4 [expr 2*$h2] $w4 $h4]
98
99 set slot_info(6) "null $w2 [expr 2*$h2] $w4 $h4"
100 lappend slot_info(6) [frame_clip $out $w2 [expr 2*$h2] $w4 $h4]
101
102 set slot_info(7) "null [expr $w4 + $w2] [expr 2*$h2] $w4 $h4"
103 lappend slot_info(7) [frame_clip $out [expr $w4+$w2] [expr 2*$h2] $w4 $h4]
104
105 set slot_info(8) "null [expr 0.5*$w4] 0 [expr 3*$w4] [expr 2*$h2]"
106 lappend slot_info(8) [frame_clip $out [expr $w4/2] 0 [expr 3*$w4] [expr 2*$h2]]
107
108 frame_set_black $out
109 set num_of_restore 0
110 set num_of_icon 0
111 puts "init callback done"
112 }
113
114 new_source_callback {
115
116 # New source are iconify by default
117 incr num_of_icon
118
119 # Find an empty icon slot.
120 for {set i 4} {$i < 8} {incr i} {
121 set current_src [lindex $slot_info($i) 0]
122 if {$current_src == "null"} {
123 set slot_info($i) [lreplace $slot_info($i) 0 0 $src]
124 set dest_slot($src) $i
125 return
126 }
127 }
128 }
129
130 del_source_callback {
131
132 }
133
134 recv_frame_callback {
135 set slot [lindex $slot_info($dest_slot($src)) 5]
136 frame_scale in($src) slot
137 }
138
139 mouse_coord {mouse_x mouse_y}
140
141 mouse_click_callback {
142
143 set pos [find_display $mouse_x $mouse_y $outW $outH]
144 set selected_slot $slot_info($pos)
145 set s [lindex $selected_slot 0]
146
147 if {$s != "null"} {
148 if {$pos < 4} {
149 # iconify. restore it. find a slot for it.
150 for {set i 4} {$i < 8} {incr i} {
151 set source [lindex $slot_info($i) 0]
152 if {$source == "null"} {
153 set dest $i
154 break;
155 }
156 }
157 incr num_of_icon 1
158 incr num_of_restore -1
159 } else {
160 # iconify it.
161 for {set i 0} {$i < 4} {incr i} {
162 set source [lindex $slot_info($i) 0]
163 if {$source == "null"} {
164 set dest $i
165 break
166 }
167 }
168 incr num_of_restore 1
169 incr num_of_icon -1
170 }
171
172 #if {$num_of_restore == 1} {
173 # use single view
174 # set dest 8
175 #}
176
177 set slot_info($dest) [lreplace $slot_info($dest) 0 0 $s]
178 set slot_info($pos) [lreplace $slot_info($pos) 0 0 "null"]
179 set dest_slot($s) $dest
180 frame_set_black [lindex $slot_info($pos) 5]
181 puts "$num_of_restore $num_of_icon"
182 }
183 }
184
185 destroy_callback {
186
187 }
188
189 # The following is not supported yet.
190
191 resize_callback {
192
193 }
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.