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,2009 Fluendo, S.L. 6 # Copyright (C) 2010,2011 Flumotion Services, S.A. 7 # All rights reserved. 8 # 9 # This file may be distributed and/or modified under the terms of 10 # the GNU Lesser General Public License version 2.1 as published by 11 # the Free Software Foundation. 12 # This file is distributed without any warranty; without even the implied 13 # warranty of merchantability or fitness for a particular purpose. 14 # See "LICENSE.LGPL" in the source distribution for more information. 15 # 16 # Headers in this file shall remain intact. 17 18 import gettext 19 import os 20 21 from zope.interface import implements 22 23 from flumotion.admin.assistant.interfaces import IEncoderPlugin 24 from flumotion.admin.assistant.models import VideoEncoder 25 from flumotion.common.fraction import fractionAsFloat 26 from flumotion.admin.gtk.basesteps import VideoEncoderStep 27 28 __version__ = "$Rev$" 29 _ = gettext.gettext 30 3133 """ 34 @ivar framerate: number of frames per second; to be set by view 35 @type framerate: float 36 """ 37 componentType = 'vp8-encoder' 3868 6940 super(VP8VideoEncoder, self).__init__() 41 self.has_quality = False 42 self.has_bitrate = True 43 self.framerate = 25.0 44 45 self.properties.keyframe_delta = 2.0 46 self.properties.bitrate = 400 47 self.properties.quality = 164850 properties = super(VP8VideoEncoder, self).getProperties() 51 if self.has_bitrate: 52 del properties.quality 53 properties.bitrate *= 1000 54 elif self.has_quality: 55 del properties.bitrate 56 else: 57 raise AssertionError 58 59 # convert the human-friendly delta to maxdistance 60 properties.keyframe_maxdistance = int(properties.keyframe_delta * 61 self.framerate) 62 del properties.keyframe_delta 63 64 self.debug('keyframe_maxdistance: %r', 65 properties.keyframe_maxdistance) 66 67 return properties71 name = 'VP8Encoder' 72 title = _('VP8 Encoder') 73 sidebarName = _('VP8') 74 gladeFile = os.path.join(os.path.dirname(os.path.abspath(__file__)), 75 'wizard.glade') 76 componentType = 'vp8' 77 docSection = 'help-configuration-assistant-encoder-vp8' 78 docAnchor = '' 79 docVersion = 'local' 80 81 # WizardStep 82119 120 13084 self.bitrate.data_type = int 85 self.quality.data_type = int 86 self.keyframe_delta.data_type = float 87 self.has_quality.data_type = bool 88 self.has_bitrate.data_type = bool 89 90 self.add_proxy(self.model, 91 ['has_quality', 'has_bitrate']) 92 self.add_proxy(self.model.properties, 93 ['bitrate', 'quality', 'keyframe_delta']) 94 95 # we specify keyframe_delta in seconds, but vp8 expects 96 # a number of frames, so we need the framerate and calculate 97 # we need to go through the Step (which is the view) because models 98 # don't have references to other models 99 producer = self.wizard.getScenario().getVideoProducer(self.wizard) 100 self.model.framerate = fractionAsFloat(producer.getFramerate()) 101 self.debug('Framerate of video producer: %r' % self.model.framerate) 102 step = 1 / self.model.framerate 103 page = 1.0 104 self.keyframe_delta.set_increments(step, page)105 109 110 # Callbacks 111
Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Tue Aug 13 06:17:25 2013 | http://epydoc.sourceforge.net |