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

Open Mash Cross Reference
mash/tcl/dc/dc/agent-broadcast.tcl

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

  1 # agent-broadcast.tcl --
  2 #
  3 #       Derived from VideoAgent, responsible for broadcasting onto MBone the
  4 #       director selected streams.
  5 #
  6 # Copyright (c) 2000-2002 The Regents of the University of California.
  7 # All rights reserved.
  8 #
  9 # Redistribution and use in source and binary forms, with or without
 10 # modification, are permitted provided that the following conditions are met:
 11 #
 12 # A. Redistributions of source code must retain the above copyright notice,
 13 #    this list of conditions and the following disclaimer.
 14 # B. Redistributions in binary form must reproduce the above copyright notice,
 15 #    this list of conditions and the following disclaimer in the documentation
 16 #    and/or other materials provided with the distribution.
 17 # C. Neither the names of the copyright holders nor the names of its
 18 #    contributors may be used to endorse or promote products derived from this
 19 #    software without specific prior written permission.
 20 #
 21 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
 22 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 23 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 24 # ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
 25 # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 26 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 27 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 28 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 29 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 30 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 31 
 32 import VideoAgent
 33 
 34 #-----------------------------------------------------------------------------
 35 # Class:
 36 #   DcBroadcastAgent
 37 #
 38 # Description:
 39 #   Derived from VideoAgent.  DcBroadcastAgent takes video packets from
 40 #   the Studio session, pass it through a switcher, and send it out to
 41 #   out to a broadcast session.  
 42 #
 43 # Members:
 44 #   switcher_ -- the Module/RTPSwitcher object.
 45 #-----------------------------------------------------------------------------
 46 Class DcBroadcastAgent -superclass VideoAgent
 47 DcBroadcastAgent set src_counter_ 0
 48 
 49 
 50 #-----------------------------------------------------------------------------
 51 # Method:
 52 #   DcBroadcastAgent init
 53 #
 54 # Description:
 55 #   Create a new switcher and set the target of the switcher to 
 56 #   the transmitter.
 57 #
 58 # Arguments:
 59 #   app -- the Module/RTPSwitcher object.
 60 #   addr,port,ttl -- the IP address, port number and TTL of the output 
 61 #                    session.
 62 #-----------------------------------------------------------------------------
 63 DcBroadcastAgent instproc init { app addr port ttl} {
 64     $self next $app "$addr/$port:$port//$ttl"
 65 
 66     $self instvar switcher_
 67 
 68     set switcher_ [new Module/RTPSwitcher]
 69 
 70     # set the local transmitter as the transmitter for this object
 71     $switcher_ target [$self get_transmitter]
 72 }
 73 
 74 
 75 #-----------------------------------------------------------------------------
 76 # Method:
 77 #   DcBroadcastAgent get_switcher
 78 #
 79 # Description:
 80 #   Return the switcher object.
 81 #-----------------------------------------------------------------------------
 82 DcBroadcastAgent public get_switcher { } {
 83     return [$self set switcher_]
 84 }
 85 
 86 
 87 #-----------------------------------------------------------------------------
 88 # Method:
 89 #   DcBroadcastAgent map_source
 90 #
 91 # Description:
 92 #   Ask the switcher to edit packet source to $osrcid everytime it sees
 93 #   a packet with srcid $isrcid.  If $osrcid is empty, then it is set to
 94 #   a generated srcid.
 95 #-----------------------------------------------------------------------------
 96 DcBroadcastAgent public map_source { isrcid { osrcid "" } } {
 97     $self instvar switcher_
 98     DcBroadcastAgent instvar src_counter_
 99 
100     if { $osrcid == "" } {
101         set osrcid [expr [$self get_local_srcid] + $src_counter_]
102         incr src_counter_
103     }
104     $switcher_ MapSource $isrcid $osrcid
105 
106     return $osrcid
107 }
108 
109 
110 #-----------------------------------------------------------------------------
111 # Method:
112 #   DcBroadcastAgent unmap_source
113 #
114 # Description:
115 #   Ask the switcher to forget about the mapping set by map_source.  If
116 #   no such mapping exists, switcher ignores the request.
117 #-----------------------------------------------------------------------------
118 DcBroadcastAgent public unmap_source { isrcid osrcid } {
119     $self instvar switcher_
120     $switcher_ UnmapSource $isrcid $osrcid
121 }
122 
123 

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