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