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

Open Mash Cross Reference
mash/tcl/vic/cf-tm.tcl

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

  1 # cf-tm.tcl --
  2 #
  3 #       FIXME: This file needs a description here.
  4 #
  5 # Copyright (c) 1995-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 
 32 #
 33 # Handle commands that come over conference bus for manipulating
 34 # overlaid images (e.g., from a title generator).
 35 #
 36 
 37 Class Titler
 38 Class Titler/420 -superclass {Titler Module/Compositor/420}
 39 Class Titler/422 -superclass {Titler Module/Compositor/422}
 40 
 41 Titler proc insert grabber {
 42         Titler instvar enable_ grabber_ tm_
 43         if ![info exists enable_] {
 44                 return 0
 45         }
 46         if [info exists tm_] {
 47                 delete $tm_
 48                 unset tm_
 49         }
 50         set target [$grabber target]
 51         set ff [$target frame-format]
 52         if { $ff == "cif" } {
 53                 set ff 420
 54         }
 55         if { $ff == "420" || $ff == "422" } {
 56                 set tm_ [new Titler/$ff]
 57                 $tm target $encoder
 58                 $grabber target $tm
 59                 set grabber_ $grabber
 60                 return 1
 61         } else {
 62                 return 0
 63         }
 64 }
 65 
 66 Titler proc enable {} {
 67         Titler instvar enable_ grabber_
 68         set enable_ 1
 69         if [info exists grabber_] {
 70                 Titler insert $grabber_
 71         }
 72 }
 73 
 74 Titler proc disable {} {
 75         Titler instvar enable_ grabber_ tm_
 76         catch "unset enable_"
 77         if [info exists grabber_] {
 78                 # remove the title-maker from the path
 79                 # FIXME this assumes the title-maker is the first
 80                 # intervening modules
 81                 $grabber_ target [$tm_ target]
 82                 delete $tm_
 83                 unset tm_
 84         }
 85 }
 86 
 87 Titler instproc check id {
 88         $self instvar obj_
 89         return [info exists obj_($id)]
 90 }
 91 
 92 Titler instproc create_obj { id file width height } {
 93 puts define/$id/$file/$width/$height
 94         $self instvar obj_
 95         if [$self check $id] {
 96                 $self destroy_obj $id
 97         }
 98         set obj_($id) [new overlay]
 99         #FIXME check for error
100         $obj_($id) load $file $width $height
101 }
102 
103 Titler instproc transparent { id lum } {
104 puts transparent:$id/$lum
105         $self instvar obj_
106         if [$self check $id] {
107                 $obj_($id) transparent $lum
108         }
109 }
110 
111 Titler instproc destroy_obj id {
112         $self instvar obj_
113         if [$self check $id] {
114                 set o $obj_($id)
115                 unset obj_($id)
116                 $self detach $o
117                 delete $o
118         }
119 }
120 
121 Titler instproc place { id x y depth } {
122         $self instvar obj_
123         if [$self check $id] {
124                 set o $obj_($id)
125                 if { ![info exists depth_($o)] } {
126                         set depth_($o) $depth
127                         $self attach $o $x $y $depth
128                 } elseif { $depth_($o) != $depth } {
129                         set depth_($o) $depth
130                         $self detach $o
131                         $self attach $o $x $y $depth
132                 } else {
133                         $self move $o $x $y
134                 }
135         }
136 }
137 
138 Titler instproc remove id {
139         if [$self check $id] {
140                 $self instvar obj_
141                 set o $obj_($id)
142                 unset obj_($id)
143                 $self detach $o
144                 delete $o
145         }
146 }
147 
148 #
149 #FIXME this is broken: easiest to wait for cleaner coodbus API
150 # initialize the dispatch table with the title-maker API
151 #
152 foreach proc { tm_enable tm_disable tm_define tm_destroy \
153         tm_place tm_remove tm_transparent } {
154         set cb_dispatch($proc) $proc
155 }
156 

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