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