Package flumotion :: Package component :: Package encoders :: Package smoke :: Module wizard_gtk
[hide private]

Source Code for Module flumotion.component.encoders.smoke.wizard_gtk

 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.admin.gtk.basesteps import VideoEncoderStep 
26  from flumotion.common.fraction import fractionAsFloat 
27   
28  __version__ = "$Rev$" 
29  _ = gettext.gettext 
30   
31   
32 -class SmokeVideoEncoder(VideoEncoder):
33 componentType = 'smoke-encoder' 34
35 - def __init__(self):
36 super(SmokeVideoEncoder, self).__init__() 37 self.framerate = 25.0 38 self.keyframe_interval = 2.0 39 40 self.properties.qmin = 10 41 self.properties.qmax = 85 42 self.properties.threshold = 3000
43
44 - def getProperties(self):
45 properties = super(SmokeVideoEncoder, self).getProperties() 46 47 properties.keyframe = int(self.framerate * self.keyframe_interval) 48 49 return properties
50 51
52 -class SmokeStep(VideoEncoderStep):
53 name = 'SmokeEncoder' 54 title = _('Smoke Encoder') 55 sidebarName = _('Smoke') 56 section = _('Conversion') 57 gladeFile = os.path.join(os.path.dirname(os.path.abspath(__file__)), 58 'wizard.glade') 59 componentType = 'smoke' 60 docSection = 'help-configuration-assistant-encoder-smoke' 61 docAnchor = '' 62 docVersion = 'local' 63 64 # WizardStep 65
66 - def setup(self):
67 self.qmin.data_type = int 68 self.qmax.data_type = int 69 self.threshold.data_type = int 70 self.keyframe_interval.data_type = float 71 72 producer = self.wizard.getScenario().getVideoProducer(self.wizard) 73 self.model.framerate = fractionAsFloat(producer.getFramerate()) 74 self.model.keyframe_interval = 20 / self.model.framerate 75 76 self.add_proxy(self.model.properties, 77 ['qmin', 'qmax', 'threshold']) 78 self.add_proxy(self.model, ['keyframe_interval']) 79 80 step = 1 / self.model.framerate 81 page = 1.0 82 self.keyframe_interval.set_increments(step, page)
83
84 - def workerChanged(self, worker):
85 self.model.worker = worker 86 self.wizard.requireElements(worker, 'smokeenc')
87 88
89 -class SmokeWizardPlugin(object):
90 implements(IEncoderPlugin) 91
92 - def __init__(self, wizard):
93 self.wizard = wizard 94 self.model = SmokeVideoEncoder()
95
96 - def getConversionStep(self):
97 return SmokeStep(self.wizard, self.model)
98