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

Open Mash Cross Reference
mash/tcl/indiva/services/ive/ive-service.tcl

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

  1 # ive-service.tcl --
  2 #
  3 #   Service API for Indiva Video Encoder
  4 #
  5 # Copyright (c) 1996-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 # @(#) $Header: /usr/mash/src/repository/mash/mash-1/tcl/indiva/services/ive/ive-service.tcl,v 1.6 2004/02/16 18:23:45 weitsang Exp $
 32 
 33 import IndivaService
 34 Class IVEService -superclass IndivaService
 35 
 36 IVEService instproc init {agent manager} {
 37     $self next
 38 
 39     $self set pipeline_ [$agent set pipeline_]
 40     $self set agent_ $agent
 41     $self set manager_ $manager
 42     $self set split_ 0
 43 }
 44 
 45 
 46 IVEService instproc gui {parent} {
 47     $self instvar pipeline_ agent_
 48     set f $parent.ive
 49     set layout "
 50         frame $f
 51 
 52         label $f.fpsl -text {Frame Rate} -anchor e
 53         scale $f.fpss -from 1 -to 30 -orient horiz
 54         $f.fpss set [$pipeline_ set_fps]
 55         pack $f.fpsl $f.fpss -side left -fill x
 56         grid $f.fpsl -column 0 -row 0 -sticky news
 57         grid $f.fpss -column 1 -row 0 -sticky news
 58 
 59         label $f.bpsl -text {Bit Rate (kbps)} -anchor e
 60         scale $f.bpss -from 1 -to 1280 -orient horiz
 61         $f.bpss set [$pipeline_ set_kbps]
 62         pack $f.bpsl $f.bpss -side left -fill x
 63         grid $f.bpsl -column 0 -row 1 -sticky news
 64         grid $f.bpss -column 1 -row 1 -sticky news
 65 
 66         label $f.ql -text {Quality} -anchor e
 67         scale $f.qs -from 1 -to 100 -orient horiz
 68         $f.qs set [$pipeline_ set quality_]
 69         pack $f.ql $f.qs -side left -fill x
 70         grid $f.ql -column 0 -row 2 -sticky news
 71         grid $f.qs -column 1 -row 2 -sticky news
 72 
 73         global fmt${parent}
 74         label $f.fmtl -text {Format} -anchor e
 75         tk_optionMenu $f.fmtm fmt${parent} h261 jpeg
 76         pack $f.fmtm $f.fmtl
 77         grid $f.fmtl -column 0 -row 3 -sticky news
 78         grid $f.fmtm -column 1 -row 3 -sticky news
 79 
 80         global ttl${parent}
 81         label $f.ttl -text {Subtitle} -anchor e
 82         entry $f.tte -textvariable ttl${parent}
 83         button $f.ttb -text set
 84         pack $f.ttl $f.tte $f.ttb
 85         grid $f.ttl -column 0 -row 4 -sticky news
 86         grid $f.tte -column 1 -row 4 -sticky news
 87         grid $f.ttb -column 2 -row 4 -sticky news
 88 
 89         pack $f -fill x -expand 1
 90     "
 91     lappend commands widget $f.fpss "$pipeline_ set_fps"
 92     lappend commands widget $f.bpss "$pipeline_ set_kbps"
 93     lappend commands widget $f.qs "$pipeline_ set_quality"
 94     lappend commands widget $f.ttb "$agent_ title set \$\{ttl${parent}\} 24 Arial" 
 95     lappend commands variable fmt${parent} "$pipeline_ set_fmt \$\{fmt${parent}\}"
 96 
 97     return [list $layout $commands]
 98 }
 99 
100 IVEService instproc start {args} {
101     # Check for validity
102     if {[llength $args] != 6} {
103         error "calling $class $proc with wrong number of args. Pls check you code"
104     }
105     $self instvar pipeline_ agent_
106     set dest [lindex $args 0]
107     set fmt  [lindex $args 1]
108     set norm [lindex $args 2]
109     set q    [lindex $args 3]
110     set fps  [lindex $args 4]
111     set bps  [lindex $args 5]
112 
113     $agent_ reset_spec $dest
114     $pipeline_ select [$pipeline_ set device_] $fmt
115     $pipeline_ set_norm $norm
116     $pipeline_ set_quality $q
117     $pipeline_ set_fps $fps
118     $pipeline_ set_bps $bps
119     $pipeline_ start
120 
121     $self instvar manager_
122     if {$manager_ != ""} {
123         set cname [$agent_ get_local_sdes cname]
124         set ssrc  [format "%08x" [$agent_ get_local_srcid]]
125         return [list $cname $ssrc]
126     }
127 }
128 
129 IVEService instproc split {args} {
130     # Check for validity
131     $self instvar agent_ split_ dest_
132     set dest_ [lindex $args 0]
133     $agent_ add_destination $dest_
134     set split_ 1
135 
136     $self instvar manager_
137     if {$manager_ != ""} {
138         set cname [$agent_ get_local_sdes cname]
139         set ssrc  [format "%08x" [$agent_ get_local_srcid]]
140         return [list $cname $ssrc]
141     }
142 }
143 
144 IVEService instproc stop {args} {
145     # Check for validity
146     $self instvar agent_ split_ dest_ pipeline_
147     if {$split_ == 1} {
148         $agent_ delete_destination $dest_
149     } else {
150         delete $pipeline_ 
151         $agent_ shutdown
152     }
153 }
154 
155 
156 IVEService instproc friendlyname {} {
157     return "Video Encoder"
158 }
159 
160 IVEService instproc configure {args} {
161     $self instvar agent_ pipeline_
162     foreach {key value} $args {
163         switch -exact -- $key {
164             -dest {
165                 $agent_ reset_spec $value
166             }
167         }
168     }
169 }
170 
171 #           -testfile {
172 #               $pipeline_ hardware set-file $value
173 #           }
174 #           -testpassion {
175 #               $pipeline_ hardware set-greenpassion
176 #           }
177 

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