OSDN Git Service

am e88fe446: am b4b0608b: Merge "legacy audio policy: check string parameters before...
[android-x86/hardware-libhardware_legacy.git] / audio / A2dpAudioInterface.cpp
index 2d78858..4ab52ba 100644 (file)
@@ -38,7 +38,7 @@ static const char *sA2dpWakeLock = "A2dpOutputStream";
 //    AudioHardwareInterface* hw = 0;
 //
 //    hw = AudioHardwareInterface::create();
-//    LOGD("new A2dpAudioInterface(hw: %p)", hw);
+//    ALOGD("new A2dpAudioInterface(hw: %p)", hw);
 //    hw = new A2dpAudioInterface(hw);
 //    return hw;
 //}
@@ -63,8 +63,8 @@ status_t A2dpAudioInterface::initCheck()
 AudioStreamOut* A2dpAudioInterface::openOutputStream(
         uint32_t devices, int *format, uint32_t *channels, uint32_t *sampleRate, status_t *status)
 {
-    if (!AudioSystem::isA2dpDevice((AudioSystem::audio_devices)devices)) {
-        LOGV("A2dpAudioInterface::openOutputStream() open HW device: %x", devices);
+    if (!audio_is_a2dp_out_device(devices)) {
+        ALOGV("A2dpAudioInterface::openOutputStream() open HW device: %x", devices);
         return mHardwareInterface->openOutputStream(devices, format, channels, sampleRate, status);
     }
 
@@ -137,7 +137,7 @@ status_t A2dpAudioInterface::setParameters(const String8& keyValuePairs)
     String8 key;
     status_t status = NO_ERROR;
 
-    LOGV("setParameters() %s", keyValuePairs.string());
+    ALOGV("setParameters() %s", keyValuePairs.string());
 
     key = "bluetooth_enabled";
     if (param.get(key, value) == NO_ERROR) {
@@ -195,7 +195,7 @@ String8 A2dpAudioInterface::getParameters(const String8& keys)
         keyValuePairs += mHardwareInterface->getParameters(param.toString());
     }
 
-    LOGV("getParameters() %s", keyValuePairs.string());
+    ALOGV("getParameters() %s", keyValuePairs.string());
     return keyValuePairs;
 }
 
@@ -239,7 +239,7 @@ status_t A2dpAudioInterface::A2dpAudioStreamOut::set(
     uint32_t lChannels = pChannels ? *pChannels : 0;
     uint32_t lRate = pRate ? *pRate : 0;
 
-    LOGD("A2dpAudioStreamOut::set %x, %d, %d, %d\n", device, lFormat, lChannels, lRate);
+    ALOGD("A2dpAudioStreamOut::set %x, %d, %d, %d\n", device, lFormat, lChannels, lRate);
 
     // fix up defaults
     if (lFormat == 0) lFormat = format();
@@ -267,9 +267,9 @@ status_t A2dpAudioInterface::A2dpAudioStreamOut::set(
 
 A2dpAudioInterface::A2dpAudioStreamOut::~A2dpAudioStreamOut()
 {
-    LOGV("A2dpAudioStreamOut destructor");
+    ALOGV("A2dpAudioStreamOut destructor");
     close();
-    LOGV("A2dpAudioStreamOut destructor returning from close()");
+    ALOGV("A2dpAudioStreamOut destructor returning from close()");
 }
 
 ssize_t A2dpAudioInterface::A2dpAudioStreamOut::write(const void* buffer, size_t bytes)
@@ -281,7 +281,7 @@ ssize_t A2dpAudioInterface::A2dpAudioStreamOut::write(const void* buffer, size_t
         size_t remaining = bytes;
 
         if (!mBluetoothEnabled || mClosing || mSuspended) {
-            LOGV("A2dpAudioStreamOut::write(), but bluetooth disabled \
+            ALOGV("A2dpAudioStreamOut::write(), but bluetooth disabled \
                    mBluetoothEnabled %d, mClosing %d, mSuspended %d",
                     mBluetoothEnabled, mClosing, mSuspended);
             goto Error;
@@ -301,7 +301,7 @@ ssize_t A2dpAudioInterface::A2dpAudioStreamOut::write(const void* buffer, size_t
         while (remaining > 0 && retries) {
             status = a2dp_write(mData, buffer, remaining);
             if (status < 0) {
-                LOGE("a2dp_write failed err: %d\n", status);
+                ALOGE("a2dp_write failed err: %d\n", status);
                 goto Error;
             }
             if (status == 0) {
@@ -316,7 +316,7 @@ ssize_t A2dpAudioInterface::A2dpAudioStreamOut::write(const void* buffer, size_t
         // NOTE: It is likely that the A2DP headset is being disconnected
         nsecs_t now = systemTime();
         if ((uint32_t)ns2us(now - mLastWriteTime) < (mBufferDurationUs >> 2)) {
-            LOGV("A2DP sink runs too fast");
+            ALOGV("A2DP sink runs too fast");
             usleep(mBufferDurationUs - (uint32_t)ns2us(now - mLastWriteTime));
         }
         mLastWriteTime = now;
@@ -338,7 +338,7 @@ status_t A2dpAudioInterface::A2dpAudioStreamOut::init()
     if (!mData) {
         status_t status = a2dp_init(44100, 2, &mData);
         if (status < 0) {
-            LOGE("a2dp_init failed err: %d\n", status);
+            ALOGE("a2dp_init failed err: %d\n", status);
             mData = NULL;
             return status;
         }
@@ -359,7 +359,7 @@ status_t A2dpAudioInterface::A2dpAudioStreamOut::standby_l()
     int result = NO_ERROR;
 
     if (!mStandby) {
-        LOGV_IF(mClosing || !mBluetoothEnabled, "Standby skip stop: closing %d enabled %d",
+        ALOGV_IF(mClosing || !mBluetoothEnabled, "Standby skip stop: closing %d enabled %d",
                 mClosing, mBluetoothEnabled);
         if (!mClosing && mBluetoothEnabled) {
             result = a2dp_stop(mData);
@@ -378,7 +378,7 @@ status_t A2dpAudioInterface::A2dpAudioStreamOut::setParameters(const String8& ke
     String8 key = String8("a2dp_sink_address");
     status_t status = NO_ERROR;
     int device;
-    LOGV("A2dpAudioStreamOut::setParameters() %s", keyValuePairs.string());
+    ALOGV("A2dpAudioStreamOut::setParameters() %s", keyValuePairs.string());
 
     if (param.get(key, value) == NO_ERROR) {
         if (value.length() != strlen("00:00:00:00:00:00")) {
@@ -398,7 +398,7 @@ status_t A2dpAudioInterface::A2dpAudioStreamOut::setParameters(const String8& ke
     }
     key = AudioParameter::keyRouting;
     if (param.getInt(key, device) == NO_ERROR) {
-        if (AudioSystem::isA2dpDevice((AudioSystem::audio_devices)device)) {
+        if (audio_is_a2dp_out_device(device)) {
             mDevice = device;
             status = NO_ERROR;
         } else {
@@ -428,7 +428,7 @@ String8 A2dpAudioInterface::A2dpAudioStreamOut::getParameters(const String8& key
         param.addInt(key, (int)mDevice);
     }
 
-    LOGV("A2dpAudioStreamOut::getParameters() %s", param.toString().string());
+    ALOGV("A2dpAudioStreamOut::getParameters() %s", param.toString().string());
     return param.toString();
 }
 
@@ -448,7 +448,7 @@ status_t A2dpAudioInterface::A2dpAudioStreamOut::setAddress(const char* address)
 
 status_t A2dpAudioInterface::A2dpAudioStreamOut::setBluetoothEnabled(bool enabled)
 {
-    LOGD("setBluetoothEnabled %d", enabled);
+    ALOGD("setBluetoothEnabled %d", enabled);
 
     Mutex::Autolock lock(mLock);
 
@@ -461,7 +461,7 @@ status_t A2dpAudioInterface::A2dpAudioStreamOut::setBluetoothEnabled(bool enable
 
 status_t A2dpAudioInterface::A2dpAudioStreamOut::setSuspended(bool onOff)
 {
-    LOGV("setSuspended %d", onOff);
+    ALOGV("setSuspended %d", onOff);
     mSuspended = onOff;
     standby();
     return NO_ERROR;
@@ -470,7 +470,7 @@ status_t A2dpAudioInterface::A2dpAudioStreamOut::setSuspended(bool onOff)
 status_t A2dpAudioInterface::A2dpAudioStreamOut::close()
 {
     Mutex::Autolock lock(mLock);
-    LOGV("A2dpAudioStreamOut::close() calling close_l()");
+    ALOGV("A2dpAudioStreamOut::close() calling close_l()");
     return close_l();
 }
 
@@ -478,7 +478,7 @@ status_t A2dpAudioInterface::A2dpAudioStreamOut::close_l()
 {
     standby_l();
     if (mData) {
-        LOGV("A2dpAudioStreamOut::close_l() calling a2dp_cleanup(mData)");
+        ALOGV("A2dpAudioStreamOut::close_l() calling a2dp_cleanup(mData)");
         a2dp_cleanup(mData);
         mData = NULL;
     }