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