Move TypeConverter into a shared library
This will be needed for the default implementation of the audio HAL
in TREBLE for parsing supported formats etc. provided by HAL in
a form of string literals.
As a bonus, remove some hand-written type conversions in AudioFlinger
used in dumps.
Example changes in the dump output:
HAL format: 0x1 (pcm16) ==> HAL format: 0x1 (AUDIO_FORMAT_PCM_16_BIT)
Processing format: 0x5 (pcmfloat) ==> Processing format: 0x5 (AUDIO_FORMAT_PCM_FLOAT)
Output device: 0x2 (SPEAKER) ==> Output device: 0x2 (AUDIO_DEVICE_OUT_SPEAKER)
Input device: 0 (NONE) ==> Input device: 0 (AUDIO_DEVICE_NONE)
AudioStreamOut: 0x... flags 0x6 (PRIMARY|FAST) ==>
AudioStreamOut: 0x... flags 0x6 (AUDIO_OUTPUT_FLAG_PRIMARY|AUDIO_OUTPUT_FLAG_FAST)
Test: make & run
Change-Id: I9cde640e6827b7aa6d62e9caade9e738227e299f
diff --git a/media/libmedia/AudioParameter.cpp b/media/libmedia/AudioParameter.cpp
index f263903..7871ede 100644
--- a/media/libmedia/AudioParameter.cpp
+++ b/media/libmedia/AudioParameter.cpp
@@ -83,7 +83,7 @@
mParameters.clear();
}
-String8 AudioParameter::toString()
+String8 AudioParameter::toString() const
{
String8 str = String8("");
@@ -140,7 +140,7 @@
}
}
-status_t AudioParameter::get(const String8& key, String8& value)
+status_t AudioParameter::get(const String8& key, String8& value) const
{
if (mParameters.indexOfKey(key) >= 0) {
value = mParameters.valueFor(key);
@@ -150,7 +150,7 @@
}
}
-status_t AudioParameter::getInt(const String8& key, int& value)
+status_t AudioParameter::getInt(const String8& key, int& value) const
{
String8 str8;
status_t result = get(key, str8);
@@ -166,7 +166,7 @@
return result;
}
-status_t AudioParameter::getFloat(const String8& key, float& value)
+status_t AudioParameter::getFloat(const String8& key, float& value) const
{
String8 str8;
status_t result = get(key, str8);
@@ -182,7 +182,7 @@
return result;
}
-status_t AudioParameter::getAt(size_t index, String8& key, String8& value)
+status_t AudioParameter::getAt(size_t index, String8& key, String8& value) const
{
if (mParameters.size() > index) {
key = mParameters.keyAt(index);