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