blob: 2476e6668b20b19dc6701a9e845eace5f8754463 [file] [log] [blame]
Dima Zavindb5cb142011-04-19 22:20:55 -07001/*
2 * Copyright (C) 2008-2011 The Android Open Source Project
Ravishankar Sarawadi20017912013-02-27 18:47:54 +01003 * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
Dima Zavindb5cb142011-04-19 22:20:55 -07004 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#ifndef ANDROID_AUDIOPARAMETER_H_
19#define ANDROID_AUDIOPARAMETER_H_
20
21#include <utils/Errors.h>
22#include <utils/KeyedVector.h>
23#include <utils/String8.h>
24
25namespace android {
26
27class AudioParameter {
28
29public:
30 AudioParameter() {}
31 AudioParameter(const String8& keyValuePairs);
32 virtual ~AudioParameter();
33
34 // reserved parameter keys for changing standard parameters with setParameters() function.
35 // Using these keys is mandatory for AudioFlinger to properly monitor audio output/input
36 // configuration changes and act accordingly.
Dima Zavinfce7a472011-04-19 22:30:36 -070037 // keyRouting: to change audio routing, value is an int in audio_devices_t
Dima Zavindb5cb142011-04-19 22:20:55 -070038 // keySamplingRate: to change sampling rate routing, value is an int
Dima Zavinfce7a472011-04-19 22:30:36 -070039 // keyFormat: to change audio format, value is an int in audio_format_t
40 // keyChannels: to change audio channel configuration, value is an int in audio_channels_t
Dima Zavindb5cb142011-04-19 22:20:55 -070041 // keyFrameCount: to change audio output frame count, value is an int
Dima Zavinfce7a472011-04-19 22:30:36 -070042 // keyInputSource: to change audio input source, value is an int in audio_source_t
Dima Zavindb5cb142011-04-19 22:20:55 -070043 // (defined in media/mediarecorder.h)
Glenn Kasten28ed2f92012-06-07 10:17:54 -070044 // keyScreenState: either "on" or "off"
Glenn Kastenedf47a82012-04-01 13:49:17 -070045 static const char * const keyRouting;
46 static const char * const keySamplingRate;
47 static const char * const keyFormat;
48 static const char * const keyChannels;
49 static const char * const keyFrameCount;
50 static const char * const keyInputSource;
Glenn Kasten28ed2f92012-06-07 10:17:54 -070051 static const char * const keyScreenState;
vivek mehta2192bc92012-12-04 11:46:08 -080052#ifdef QCOM_HARDWARE
53 static const char * const keyHandleFm;
54 static const char * const keyVoipCheck;
55 static const char * const keyFluenceType;
56 static const char * const keySSR;
57 static const char * const keyHandleA2dpDevice;
Ravishankar Sarawadi20017912013-02-27 18:47:54 +010058 static const char * const keyADSPStatus;
vivek mehta2192bc92012-12-04 11:46:08 -080059#endif
Dima Zavindb5cb142011-04-19 22:20:55 -070060
61 String8 toString();
62
63 status_t add(const String8& key, const String8& value);
64 status_t addInt(const String8& key, const int value);
65 status_t addFloat(const String8& key, const float value);
66
67 status_t remove(const String8& key);
68
69 status_t get(const String8& key, String8& value);
70 status_t getInt(const String8& key, int& value);
71 status_t getFloat(const String8& key, float& value);
72 status_t getAt(size_t index, String8& key, String8& value);
73
74 size_t size() { return mParameters.size(); }
75
76private:
77 String8 mKeyValuePairs;
78 KeyedVector <String8, String8> mParameters;
79};
80
81}; // namespace android
82
83#endif /*ANDROID_AUDIOPARAMETER_H_*/