Created
July 16, 2012 21:28
-
-
Save steven676/3125182 to your computer and use it in GitHub Desktop.
changes to platform/hardware/alsa_sound to build with Jelly Bean
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/ALSAControl.cpp b/ALSAControl.cpp | |
index 6e402db..388d580 100644 | |
--- a/ALSAControl.cpp | |
+++ b/ALSAControl.cpp | |
@@ -33,7 +33,7 @@ | |
#include "AudioHardwareALSA.h" | |
-namespace android | |
+namespace android_audio_legacy | |
{ | |
ALSAControl::ALSAControl(const char *device) | |
@@ -49,11 +49,11 @@ ALSAControl::~ALSAControl() | |
status_t ALSAControl::getmin(const char *name, unsigned int &min) | |
{ | |
if (!mHandle) { | |
- LOGE("Control not initialized"); | |
+ ALOGE("Control not initialized"); | |
return NO_INIT; | |
} | |
- LOGV("%s(%s, %d)", __FUNCTION__, name, min); | |
+ ALOGV("%s(%s, %d)", __FUNCTION__, name, min); | |
snd_ctl_elem_id_t *id; | |
snd_ctl_elem_info_t *info; | |
@@ -67,7 +67,7 @@ status_t ALSAControl::getmin(const char *name, unsigned int &min) | |
int ret = snd_ctl_elem_info(mHandle, info); | |
if (ret < 0) { | |
- LOGE("Control '%s' cannot get element info: %d", name, ret); | |
+ ALOGE("Control '%s' cannot get element info: %d", name, ret); | |
return BAD_VALUE; | |
} | |
@@ -79,11 +79,11 @@ status_t ALSAControl::getmin(const char *name, unsigned int &min) | |
status_t ALSAControl::getmax(const char *name, unsigned int &max) | |
{ | |
if (!mHandle) { | |
- LOGE("Control not initialized"); | |
+ ALOGE("Control not initialized"); | |
return NO_INIT; | |
} | |
- LOGV("%s(%s, %d)", __FUNCTION__, name, max); | |
+ ALOGV("%s(%s, %d)", __FUNCTION__, name, max); | |
snd_ctl_elem_id_t *id; | |
snd_ctl_elem_info_t *info; | |
@@ -97,7 +97,7 @@ status_t ALSAControl::getmax(const char *name, unsigned int &max) | |
int ret = snd_ctl_elem_info(mHandle, info); | |
if (ret < 0) { | |
- LOGE("Control '%s' cannot get element info: %d", name, ret); | |
+ ALOGE("Control '%s' cannot get element info: %d", name, ret); | |
return BAD_VALUE; | |
} | |
@@ -109,11 +109,11 @@ status_t ALSAControl::getmax(const char *name, unsigned int &max) | |
status_t ALSAControl::get(const char *name, unsigned int &value, int index) | |
{ | |
if (!mHandle) { | |
- LOGE("Control not initialized"); | |
+ ALOGE("Control not initialized"); | |
return NO_INIT; | |
} | |
- LOGV("%s(%s, %d, %d)", __FUNCTION__, name, value, index); | |
+ ALOGV("%s(%s, %d, %d)", __FUNCTION__, name, value, index); | |
snd_ctl_elem_id_t *id; | |
snd_ctl_elem_info_t *info; | |
@@ -129,13 +129,13 @@ status_t ALSAControl::get(const char *name, unsigned int &value, int index) | |
int ret = snd_ctl_elem_info(mHandle, info); | |
if (ret < 0) { | |
- LOGE("Control '%s' cannot get element info: %d", name, ret); | |
+ ALOGE("Control '%s' cannot get element info: %d", name, ret); | |
return BAD_VALUE; | |
} | |
int count = snd_ctl_elem_info_get_count(info); | |
if (index >= count) { | |
- LOGE("Control '%s' index is out of range (%d >= %d)", name, index, count); | |
+ ALOGE("Control '%s' index is out of range (%d >= %d)", name, index, count); | |
return BAD_VALUE; | |
} | |
@@ -144,7 +144,7 @@ status_t ALSAControl::get(const char *name, unsigned int &value, int index) | |
ret = snd_ctl_elem_read(mHandle, control); | |
if (ret < 0) { | |
- LOGE("Control '%s' cannot read element value: %d", name, ret); | |
+ ALOGE("Control '%s' cannot read element value: %d", name, ret); | |
return BAD_VALUE; | |
} | |
@@ -175,11 +175,11 @@ status_t ALSAControl::get(const char *name, unsigned int &value, int index) | |
status_t ALSAControl::set(const char *name, unsigned int value, int index) | |
{ | |
if (!mHandle) { | |
- LOGE("Control not initialized"); | |
+ ALOGE("Control not initialized"); | |
return NO_INIT; | |
} | |
- LOGV("%s(%s, %d, %d)", __FUNCTION__, name, value, index ); | |
+ ALOGV("%s(%s, %d, %d)", __FUNCTION__, name, value, index ); | |
snd_ctl_elem_id_t *id; | |
snd_ctl_elem_info_t *info; | |
@@ -193,13 +193,13 @@ status_t ALSAControl::set(const char *name, unsigned int value, int index) | |
int ret = snd_ctl_elem_info(mHandle, info); | |
if (ret < 0) { | |
- LOGE("Control '%s' cannot get element info: %d", name, ret); | |
+ ALOGE("Control '%s' cannot get element info: %d", name, ret); | |
return BAD_VALUE; | |
} | |
int count = snd_ctl_elem_info_get_count(info); | |
if (index >= count) { | |
- LOGE("Control '%s' index is out of range (%d >= %d)", name, index, count); | |
+ ALOGE("Control '%s' index is out of range (%d >= %d)", name, index, count); | |
return BAD_VALUE; | |
} | |
@@ -244,11 +244,11 @@ status_t ALSAControl::set(const char *name, unsigned int value, int index) | |
status_t ALSAControl::set(const char *name, const char *value) | |
{ | |
if (!mHandle) { | |
- LOGE("Control not initialized"); | |
+ ALOGE("Control not initialized"); | |
return NO_INIT; | |
} | |
- LOGV("%s(%s, %s)", __FUNCTION__, name, value); | |
+ ALOGV("%s(%s, %s)", __FUNCTION__, name, value); | |
snd_ctl_elem_id_t *id; | |
snd_ctl_elem_info_t *info; | |
@@ -262,7 +262,7 @@ status_t ALSAControl::set(const char *name, const char *value) | |
int ret = snd_ctl_elem_info(mHandle, info); | |
if (ret < 0) { | |
- LOGE("Control '%s' cannot get element info: %d", name, ret); | |
+ ALOGE("Control '%s' cannot get element info: %d", name, ret); | |
return BAD_VALUE; | |
} | |
@@ -275,9 +275,9 @@ status_t ALSAControl::set(const char *name, const char *value) | |
return set(name, i, -1); | |
} | |
- LOGE("Control '%s' has no enumerated value of '%s'", name, value); | |
+ ALOGE("Control '%s' has no enumerated value of '%s'", name, value); | |
return BAD_VALUE; | |
} | |
-}; // namespace android | |
+}; // namespace android_audio_legacy | |
diff --git a/ALSAMixer.cpp b/ALSAMixer.cpp | |
index 4b5334d..de579b1 100644 | |
--- a/ALSAMixer.cpp | |
+++ b/ALSAMixer.cpp | |
@@ -42,7 +42,7 @@ | |
if (strlen(x) + strlen(y) < ALSA_NAME_MAX) \ | |
strcat(x, y); | |
-namespace android | |
+namespace android_audio_legacy | |
{ | |
// ---------------------------------------------------------------------------- | |
@@ -100,16 +100,16 @@ static int initMixer (snd_mixer_t **mixer, const char *name) | |
int err; | |
if ((err = snd_mixer_open(mixer, 0)) < 0) { | |
- LOGE("Unable to open mixer: %s", snd_strerror(err)); | |
+ ALOGE("Unable to open mixer: %s", snd_strerror(err)); | |
return err; | |
} | |
if ((err = snd_mixer_attach(*mixer, name)) < 0) { | |
- LOGW("Unable to attach mixer to device %s: %s", | |
+ ALOGW("Unable to attach mixer to device %s: %s", | |
name, snd_strerror(err)); | |
if ((err = snd_mixer_attach(*mixer, "hw:00")) < 0) { | |
- LOGE("Unable to attach mixer to device default: %s", | |
+ ALOGE("Unable to attach mixer to device default: %s", | |
snd_strerror(err)); | |
snd_mixer_close (*mixer); | |
@@ -119,7 +119,7 @@ static int initMixer (snd_mixer_t **mixer, const char *name) | |
} | |
if ((err = snd_mixer_selem_register(*mixer, NULL, NULL)) < 0) { | |
- LOGE("Unable to register mixer elements: %s", snd_strerror(err)); | |
+ ALOGE("Unable to register mixer elements: %s", snd_strerror(err)); | |
snd_mixer_close (*mixer); | |
*mixer = NULL; | |
return err; | |
@@ -127,7 +127,7 @@ static int initMixer (snd_mixer_t **mixer, const char *name) | |
// Get the mixer controls from the kernel | |
if ((err = snd_mixer_load(*mixer)) < 0) { | |
- LOGE("Unable to load mixer elements: %s", snd_strerror(err)); | |
+ ALOGE("Unable to load mixer elements: %s", snd_strerror(err)); | |
snd_mixer_close (*mixer); | |
*mixer = NULL; | |
return err; | |
@@ -202,7 +202,7 @@ ALSAMixer::ALSAMixer() | |
} | |
} | |
- LOGV("Mixer: master '%s' %s.", info->name, info->elem ? "found" : "not found"); | |
+ ALOGV("Mixer: master '%s' %s.", info->name, info->elem ? "found" : "not found"); | |
for (int j = 0; mixerProp[j][i].device; j++) { | |
@@ -238,11 +238,11 @@ ALSAMixer::ALSAMixer() | |
break; | |
} | |
} | |
- LOGV("Mixer: route '%s' %s.", info->name, info->elem ? "found" : "not found"); | |
+ ALOGV("Mixer: route '%s' %s.", info->name, info->elem ? "found" : "not found"); | |
} | |
} | |
- LOGV("mixer initialized."); | |
+ ALOGV("mixer initialized."); | |
} | |
ALSAMixer::~ALSAMixer() | |
@@ -260,7 +260,7 @@ ALSAMixer::~ALSAMixer() | |
} | |
} | |
} | |
- LOGV("mixer destroyed."); | |
+ ALOGV("mixer destroyed."); | |
} | |
status_t ALSAMixer::setMasterVolume(float volume) | |
@@ -359,7 +359,7 @@ status_t ALSAMixer::setCaptureMuteState(uint32_t device, bool state) | |
int err = snd_mixer_selem_set_capture_switch_all (info->elem, static_cast<int>(!state)); | |
if (err < 0) { | |
- LOGE("Unable to %s capture mixer switch %s", | |
+ ALOGE("Unable to %s capture mixer switch %s", | |
state ? "enable" : "disable", info->name); | |
return INVALID_OPERATION; | |
} | |
@@ -400,7 +400,7 @@ status_t ALSAMixer::setPlaybackMuteState(uint32_t device, bool state) | |
int err = snd_mixer_selem_set_playback_switch_all (info->elem, static_cast<int>(!state)); | |
if (err < 0) { | |
- LOGE("Unable to %s playback mixer switch %s", | |
+ ALOGE("Unable to %s playback mixer switch %s", | |
state ? "enable" : "disable", info->name); | |
return INVALID_OPERATION; | |
} | |
@@ -428,4 +428,4 @@ status_t ALSAMixer::getPlaybackMuteState(uint32_t device, bool *state) | |
return BAD_VALUE; | |
} | |
-}; // namespace android | |
+}; // namespace android_audio_legacy | |
diff --git a/ALSAStreamOps.cpp b/ALSAStreamOps.cpp | |
index 243ffc8..a30d92c 100755 | |
--- a/ALSAStreamOps.cpp | |
+++ b/ALSAStreamOps.cpp | |
@@ -33,7 +33,7 @@ | |
#include "AudioHardwareALSA.h" | |
-namespace android | |
+namespace android_audio_legacy | |
{ | |
// ---------------------------------------------------------------------------- | |
@@ -47,7 +47,7 @@ ALSAStreamOps::ALSAStreamOps(AudioHardwareALSA *parent, alsa_handle_t *handle) : | |
ALSAStreamOps::~ALSAStreamOps() | |
{ | |
- AutoMutex lock(mLock); | |
+ android::AutoMutex lock(mLock); | |
close(); | |
} | |
@@ -139,7 +139,7 @@ status_t ALSAStreamOps::set(int *format, | |
break; | |
default: | |
- LOGE("Unknown PCM format %i. Forcing default", *format); | |
+ ALOGE("Unknown PCM format %i. Forcing default", *format); | |
break; | |
} | |
@@ -164,7 +164,7 @@ status_t ALSAStreamOps::set(int *format, | |
if (mParent->mALSADevice->resetDefaults) { | |
status = mParent->mALSADevice->resetDefaults(mHandle); | |
if (status != NO_ERROR) { | |
- LOGE("reset defaults return failure"); | |
+ ALOGE("reset defaults return failure"); | |
return BAD_VALUE; | |
} | |
} | |
@@ -179,7 +179,7 @@ status_t ALSAStreamOps::setParameters(const String8& keyValuePairs) | |
String8 key = String8(AudioParameter::keyRouting); | |
status_t status = NO_ERROR; | |
int device; | |
- LOGV("setParameters() %s", keyValuePairs.string()); | |
+ ALOGV("setParameters() %s", keyValuePairs.string()); | |
String8 keyfm = String8("fm_off"); | |
String8 valuefm; | |
if (param.get(keyfm, valuefm) == NO_ERROR) { | |
@@ -197,10 +197,10 @@ status_t ALSAStreamOps::setParameters(const String8& keyValuePairs) | |
// default action: fwd the kvp's to the module incase it wants to take action | |
if (mParent->mALSADevice->set) { | |
status = mParent->mALSADevice->set(keyValuePairs); | |
- LOGI("setParameters() %s, %d", keyValuePairs.string(), (int)status); | |
+ ALOGI("setParameters() %s, %d", keyValuePairs.string(), (int)status); | |
return status; | |
} else { | |
- LOGI("setParameters() :: BAD_VALUE"); | |
+ ALOGI("setParameters() :: BAD_VALUE"); | |
return BAD_VALUE; | |
} | |
} | |
@@ -217,7 +217,7 @@ String8 ALSAStreamOps::getParameters(const String8& keys) | |
param.addInt(key, (int)mHandle->curDev); | |
} | |
- LOGV("getParameters() %s", param.toString().string()); | |
+ ALOGV("getParameters() %s", param.toString().string()); | |
return param.toString(); | |
} | |
@@ -240,7 +240,7 @@ size_t ALSAStreamOps::bufferSize() const | |
// power of 2. This might be for OSS compatibility. | |
for (size_t i = 1; (bytes & ~i) != 0; i<<=1) | |
bytes &= ~i; | |
- LOGI("buffer size (bytes) to AF = %d", bytes); | |
+ ALOGI("buffer size (bytes) to AF = %d", bytes); | |
return bytes; | |
} | |
@@ -321,4 +321,4 @@ status_t ALSAStreamOps::open(int mode) | |
return mParent->mALSADevice->open(mHandle, mHandle->curDev, mode, mHandle->curChannels); | |
} | |
-} // namespace android | |
+} // namespace android_audio_legacy | |
diff --git a/AudioHardwareALSA.cpp b/AudioHardwareALSA.cpp | |
index 7362d8e..5cc63c2 100644 | |
--- a/AudioHardwareALSA.cpp | |
+++ b/AudioHardwareALSA.cpp | |
@@ -38,12 +38,12 @@ extern "C" | |
// | |
// Function for dlsym() to look up for creating a new AudioHardwareInterface. | |
// | |
- android::AudioHardwareInterface *createAudioHardware(void) { | |
- return android::AudioHardwareALSA::create(); | |
+ android_audio_legacy::AudioHardwareInterface *createAudioHardware(void) { | |
+ return android_audio_legacy::AudioHardwareALSA::create(); | |
} | |
} // extern "C" | |
-namespace android | |
+namespace android_audio_legacy | |
{ | |
// ---------------------------------------------------------------------------- | |
@@ -63,7 +63,7 @@ static void ALSAErrorHandler(const char *file, | |
l = snprintf(buf, BUFSIZ, "%s:%i:(%s) ", file, line, function); | |
vsnprintf(buf + l, BUFSIZ - l, fmt, arg); | |
buf[BUFSIZ-1] = '\0'; | |
- LOG(LOG_ERROR, "ALSALib", "%s", buf); | |
+ ALOG(LOG_ERROR, "ALSALib", "%s", buf); | |
va_end(arg); | |
} | |
@@ -89,9 +89,9 @@ AudioHardwareALSA::AudioHardwareALSA() : | |
mALSADevice = (alsa_device_t *)device; | |
mALSADevice->init(mALSADevice, mDeviceList); | |
} else | |
- LOGE("ALSA Module could not be opened!!!"); | |
+ ALOGE("ALSA Module could not be opened!!!"); | |
} else | |
- LOGE("ALSA Module not found!!!"); | |
+ ALOGE("ALSA Module not found!!!"); | |
err = hw_get_module(ACOUSTICS_HARDWARE_MODULE_ID, | |
(hw_module_t const**)&module); | |
@@ -102,7 +102,7 @@ AudioHardwareALSA::AudioHardwareALSA() : | |
if (err == 0) | |
mAcousticDevice = (acoustic_device_t *)device; | |
else | |
- LOGE("Acoustics Module not found."); | |
+ ALOGE("Acoustics Module not found."); | |
} | |
} | |
@@ -167,11 +167,11 @@ status_t AudioHardwareALSA::setMode(int mode) | |
status_t AudioHardwareALSA::setParameters(const String8& keyValuePairs) | |
{ | |
if (mALSADevice && mALSADevice->set){ | |
- LOGI("setParameters got %s", keyValuePairs.string()); | |
+ ALOGI("setParameters got %s", keyValuePairs.string()); | |
return mALSADevice->set(keyValuePairs); | |
} | |
else { | |
- LOGE("setParameters INVALID OPERATION"); | |
+ ALOGE("setParameters INVALID OPERATION"); | |
return INVALID_OPERATION; | |
} | |
} | |
@@ -183,16 +183,16 @@ AudioHardwareALSA::openOutputStream(uint32_t devices, | |
uint32_t *sampleRate, | |
status_t *status) | |
{ | |
- AutoMutex lock(mLock); | |
+ android::AutoMutex lock(mLock); | |
- LOGD("openOutputStream called for devices: 0x%08x", devices); | |
+ ALOGD("openOutputStream called for devices: 0x%08x", devices); | |
status_t err = BAD_VALUE; | |
AudioStreamOutALSA *out = 0; | |
if (devices & (devices - 1)) { | |
if (status) *status = err; | |
- LOGD("openOutputStream called with bad devices"); | |
+ ALOGD("openOutputStream called with bad devices"); | |
return out; | |
} | |
@@ -214,7 +214,7 @@ AudioHardwareALSA::openOutputStream(uint32_t devices, | |
void | |
AudioHardwareALSA::closeOutputStream(AudioStreamOut* out) | |
{ | |
- AutoMutex lock(mLock); | |
+ android::AutoMutex lock(mLock); | |
delete out; | |
} | |
@@ -226,7 +226,7 @@ AudioHardwareALSA::openInputStream(uint32_t devices, | |
status_t *status, | |
AudioSystem::audio_in_acoustics acoustics) | |
{ | |
- AutoMutex lock(mLock); | |
+ android::AutoMutex lock(mLock); | |
status_t err = BAD_VALUE; | |
AudioStreamInALSA *in = 0; | |
@@ -259,15 +259,15 @@ size_t AudioHardwareALSA::getInputBufferSize(uint32_t sampleRate, int format, in | |
sampleRate == 16000 || | |
sampleRate == 44100 || | |
sampleRate == 48000)) { | |
- LOGW("getInputBufferSize bad sampling rate: %d", sampleRate); | |
+ ALOGW("getInputBufferSize bad sampling rate: %d", sampleRate); | |
return 0; | |
} | |
if (format != AudioSystem::PCM_16_BIT) { | |
- LOGW("getInputBufferSize bad format: %d", format); | |
+ ALOGW("getInputBufferSize bad format: %d", format); | |
return 0; | |
} | |
if (channelCount != 1) { | |
- LOGW("getInputBufferSize bad channel count: %d", channelCount); | |
+ ALOGW("getInputBufferSize bad channel count: %d", channelCount); | |
return 0; | |
} | |
@@ -277,7 +277,7 @@ size_t AudioHardwareALSA::getInputBufferSize(uint32_t sampleRate, int format, in | |
void | |
AudioHardwareALSA::closeInputStream(AudioStreamIn* in) | |
{ | |
- AutoMutex lock(mLock); | |
+ android::AutoMutex lock(mLock); | |
delete in; | |
} | |
@@ -302,4 +302,4 @@ status_t AudioHardwareALSA::dump(int fd, const Vector<String16>& args) | |
return NO_ERROR; | |
} | |
-} // namespace android | |
+} // namespace android_audio_legacy | |
diff --git a/AudioHardwareALSA.h b/AudioHardwareALSA.h | |
index 90244d6..8d9a75b 100755 | |
--- a/AudioHardwareALSA.h | |
+++ b/AudioHardwareALSA.h | |
@@ -20,12 +20,14 @@ | |
#include <utils/List.h> | |
#include <hardware_legacy/AudioHardwareBase.h> | |
+#include <hardware_legacy/AudioHardwareInterface.h> | |
+#include <hardware_legacy/AudioSystemLegacy.h> | |
#include <alsa/asoundlib.h> | |
#include <hardware/hardware.h> | |
-namespace android | |
+namespace android_audio_legacy | |
{ | |
class AudioHardwareALSA; | |
@@ -54,7 +56,7 @@ struct alsa_handle_t { | |
void * modPrivate; | |
}; | |
-typedef List<alsa_handle_t> ALSAHandleList; | |
+typedef android::List<alsa_handle_t> ALSAHandleList; | |
struct alsa_device_t { | |
hw_device_t common; | |
@@ -164,7 +166,7 @@ protected: | |
AudioHardwareALSA * mParent; | |
alsa_handle_t * mHandle; | |
- Mutex mLock; | |
+ android::Mutex mLock; | |
bool mPowerLock; | |
}; | |
@@ -278,6 +280,14 @@ public: | |
status_t open(int mode); | |
status_t close(); | |
+ /* XXXXXX */ | |
+ virtual status_t addAudioEffect(effect_interface_s **) { | |
+ return NO_ERROR; | |
+ } | |
+ virtual status_t removeAudioEffect(effect_interface_s **) { | |
+ return NO_ERROR; | |
+ } | |
+ | |
private: | |
void resetFramesLost(); | |
@@ -371,10 +381,10 @@ protected: | |
ALSAHandleList mDeviceList; | |
private: | |
- Mutex mLock; | |
+ android::Mutex mLock; | |
}; | |
// ---------------------------------------------------------------------------- | |
-}; // namespace android | |
+}; // namespace android_audio_legacy | |
#endif // ANDROID_AUDIO_HARDWARE_ALSA_H | |
diff --git a/AudioPolicyManagerALSA.cpp b/AudioPolicyManagerALSA.cpp | |
index a6b81b3..9d961b4 100644 | |
--- a/AudioPolicyManagerALSA.cpp | |
+++ b/AudioPolicyManagerALSA.cpp | |
@@ -20,7 +20,7 @@ | |
#include "AudioPolicyManagerALSA.h" | |
#include <media/mediarecorder.h> | |
-namespace android { | |
+namespace android_audio_legacy { | |
status_t AudioPolicyManagerALSA::setDeviceConnectionState(AudioSystem::audio_devices device, | |
AudioSystem::device_connection_state state, | |
@@ -33,7 +33,7 @@ status_t AudioPolicyManagerALSA::setDeviceConnectionState(AudioSystem::audio_dev | |
if (AudioSystem::popCount(device) != 1) return BAD_VALUE; | |
if (strlen(device_address) >= MAX_DEVICE_ADDRESS_LEN) { | |
- LOGE("setDeviceConnectionState() invalid address: %s", device_address); | |
+ ALOGE("setDeviceConnectionState() invalid address: %s", device_address); | |
return BAD_VALUE; | |
} | |
@@ -42,7 +42,7 @@ status_t AudioPolicyManagerALSA::setDeviceConnectionState(AudioSystem::audio_dev | |
#ifndef WITH_A2DP | |
if (AudioSystem::isA2dpDevice(device)) { | |
- LOGE("setDeviceConnectionState() invalid device: %x", device); | |
+ ALOGE("setDeviceConnectionState() invalid device: %x", device); | |
return BAD_VALUE; | |
} | |
#endif | |
@@ -52,7 +52,7 @@ status_t AudioPolicyManagerALSA::setDeviceConnectionState(AudioSystem::audio_dev | |
// handle output device connection | |
case AudioSystem::DEVICE_STATE_AVAILABLE: | |
if (mAvailableOutputDevices & device) { | |
- LOGW("setDeviceConnectionState() device already connected: %x", device); | |
+ ALOGW("setDeviceConnectionState() device already connected: %x", device); | |
return INVALID_OPERATION; | |
} | |
LOGV("setDeviceConnectionState() connecting device %x", device); | |
@@ -87,7 +87,7 @@ status_t AudioPolicyManagerALSA::setDeviceConnectionState(AudioSystem::audio_dev | |
// handle output device disconnection | |
case AudioSystem::DEVICE_STATE_UNAVAILABLE: { | |
if (!(mAvailableOutputDevices & device)) { | |
- LOGW("setDeviceConnectionState() device not connected: %x", device); | |
+ ALOGW("setDeviceConnectionState() device not connected: %x", device); | |
return INVALID_OPERATION; | |
} | |
@@ -120,7 +120,7 @@ status_t AudioPolicyManagerALSA::setDeviceConnectionState(AudioSystem::audio_dev | |
} break; | |
default: | |
- LOGE("setDeviceConnectionState() invalid state: %x", state); | |
+ ALOGE("setDeviceConnectionState() invalid state: %x", state); | |
return BAD_VALUE; | |
} | |
@@ -159,7 +159,7 @@ status_t AudioPolicyManagerALSA::setDeviceConnectionState(AudioSystem::audio_dev | |
// handle input device connection | |
case AudioSystem::DEVICE_STATE_AVAILABLE: { | |
if (mAvailableInputDevices & device) { | |
- LOGW("setDeviceConnectionState() device already connected: %d", device); | |
+ ALOGW("setDeviceConnectionState() device already connected: %d", device); | |
return INVALID_OPERATION; | |
} | |
mAvailableInputDevices |= device; | |
@@ -169,14 +169,14 @@ status_t AudioPolicyManagerALSA::setDeviceConnectionState(AudioSystem::audio_dev | |
// handle input device disconnection | |
case AudioSystem::DEVICE_STATE_UNAVAILABLE: { | |
if (!(mAvailableInputDevices & device)) { | |
- LOGW("setDeviceConnectionState() device not connected: %d", device); | |
+ ALOGW("setDeviceConnectionState() device not connected: %d", device); | |
return INVALID_OPERATION; | |
} | |
mAvailableInputDevices &= ~device; | |
} break; | |
default: | |
- LOGE("setDeviceConnectionState() invalid state: %x", state); | |
+ ALOGE("setDeviceConnectionState() invalid state: %x", state); | |
return BAD_VALUE; | |
} | |
@@ -251,7 +251,7 @@ status_t AudioPolicyManagerALSA::setDeviceConnectionState(AudioSystem::audio_dev | |
return NO_ERROR; | |
} | |
- LOGW("setDeviceConnectionState() invalid device: %x", device); | |
+ ALOGW("setDeviceConnectionState() invalid device: %x", device); | |
return BAD_VALUE; | |
} | |
@@ -305,7 +305,7 @@ uint32_t AudioPolicyManagerALSA::getDeviceForStrategy(routing_strategy strategy, | |
#endif | |
device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_EARPIECE; | |
if (device == 0) { | |
- LOGE("getDeviceForStrategy() earpiece device not found"); | |
+ ALOGE("getDeviceForStrategy() earpiece device not found"); | |
} | |
break; | |
@@ -324,7 +324,7 @@ uint32_t AudioPolicyManagerALSA::getDeviceForStrategy(routing_strategy strategy, | |
#endif | |
device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_SPEAKER; | |
if (device == 0) { | |
- LOGE("getDeviceForStrategy() speaker device not found"); | |
+ ALOGE("getDeviceForStrategy() speaker device not found"); | |
} | |
break; | |
} | |
@@ -341,7 +341,7 @@ uint32_t AudioPolicyManagerALSA::getDeviceForStrategy(routing_strategy strategy, | |
} | |
device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_SPEAKER; | |
if (device == 0) { | |
- LOGE("getDeviceForStrategy() speaker device not found"); | |
+ ALOGE("getDeviceForStrategy() speaker device not found"); | |
} | |
// The second device used for sonification is the same as the device used by media strategy | |
// FALL THROUGH | |
@@ -401,12 +401,12 @@ uint32_t AudioPolicyManagerALSA::getDeviceForStrategy(routing_strategy strategy, | |
// device is DEVICE_OUT_SPEAKER if we come from case STRATEGY_SONIFICATION, 0 otherwise | |
device |= device2; | |
if (device == 0) { | |
- LOGE("getDeviceForStrategy() speaker device not found"); | |
+ ALOGE("getDeviceForStrategy() speaker device not found"); | |
} | |
} break; | |
default: | |
- LOGW("getDeviceForStrategy() unknown strategy: %d", strategy); | |
+ ALOGW("getDeviceForStrategy() unknown strategy: %d", strategy); | |
break; | |
} | |
@@ -471,7 +471,7 @@ status_t AudioPolicyManagerALSA::stopOutput(audio_io_handle_t output, AudioSyste | |
LOGV("stopOutput() output %d, stream %d", output, stream); | |
ssize_t index = mOutputs.indexOfKey(output); | |
if (index < 0) { | |
- LOGW("stopOutput() unknow output %d", output); | |
+ ALOGW("stopOutput() unknow output %d", output); | |
return BAD_VALUE; | |
} | |
AudioOutputDescriptor *outputDesc = mOutputs.valueAt(index); | |
@@ -512,7 +512,7 @@ status_t AudioPolicyManagerALSA::stopOutput(audio_io_handle_t output, AudioSyste | |
} | |
return NO_ERROR; | |
} else { | |
- LOGW("stopOutput() refcount is already 0 for output %d", output); | |
+ ALOGW("stopOutput() refcount is already 0 for output %d", output); | |
return INVALID_OPERATION; | |
} | |
} | |
@@ -609,4 +609,4 @@ AudioPolicyManagerALSA::~AudioPolicyManagerALSA() | |
{ | |
} | |
-}; // namespace android | |
+}; // namespace android_audio_legacy | |
diff --git a/AudioPolicyManagerALSA.h b/AudioPolicyManagerALSA.h | |
index 3ec3aa4..b9df447 100644 | |
--- a/AudioPolicyManagerALSA.h | |
+++ b/AudioPolicyManagerALSA.h | |
@@ -23,7 +23,7 @@ | |
#include <hardware_legacy/AudioPolicyManagerBase.h> | |
-namespace android { | |
+namespace android_audio_legacy { | |
// ---------------------------------------------------------------------------- | |
diff --git a/AudioStreamInALSA.cpp b/AudioStreamInALSA.cpp | |
index df3ce4c..7c0d6bc 100755 | |
--- a/AudioStreamInALSA.cpp | |
+++ b/AudioStreamInALSA.cpp | |
@@ -33,7 +33,7 @@ | |
#include "AudioHardwareALSA.h" | |
-namespace android | |
+namespace android_audio_legacy | |
{ | |
AudioStreamInALSA::AudioStreamInALSA(AudioHardwareALSA *parent, | |
@@ -60,7 +60,7 @@ status_t AudioStreamInALSA::setGain(float gain) | |
ssize_t AudioStreamInALSA::read(void *buffer, ssize_t bytes) | |
{ | |
- AutoMutex lock(mLock); | |
+ android::AutoMutex lock(mLock); | |
if (!mPowerLock) { | |
acquire_wake_lock (PARTIAL_WAKE_LOCK, "AudioInLock"); | |
@@ -101,7 +101,7 @@ status_t AudioStreamInALSA::dump(int fd, const Vector<String16>& args) | |
status_t AudioStreamInALSA::open(int mode) | |
{ | |
- AutoMutex lock(mLock); | |
+ android::AutoMutex lock(mLock); | |
status_t status = ALSAStreamOps::open(mode); | |
@@ -115,7 +115,7 @@ status_t AudioStreamInALSA::open(int mode) | |
status_t AudioStreamInALSA::close() | |
{ | |
- AutoMutex lock(mLock); | |
+ android::AutoMutex lock(mLock); | |
acoustic_device_t *aDev = acoustics(); | |
@@ -133,7 +133,7 @@ status_t AudioStreamInALSA::close() | |
status_t AudioStreamInALSA::standby() | |
{ | |
- AutoMutex lock(mLock); | |
+ android::AutoMutex lock(mLock); | |
if (mPowerLock) { | |
release_wake_lock ("AudioInLock"); | |
@@ -145,7 +145,7 @@ status_t AudioStreamInALSA::standby() | |
void AudioStreamInALSA::resetFramesLost() | |
{ | |
- AutoMutex lock(mLock); | |
+ android::AutoMutex lock(mLock); | |
mFramesLost = 0; | |
} | |
@@ -160,11 +160,11 @@ unsigned int AudioStreamInALSA::getInputFramesLost() const | |
status_t AudioStreamInALSA::setAcousticParams(void *params) | |
{ | |
- AutoMutex lock(mLock); | |
+ android::AutoMutex lock(mLock); | |
acoustic_device_t *aDev = acoustics(); | |
return aDev ? aDev->set_params(aDev, mAcoustics, params) : (status_t)NO_ERROR; | |
} | |
-} // namespace android | |
+} // namespace android_audio_legacy | |
diff --git a/AudioStreamOutALSA.cpp b/AudioStreamOutALSA.cpp | |
index 02ee43b..a6b4425 100644 | |
--- a/AudioStreamOutALSA.cpp | |
+++ b/AudioStreamOutALSA.cpp | |
@@ -38,7 +38,7 @@ | |
#define ALSA_DEFAULT_SAMPLE_RATE 44100 // in Hz | |
#endif | |
-namespace android | |
+namespace android_audio_legacy | |
{ | |
// ---------------------------------------------------------------------------- | |
@@ -71,7 +71,7 @@ status_t AudioStreamOutALSA::setVolume(float left, float right) | |
ssize_t AudioStreamOutALSA::write(const void *buffer, size_t bytes) | |
{ | |
- AutoMutex lock(mLock); | |
+ android::AutoMutex lock(mLock); | |
if (!mPowerLock) { | |
acquire_wake_lock (PARTIAL_WAKE_LOCK, "AudioOutLock"); | |
@@ -83,7 +83,7 @@ ssize_t AudioStreamOutALSA::write(const void *buffer, size_t bytes) | |
nsecs_t previously = systemTime(); | |
mHandle->module->open(mHandle, mHandle->curDev, mHandle->curMode, mHandle->curChannels); | |
nsecs_t delta = systemTime() - previously; | |
- LOGE("RE-OPEN AFTER STANDBY:: took %llu msecs\n", ns2ms(delta)); | |
+ ALOGE("RE-OPEN AFTER STANDBY:: took %llu msecs\n", ns2ms(delta)); | |
} | |
acoustic_device_t *aDev = acoustics(); | |
@@ -152,13 +152,13 @@ status_t AudioStreamOutALSA::dump(int fd, const Vector<String16>& args) | |
status_t AudioStreamOutALSA::open(int mode) | |
{ | |
- AutoMutex lock(mLock); | |
+ android::AutoMutex lock(mLock); | |
return ALSAStreamOps::open(mode); | |
} | |
status_t AudioStreamOutALSA::close() | |
{ | |
- AutoMutex lock(mLock); | |
+ android::AutoMutex lock(mLock); | |
snd_pcm_drain (mHandle->handle); | |
ALSAStreamOps::close(); | |
@@ -173,7 +173,7 @@ status_t AudioStreamOutALSA::close() | |
status_t AudioStreamOutALSA::standby() | |
{ | |
- AutoMutex lock(mLock); | |
+ android::AutoMutex lock(mLock); | |
if (mHandle->module->standby) | |
// allow hw specific modules to imlement unique standby | |
@@ -210,4 +210,4 @@ status_t AudioStreamOutALSA::getRenderPosition(uint32_t *dspFrames) | |
return NO_ERROR; | |
} | |
-} // namespace android | |
+} // namespace android_audio_legacy | |
diff --git a/acoustics_default.cpp b/acoustics_default.cpp | |
index 6280979..5d58877 100644 | |
--- a/acoustics_default.cpp | |
+++ b/acoustics_default.cpp | |
@@ -20,7 +20,7 @@ | |
#include "AudioHardwareALSA.h" | |
-namespace android | |
+namespace android_audio_legacy | |
{ | |
static int s_device_open(const hw_module_t*, const char*, hw_device_t**); | |
@@ -86,14 +86,14 @@ static status_t s_use_handle(acoustic_device_t *dev, alsa_handle_t *h) | |
static status_t s_cleanup(acoustic_device_t *dev) | |
{ | |
- LOGD("Acoustics close stub called."); | |
+ ALOGD("Acoustics close stub called."); | |
return NO_ERROR; | |
} | |
static status_t s_set_params(acoustic_device_t *dev, | |
AudioSystem::audio_in_acoustics acoustics, void *params) | |
{ | |
- LOGD("Acoustics set_params stub called with %d.", (int)acoustics); | |
+ ALOGD("Acoustics set_params stub called with %d.", (int)acoustics); | |
return NO_ERROR; | |
} | |
} | |
diff --git a/alsa_default.cpp b/alsa_default.cpp | |
index 66b0959..afce8da 100644 | |
--- a/alsa_default.cpp | |
+++ b/alsa_default.cpp | |
@@ -33,7 +33,7 @@ | |
#define ALSA_DEFAULT_SAMPLE_RATE 44100 // in Hz | |
#endif | |
-namespace android | |
+namespace android_audio_legacy | |
{ | |
static int s_device_open(const hw_module_t*, const char*, hw_device_t**); | |
@@ -220,7 +220,7 @@ status_t setHardwareParams(alsa_handle_t *handle) | |
err = snd_pcm_hw_params_any(handle->handle, hardwareParams); | |
if (err < 0) { | |
- LOGE("Unable to configure hardware: %s", snd_strerror(err)); | |
+ ALOGE("Unable to configure hardware: %s", snd_strerror(err)); | |
goto done; | |
} | |
@@ -228,7 +228,7 @@ status_t setHardwareParams(alsa_handle_t *handle) | |
err = snd_pcm_hw_params_set_access(handle->handle, hardwareParams, | |
SND_PCM_ACCESS_RW_INTERLEAVED); | |
if (err < 0) { | |
- LOGE("Unable to configure PCM read/write format: %s", | |
+ ALOGE("Unable to configure PCM read/write format: %s", | |
snd_strerror(err)); | |
goto done; | |
} | |
@@ -236,7 +236,7 @@ status_t setHardwareParams(alsa_handle_t *handle) | |
err = snd_pcm_hw_params_set_format(handle->handle, hardwareParams, | |
handle->format); | |
if (err < 0) { | |
- LOGE("Unable to configure PCM format %s (%s): %s", | |
+ ALOGE("Unable to configure PCM format %s (%s): %s", | |
formatName, formatDesc, snd_strerror(err)); | |
goto done; | |
} | |
@@ -246,7 +246,7 @@ status_t setHardwareParams(alsa_handle_t *handle) | |
err = snd_pcm_hw_params_set_channels(handle->handle, hardwareParams, | |
handle->channels); | |
if (err < 0) { | |
- LOGE("Unable to set channel count to %i: %s", | |
+ ALOGE("Unable to set channel count to %i: %s", | |
handle->channels, snd_strerror(err)); | |
goto done; | |
} | |
@@ -258,13 +258,13 @@ status_t setHardwareParams(alsa_handle_t *handle) | |
&requestedRate, 0); | |
if (err < 0) | |
- LOGE("Unable to set %s sample rate to %u: %s", | |
+ ALOGE("Unable to set %s sample rate to %u: %s", | |
streamName(handle), handle->sampleRate, snd_strerror(err)); | |
else if (requestedRate != handle->sampleRate) | |
// Some devices have a fixed sample rate, and can not be changed. | |
// This may cause resampling problems; i.e. PCM playback will be too | |
// slow or fast. | |
- LOGW("Requested rate (%u HZ) does not match actual rate (%u HZ)", | |
+ ALOGW("Requested rate (%u HZ) does not match actual rate (%u HZ)", | |
handle->sampleRate, requestedRate); | |
else | |
LOGV("Set %s sample rate to %u HZ", stream, requestedRate); | |
@@ -275,7 +275,7 @@ status_t setHardwareParams(alsa_handle_t *handle) | |
hardwareParams, | |
static_cast<int>(resample)); | |
if (err < 0) { | |
- LOGE("Unable to %s hardware resampling: %s", | |
+ ALOGE("Unable to %s hardware resampling: %s", | |
resample ? "enable" : "disable", | |
snd_strerror(err)); | |
goto done; | |
@@ -287,7 +287,7 @@ status_t setHardwareParams(alsa_handle_t *handle) | |
&bufferSize); | |
if (err < 0) { | |
- LOGE("Unable to set buffer size to %d: %s", | |
+ ALOGE("Unable to set buffer size to %d: %s", | |
(int)bufferSize, snd_strerror(err)); | |
goto done; | |
} | |
@@ -301,14 +301,14 @@ status_t setHardwareParams(alsa_handle_t *handle) | |
err = snd_pcm_hw_params_set_period_time_near(handle->handle, | |
hardwareParams, &periodTime, NULL); | |
if (err < 0) { | |
- LOGE("Unable to set the period time for latency: %s", snd_strerror(err)); | |
+ ALOGE("Unable to set the period time for latency: %s", snd_strerror(err)); | |
goto done; | |
} | |
snd_pcm_uframes_t periodSize; | |
err = snd_pcm_hw_params_get_period_size(hardwareParams, &periodSize, | |
NULL); | |
if (err < 0) { | |
- LOGE("Unable to get the period size for latency: %s", snd_strerror(err)); | |
+ ALOGE("Unable to get the period size for latency: %s", snd_strerror(err)); | |
goto done; | |
} | |
bufferSize = periodSize * 4; | |
@@ -316,27 +316,27 @@ status_t setHardwareParams(alsa_handle_t *handle) | |
err = snd_pcm_hw_params_set_buffer_size_near(handle->handle, | |
hardwareParams, &bufferSize); | |
if (err < 0) { | |
- LOGE("Unable to set the buffer size for latency: %s", snd_strerror(err)); | |
+ ALOGE("Unable to set the buffer size for latency: %s", snd_strerror(err)); | |
goto done; | |
} | |
} else { | |
// OK, we got buffer time near what we expect. See what that did for bufferSize. | |
err = snd_pcm_hw_params_get_buffer_size(hardwareParams, &bufferSize); | |
if (err < 0) { | |
- LOGE("Unable to get the buffer size for latency: %s", snd_strerror(err)); | |
+ ALOGE("Unable to get the buffer size for latency: %s", snd_strerror(err)); | |
goto done; | |
} | |
// Does set_buffer_time_near change the passed value? It should. | |
err = snd_pcm_hw_params_get_buffer_time(hardwareParams, &latency, NULL); | |
if (err < 0) { | |
- LOGE("Unable to get the buffer time for latency: %s", snd_strerror(err)); | |
+ ALOGE("Unable to get the buffer time for latency: %s", snd_strerror(err)); | |
goto done; | |
} | |
unsigned int periodTime = latency / 4; | |
err = snd_pcm_hw_params_set_period_time_near(handle->handle, | |
hardwareParams, &periodTime, NULL); | |
if (err < 0) { | |
- LOGE("Unable to set the period time for latency: %s", snd_strerror(err)); | |
+ ALOGE("Unable to set the period time for latency: %s", snd_strerror(err)); | |
goto done; | |
} | |
} | |
@@ -349,7 +349,7 @@ status_t setHardwareParams(alsa_handle_t *handle) | |
// Commit the hardware parameters back to the device. | |
err = snd_pcm_hw_params(handle->handle, hardwareParams); | |
- if (err < 0) LOGE("Unable to set hardware parameters: %s", snd_strerror(err)); | |
+ if (err < 0) ALOGE("Unable to set hardware parameters: %s", snd_strerror(err)); | |
done: | |
snd_pcm_hw_params_free(hardwareParams); | |
@@ -374,7 +374,7 @@ status_t setSoftwareParams(alsa_handle_t *handle) | |
// Get the current software parameters | |
err = snd_pcm_sw_params_current(handle->handle, softwareParams); | |
if (err < 0) { | |
- LOGE("Unable to get software parameters: %s", snd_strerror(err)); | |
+ ALOGE("Unable to get software parameters: %s", snd_strerror(err)); | |
goto done; | |
} | |
@@ -396,7 +396,7 @@ status_t setSoftwareParams(alsa_handle_t *handle) | |
err = snd_pcm_sw_params_set_start_threshold(handle->handle, softwareParams, | |
startThreshold); | |
if (err < 0) { | |
- LOGE("Unable to set start threshold to %lu frames: %s", | |
+ ALOGE("Unable to set start threshold to %lu frames: %s", | |
startThreshold, snd_strerror(err)); | |
goto done; | |
} | |
@@ -404,7 +404,7 @@ status_t setSoftwareParams(alsa_handle_t *handle) | |
err = snd_pcm_sw_params_set_stop_threshold(handle->handle, softwareParams, | |
stopThreshold); | |
if (err < 0) { | |
- LOGE("Unable to set stop threshold to %lu frames: %s", | |
+ ALOGE("Unable to set stop threshold to %lu frames: %s", | |
stopThreshold, snd_strerror(err)); | |
goto done; | |
} | |
@@ -414,14 +414,14 @@ status_t setSoftwareParams(alsa_handle_t *handle) | |
err = snd_pcm_sw_params_set_avail_min(handle->handle, softwareParams, | |
periodSize); | |
if (err < 0) { | |
- LOGE("Unable to configure available minimum to %lu: %s", | |
+ ALOGE("Unable to configure available minimum to %lu: %s", | |
periodSize, snd_strerror(err)); | |
goto done; | |
} | |
// Commit the software parameters back to the device. | |
err = snd_pcm_sw_params(handle->handle, softwareParams); | |
- if (err < 0) LOGE("Unable to configure software parameters: %s", | |
+ if (err < 0) ALOGE("Unable to configure software parameters: %s", | |
snd_strerror(err)); | |
done: | |
@@ -468,7 +468,7 @@ static status_t s_open(alsa_handle_t *handle, uint32_t devices, int mode, uint32 | |
// | |
s_close(handle); | |
- LOGD("open called for devices %08x in mode %d...", devices, mode); | |
+ ALOGD("open called for devices %08x in mode %d...", devices, mode); | |
const char *stream = streamName(handle); | |
const char *devName = deviceName(handle, devices, mode); | |
@@ -497,7 +497,7 @@ static status_t s_open(alsa_handle_t *handle, uint32_t devices, int mode, uint32 | |
} | |
if (err < 0) { | |
- LOGE("Failed to Initialize any ALSA %s device: %s", | |
+ ALOGE("Failed to Initialize any ALSA %s device: %s", | |
stream, strerror(err)); | |
return NO_INIT; | |
} | |
@@ -506,7 +506,7 @@ static status_t s_open(alsa_handle_t *handle, uint32_t devices, int mode, uint32 | |
if (err == NO_ERROR) err = setSoftwareParams(handle); | |
- LOGI("Initialized ALSA %s device %s", stream, devName); | |
+ ALOGI("Initialized ALSA %s device %s", stream, devName); | |
handle->curDev = devices; | |
handle->curMode = mode; | |
@@ -543,7 +543,7 @@ static status_t s_standby(alsa_handle_t *handle) | |
static status_t s_route(alsa_handle_t *handle, uint32_t devices, int mode) | |
{ | |
- LOGD("route called for devices %08x in mode %d...", devices, mode); | |
+ ALOGD("route called for devices %08x in mode %d...", devices, mode); | |
if (handle->handle && handle->curDev == devices && handle->curMode == mode) return NO_ERROR; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment