diff options
author | Eric Laurent <elaurent@google.com> | 2014-11-26 18:41:26 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-11-26 18:41:26 +0000 |
commit | 121143d5242a790d0bd01fe1b9cec5d28a1ba1d7 (patch) | |
tree | ede3e199b33b12c6c5767f2bd566e4664905bada /include/media/AudioPolicyHelper.h | |
parent | 0e47b16ffcf78acb81b0ebf14d058db191f74af0 (diff) | |
parent | bf14c62e7973ed793a3b00c2c67beca4484c1c7a (diff) | |
download | frameworks_av-121143d5242a790d0bd01fe1b9cec5d28a1ba1d7.zip frameworks_av-121143d5242a790d0bd01fe1b9cec5d28a1ba1d7.tar.gz frameworks_av-121143d5242a790d0bd01fe1b9cec5d28a1ba1d7.tar.bz2 |
am bf14c62e: am 72bf901c: Merge "audio policy: new getOutputForAttr() prototype." into lmp-mr1-dev
* commit 'bf14c62e7973ed793a3b00c2c67beca4484c1c7a':
audio policy: new getOutputForAttr() prototype.
Diffstat (limited to 'include/media/AudioPolicyHelper.h')
-rw-r--r-- | include/media/AudioPolicyHelper.h | 53 |
1 files changed, 52 insertions, 1 deletions
diff --git a/include/media/AudioPolicyHelper.h b/include/media/AudioPolicyHelper.h index f4afd45..3ed0b74 100644 --- a/include/media/AudioPolicyHelper.h +++ b/include/media/AudioPolicyHelper.h @@ -18,7 +18,7 @@ #include <system/audio.h> -audio_stream_type_t audio_attributes_to_stream_type(const audio_attributes_t *attr) +static audio_stream_type_t audio_attributes_to_stream_type(const audio_attributes_t *attr) { // flags to stream type mapping if ((attr->flags & AUDIO_FLAG_AUDIBILITY_ENFORCED) == AUDIO_FLAG_AUDIBILITY_ENFORCED) { @@ -61,4 +61,55 @@ audio_stream_type_t audio_attributes_to_stream_type(const audio_attributes_t *at } } +static void stream_type_to_audio_attributes(audio_stream_type_t streamType, + audio_attributes_t *attr) { + attr->flags = 0x0; + + switch (streamType) { + case AUDIO_STREAM_DEFAULT: + case AUDIO_STREAM_MUSIC: + attr->content_type = AUDIO_CONTENT_TYPE_MUSIC; + attr->usage = AUDIO_USAGE_MEDIA; + break; + case AUDIO_STREAM_VOICE_CALL: + attr->content_type = AUDIO_CONTENT_TYPE_SPEECH; + attr->usage = AUDIO_USAGE_VOICE_COMMUNICATION; + break; + case AUDIO_STREAM_ENFORCED_AUDIBLE: + attr->flags |= AUDIO_FLAG_AUDIBILITY_ENFORCED; + // intended fall through, attributes in common with STREAM_SYSTEM + case AUDIO_STREAM_SYSTEM: + attr->content_type = AUDIO_CONTENT_TYPE_SONIFICATION; + attr->usage = AUDIO_USAGE_ASSISTANCE_SONIFICATION; + break; + case AUDIO_STREAM_RING: + attr->content_type = AUDIO_CONTENT_TYPE_SONIFICATION; + attr->usage = AUDIO_USAGE_NOTIFICATION_TELEPHONY_RINGTONE; + break; + case AUDIO_STREAM_ALARM: + attr->content_type = AUDIO_CONTENT_TYPE_SONIFICATION; + attr->usage = AUDIO_USAGE_ALARM; + break; + case AUDIO_STREAM_NOTIFICATION: + attr->content_type = AUDIO_CONTENT_TYPE_SONIFICATION; + attr->usage = AUDIO_USAGE_NOTIFICATION; + break; + case AUDIO_STREAM_BLUETOOTH_SCO: + attr->content_type = AUDIO_CONTENT_TYPE_SPEECH; + attr->usage = AUDIO_USAGE_VOICE_COMMUNICATION; + attr->flags |= AUDIO_FLAG_SCO; + break; + case AUDIO_STREAM_DTMF: + attr->content_type = AUDIO_CONTENT_TYPE_SONIFICATION; + attr->usage = AUDIO_USAGE_VOICE_COMMUNICATION_SIGNALLING; + break; + case AUDIO_STREAM_TTS: + attr->content_type = AUDIO_CONTENT_TYPE_SPEECH; + attr->usage = AUDIO_USAGE_ASSISTANCE_ACCESSIBILITY; + break; + default: + ALOGE("invalid stream type %d when converting to attributes", streamType); + } +} + #endif //AUDIO_POLICY_HELPER_H_ |