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 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 __version__ = "$Rev$" 23 2426 """ Get the preferred 'standard' sample rate not exceeded maxrate""" 27 rates = [192000, 96000, 48000, 44100, 32000, 34000, 22050, 16000, 12000, 28 11025, 8000] 29 30 for rate in rates: 31 if rate <= maxrate: 32 return rate 33 34 return 800035 3638 # maybe better in a hashtable/associative array? 39 # ZAHEER: these really are "magic" limits that i found by trial and 40 # error used 41 # by libvorbis's encoder to determine what maximum samplerate it 42 # accepts for a bitrate, numchannels combo 43 # THOMAS: strangely enough they don't seem to be easily extractable from 44 # vorbis/lib/modes/setup_*.h 45 # might make sense to figure this out once and for all and verify 46 # GStreamer's behaviour as well 47 if channels == 2: 48 if bitrate >= 45000: 49 retval = 50000 50 elif bitrate >= 40000: 51 retval = 40000 52 elif bitrate >= 30000: 53 retval = 26000 54 elif bitrate >= 24000: 55 retval = 19000 56 elif bitrate >= 16000: 57 retval = 15000 58 elif bitrate >= 12000: 59 retval = 9000 60 else: 61 retval = -1 62 63 elif channels == 1: 64 if bitrate >= 32000: 65 retval = 50000 66 elif bitrate >= 24000: 67 retval = 40000 68 elif bitrate >= 16000: 69 retval = 26000 70 elif bitrate >= 12000: 71 retval = 15000 72 elif bitrate >= 8000: 73 retval = 9000 74 else: 75 retval = -1 76 77 return retval78
Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Fri Apr 29 18:56:34 2011 | http://epydoc.sourceforge.net |