Trees | Indices | Help |
---|
|
1 # -*- Mode: Python; test-case-name:flumotion.test.test_soundcard -*- 2 # vi:si:et:sw=4:sts=4:ts=4 3 # 4 # Flumotion - a streaming media server 5 # Copyright (C) 2004,2005,2006,2007 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 import gst 23 import gst.interfaces 24 25 from twisted.internet import defer 26 27 from flumotion.component import feedcomponent 28 from flumotion.component.effects.volume import volume 29 308533 self.debug('running PyGTK/PyGST checks') 34 from flumotion.component.producers import checks 35 d1 = checks.checkTicket347() 36 d2 = checks.checkTicket348() 37 dl = defer.DeferredList([d1, d2]) 38 dl.addCallback(self._checkCallback) 39 return dl40 4547 element = properties.get('source-element', 'alsasrc') 48 device = properties.get('device', 'hw:0') 49 rate = properties.get('rate', 44100) 50 depth = properties.get('depth', 16) 51 channels = properties.get('channels', 2) 52 53 # FIXME: why do we not connect to state_changed_cb so correct 54 # soundcard input is used? 55 56 # FIXME: we should find a way to figure out what the card supports, 57 # so we can add in correct elements on the fly 58 # just adding audioscale and audioconvert always makes the soundcard 59 # open in 1000 Hz, mono 60 caps = 'audio/x-raw-int,rate=(int)%d,depth=%d,channels=%d' % ( 61 rate, depth, channels) 62 pipeline = '%s device=%s ! %s ! level name=volumelevel message=true' % ( 63 element, device, caps) 64 65 return pipeline6668 # add volume effect 69 comp_level = pipeline.get_by_name('volumelevel') 70 vol = volume.Volume('inputVolume', comp_level, pipeline) 71 self.addEffect(vol)7274 if old == gst.STATE_NULL and new == gst.STATE_READY: 75 for track in element.list_tracks(): 76 element.set_record(track, track.label == trackLabel)7779 self.debug("Volume set to: %d" % (value)) 80 self.warning("FIXME: soundcard.setVolume not implemented yet")81
Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Fri Apr 11 07:40:32 2008 | http://epydoc.sourceforge.net |