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

Open Mash Cross Reference
mash/tcl/dc/dc/ui-dcthumbnailvideo.tcl

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

  1 # ui-dcthumbnailvideo.tcl --
  2 #
  3 #       Stuff for starting video decoding for thumbnail and drag/drop
  4 #
  5 # Copyright (c) 2000-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 import DcVideoWidget
 32 import CDcUIThumbnail
 33 
 34 Class CDcUIThumbnail/Video -superclass CDcUIThumbnail
 35 
 36 CDcUIThumbnail/Video public init { appDc uiMain winFrame } {
 37     $self next $appDc $uiMain $winFrame
 38 
 39     $self instvar m_source
 40     $self instvar m_service
 41     $self instvar m_iSourceId
 42     $self instvar m_dragNDrop
 43 
 44     # intialize some variables
 45     set m_source 0
 46     set m_service 0
 47     set m_iSourceId "not a number"
 48     set m_dragNDrop 0
 49 }
 50 
 51 
 52 CDcUIThumbnail/Video public destroy { } {
 53     $self next 
 54 }
 55 
 56 
 57 CDcUIThumbnail/Video public StartService { service } {
 58     $self instvar m_service
 59 
 60     # store away the service
 61     set m_service $service
 62 }
 63 
 64 CDcUIThumbnail/Video public StartVideo { src } {
 65     $self instvar m_winFrame
 66     $self instvar m_uiMain
 67     $self instvar m_dragNDrop
 68     $self instvar m_source
 69     $self instvar m_iSourceId
 70 
 71     set m_source $src
 72     set m_iSourceId [$src srcid]
 73 
 74     # create the frame for the thumbnail
 75     expr srand($m_iSourceId)
 76     set r [expr int(rand() * 4096)]
 77     set g [expr int(rand() * 4096)]
 78     set b [expr int(rand() * 4096)]
 79     set color [format "#%03x%03x%03x" $r $g $b]
 80 
 81     frame $m_winFrame.thumb -relief raised -borderwidth 3 -background $color
 82     pack $m_winFrame.thumb -side top
 83 
 84     # create the new thumbnail window
 85     $self instvar m_vwThumbnail
 86 
 87     set m_vwThumbnail [new DcVideoWidget $m_winFrame.thumb.video 80 60]
 88 
 89     $m_vwThumbnail set is_slow_ 1
 90     pack $m_winFrame.thumb.video -side top -fill both -expand 1
 91 
 92     # attach it to the source
 93     $m_vwThumbnail attach-decoder $m_source [$m_uiMain set m_ColorModel] 0
 94 
 95     # create and deal with the drag n drop object
 96     set m_dragNDrop [new DragNDrop $m_winFrame.thumb.video \
 97             "$self DropThumbnail"]
 98 
 99     # now create the source id text
100     label $m_winFrame.thumb.title -text $m_iSourceId
101     pack $m_winFrame.thumb.title -side top -fill x
102 }
103 
104 
105 CDcUIThumbnail/Video public StopVideo { } {
106     $self instvar m_vwThumbnail
107     $self instvar m_dragNDrop
108     $self instvar m_source
109 
110     $m_vwThumbnail detach-decoder $m_source
111     delete $m_vwThumbnail 
112     delete $m_dragNDrop
113 }
114 
115 
116 CDcUIThumbnail/Video public GetVideoWidget { } {
117     $self instvar m_vwThumbnail
118     return $m_vwThumbnail 
119 }
120 
121 CDcUIThumbnail/Video public DropThumbnail { dragNDrop x y } {
122     $self instvar m_uiMain
123 
124     #first get the preview frame
125     set uiPreviewFrame [$m_uiMain set m_uiPreviewFrame]
126     set uiBroadcastFrame [$m_uiMain set m_uiBroadcastFrame]
127 
128     # first test if it was meant for preview window
129     if { [$uiPreviewFrame DropThumbnail $dragNDrop $self $x $y] } {
130         return
131     }
132 
133     # then it might be fore the broadcast window
134     if { [$uiBroadcastFrame DropThumbnail $dragNDrop $self $x $y] } {
135         return
136     }
137 
138     # otherwise just zoom back to the original position
139     $dragNDrop zoom_back
140 
141 }
142 
143 #
144 # Returns the Source/RTP object associated with this thumbnail video.
145 CDcUIThumbnail/Video public GetSource { } {
146     $self instvar m_source
147     return $m_source
148 }
149 

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