1 # dc-videowidget.tcl --
2 #
3 # A subclass of VideoWidget, customized for the special situation
4 # in DC where the data-handler of a source is not a decoder, but
5 # is a splitter.
6 #
7 # Copyright (c) 2000-2002 The Regents of the University of California.
8 # All rights reserved.
9 #
10 # Redistribution and use in source and binary forms, with or without
11 # modification, are permitted provided that the following conditions are met:
12 #
13 # A. Redistributions of source code must retain the above copyright notice,
14 # this list of conditions and the following disclaimer.
15 # B. Redistributions in binary form must reproduce the above copyright notice,
16 # this list of conditions and the following disclaimer in the documentation
17 # and/or other materials provided with the distribution.
18 # C. Neither the names of the copyright holders nor the names of its
19 # contributors may be used to endorse or promote products derived from this
20 # software without specific prior written permission.
21 #
22 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
23 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 # ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
26 # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
33 import VideoWidget
34 Class DcVideoWidget -superclass VideoWidget
35
36 #-
37 # Method:
38 # DcVideoWidget detach-decoder
39 # Description:
40 # This override the detach-decoder in VideoWidget. The main difference
41 # is how we obtain the decoder. Here we access the "decoder_" member
42 # directly instead of calling [$src data-handler].
43 #-
44 DcVideoWidget instproc detach-decoder {src} {
45 $self instvar target_
46 set d [$src set decoder_]
47 if {$target_ != ""} {
48 $d detach $target_
49 delete $target_
50 unset target_
51 }
52 }
53
54
55 #-
56 # Method:
57 # DcVideoWidget attach-decoder
58 # Description:
59 # This override the attach-decoder in VideoWidget. The main difference
60 # is how we obtain the decoder. Here we access the "decoder_" member
61 # directly, instead of calling [$src data-handler].
62 #-
63 DcVideoWidget instproc attach-decoder { src colorModel useHW {useHeuristics 0} } {
64 set d [$src set decoder_]
65 if {$d==""} {
66 global src_nickname
67 if ![info exists src_nickname($src)] {
68 set name [$src sdes cname]
69 } else {
70 set name $src_nickname($src)
71 }
72 puts stderr "can't attach-decoder: no handler for src $name;\
73 format is [$src format_name]"
74 return
75 }
76 $self instvar window_ target_ is_slow_
77 set target_ ""
78 if { $useHW } {
79 set fmt [$src format_name]
80 if { $fmt == "jpeg" } {
81 set fmt $fmt/[$d csss]
82 }
83 if ![catch "new assistor/$fmt" v] {
84 set target_ $v
85 $target_ window $window_
86 }
87 }
88 if { $target_ == "" } {
89 set target_ [$colorModel alloc-renderer $window_ [$d csss] $useHeuristics]
90 }
91 if $is_slow_ {
92 $target_ update-interval [$self get_option stampInterval]
93 }
94 $window_ adjust-voff $d
95 $d attach $target_
96 }
97
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.