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

Open Mash Cross Reference
mash/tcl/archive/recorder/rtp-record-agent.tcl

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

  1 # rtp-record-agent.tcl --
  2 #
  3 #       FIXME: This file needs a description here.
  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 
 32 import RTPAgent RTPApplication/Recorder
 33 
 34 Module/RTPRecord instproc init {} {
 35         set nb_ 0
 36         $self next
 37 }
 38 
 39 
 40 # Used to record RTP packets.  We inherit from RTPAgent so that when a
 41 # new source is discovered, the activate call does the right stuff for
 42 # the recorder.
 43 # Status: Beta
 44 # Author: Angela Schuett
 45 
 46 Class RTPRecordAgent -superclass RTPAgent
 47 
 48 
 49 RTPRecordAgent instproc init { session addr } {
 50         $self instvar Media_ archive_session_
 51         set archive_session_ $session
 52         set media [$session media]
 53         set Media_ [string toupper [string index $media 0]][string range \
 54                         $media 1 end]
 55         set app [new RTPApplication/Recorder $media]
 56         set ab [new AddressBlock $addr]
 57         eval $self next $ab
 58 }
 59 
 60 RTPRecordAgent instproc destroy {} {
 61         $self instvar streams_
 62         if [info exists streams_] {
 63                 foreach strm $streams_ {
 64                         delete $strm
 65                 }
 66         }
 67         $self next
 68 }
 69 
 70 
 71 
 72 # Override RTP agent's default method.
 73 # Called from C++ (through Source/RTP) when we start
 74 # actively receiving data pkts from the given source.
 75 
 76 
 77 RTPRecordAgent instproc activate src {
 78         $self instvar archive_session_ streams_
 79         set stream [new ArchiveStream/Record/RTP $archive_session_]
 80         set error [$stream bind $archive_session_]
 81         if { $error != "" } {
 82             #FIXME attach  a null sink
 83             $src data-handler [new Module/VideoDecoder/Null]
 84             $src ctrl-handler ""
 85             $self notify_observers archive_error $error
 86             #FIXME
 87             puts $error
 88             exit 1
 89             return
 90         }
 91         $stream write_headers
 92         set rcvr [new Module/RTPRecord]
 93         set crcvr [new Module/RTPRecordCtrl]
 94         $stream attach $rcvr $crcvr
 95         $stream source $src
 96         $rcvr attach $stream
 97         $crcvr attach $stream
 98         $src data-handler $rcvr
 99         $src ctrl-handler $crcvr
100 
101         lappend streams_ $stream
102 
103         $self next $src
104 }
105 
106 RTPRecordAgent instproc deactivate src {
107         # Close file??
108         # Write data into catalog file??
109         #puts "deactivate"
110         $self next $src
111 }
112 
113 
114 # create-session called from RTPAgent
115 RTPRecordAgent instproc create_session {} {
116         $self instvar Media_
117         set session [new Session/RTP/${Media_}]
118         if { $session == "" } {
119                 $self fatal "creation of Session/RTP/${Media_} failed"
120                 exit 1
121         }
122 
123         return $session
124 }
125 
126 
127 ArchiveStream/Record/RTP instproc init { session } {
128         $self instvar archive_session_
129         set archive_session_ $session
130 
131         $self next $session
132         $self init_file_header
133 }
134 

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