Trees | Indices | Help |
---|
|
1 # -*- Mode: Python -*- 2 # vi:si:et:sw=4:sts=4:ts=4 3 # 4 # Flumotion - a streaming media server 5 # Copyright (C) 2004,2005,2006,2007,2008 Fluendo, S.L. (www.fluendo.com). 6 # All rights reserved. 7 8 # This file may be distributed and/or modified under the terms of 9 # the GNU General Public License version 2 as published by 10 # the Free Software Foundation. 11 # This file is distributed without any warranty; without even the implied 12 # warranty of merchantability or fitness for a particular purpose. 13 # See "LICENSE.GPL" in the source distribution for more information. 14 15 # Licensees having purchased or holding a valid Flumotion Advanced 16 # Streaming Server license may use this file in accordance with the 17 # Flumotion Advanced Streaming Server Commercial License Agreement. 18 # See "LICENSE.Flumotion" in the source distribution for more information. 19 20 # Headers in this file shall remain intact. 21 22 """Wizard plugin for the html5 http plug 23 """ 24 25 import gettext 26 from zope.interface import implements 27 28 from flumotion.admin.assistant.interfaces import IHTTPConsumerPlugin, \ 29 IHTTPConsumerPluginLine 30 from flumotion.admin.assistant.models import HTTPServer, HTTPPlug, Muxer, \ 31 Encoder 32 from flumotion.ui.plugarea import WizardPlugLine 33 34 _ = gettext.gettext 35 36 __version__ = "$Rev$" 37 38 # Copied from posixpath.py 39 4042 """Join two or more pathname components, inserting '/' as needed""" 43 path = a 44 for b in p: 45 if b.startswith('/'): 46 path = b 47 elif path == '' or path.endswith('/'): 48 path += b 49 else: 50 path += '/' + b 51 return path52 5355 """I am a model representing the configuration file for a 56 HTML5 HTTP streaming plug. 57 """ 58 plugType = "component-html5" 59 60 # Component 61105 10663 p = super(Html5HTTPPlug, self).getProperties() 64 #TODO: find the encoders and muxer and pass in to the Html5HTTPPlug 65 # find muxer 66 muxer = self.streamer 67 while not isinstance(muxer, Muxer): 68 muxer = muxer.eaters[0] 69 70 p.codecs = "" 71 p.mime_type = "" 72 if muxer.componentType == "ogg-muxer": 73 p.mime_type = "video/ogg" 74 elif muxer.componentType == "webm-muxer": 75 p.mime_type = "video/webm" 76 # now find the encoders 77 for eater in muxer.eaters: 78 encoder = eater 79 codec = "" 80 while not isinstance(encoder, Encoder): 81 encoder = encoder.eaters[0] 82 if encoder.componentType == "theora-encoder": 83 codec = "theora" 84 elif encoder.componentType == "vorbis-encoder": 85 codec = "vorbis" 86 elif encoder.componentType == "vp8-encoder": 87 codec = "vp8" 88 if p.codecs: 89 p.codecs = "%s,%s" % (p.codecs, codec) 90 else: 91 p.codecs = codec 92 93 p.stream_url = self.streamer.getURL() 94 95 width = 320 96 height = 240 97 if self.videoProducer: 98 width = self.videoProducer.properties.width 99 height = self.videoProducer.properties.height 100 101 p.width = width 102 p.height = height 103 104 return p108 """I am a model representing the configuration file for a 109 HTTP server component which will be used to serve an html5 110 video watching page. 111 Most of the interesting logic here is actually in a plug. 112 """ 113 componentType = 'http-server' 114147 148116 """ 117 @param streamer: streamer 118 @type streamer: L{HTTPStreamer} 119 @param audioProducer: audio producer 120 @type audioProducer: L{flumotion.admin.assistant.models.AudioProducer} 121 subclass or None 122 @param videoProducer: video producer 123 @type videoProducer: L{flumotion.admin.assistant.models.VideoProducer} 124 subclass or None 125 @param mountPoint: 126 @type mountPoint: 127 """ 128 self.streamer = streamer 129 super(Html5HTTPServer, self).__init__(mountPoint=mountPoint, 130 worker=streamer.worker) 131 132 porter = streamer.getPorter() 133 self.properties.porter_socket_path = porter.getSocketPath() 134 self.properties.porter_username = porter.getUsername() 135 self.properties.porter_password = porter.getPassword() 136 self.properties.port = porter.getPort() 137 self.properties.type = 'slave' 138 plug = Html5HTTPPlug(self, streamer, audioProducer, videoProducer) 139 self.addPlug(plug)140142 properties = super(Html5HTTPServer, self).getProperties() 143 hostname = self.streamer.getHostname() 144 if hostname: 145 properties.hostname = hostname 146 return properties150 implements(IHTTPConsumerPluginLine) 151 gladeFile = '' 152 156 159164 165 174161 mountPoint = slashjoin(streamer.properties.mount_point, "html5/") 162 return Html5HTTPServer(streamer, audioProducer, 163 videoProducer, mountPoint)
Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Fri Apr 29 19:10:59 2011 | http://epydoc.sourceforge.net |