1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "media/audio/sample_rates.h" 6 7 #include "base/logging.h" 8 9 namespace media { 10 11 bool ToAudioSampleRate(int sample_rate, AudioSampleRate* asr) { 12 DCHECK(asr); 13 switch (sample_rate) { 14 case 8000: 15 *asr = k8000Hz; 16 return true; 17 case 16000: 18 *asr = k16000Hz; 19 return true; 20 case 32000: 21 *asr = k32000Hz; 22 return true; 23 case 48000: 24 *asr = k48000Hz; 25 return true; 26 case 96000: 27 *asr = k96000Hz; 28 return true; 29 case 11025: 30 *asr = k11025Hz; 31 return true; 32 case 22050: 33 *asr = k22050Hz; 34 return true; 35 case 44100: 36 *asr = k44100Hz; 37 return true; 38 case 88200: 39 *asr = k88200Hz; 40 return true; 41 case 176400: 42 *asr = k176400Hz; 43 return true; 44 case 192000: 45 *asr = k192000Hz; 46 return true; 47 case 24000: 48 *asr = k24000Hz; 49 return true; 50 } 51 return false; 52 } 53 54 } // namespace media 55