summaryrefslogtreecommitdiffstats
path: root/libs/audioflinger
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2009-01-15 16:12:10 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2009-01-15 16:12:10 -0800
commit8a7a67538a9977c892389bfcde76a8372aa0b56c (patch)
tree0782f82f223ddeafa9b08bd2121ded38212f67f7 /libs/audioflinger
parent276293246ea9cbc0a578a7697cc48930376ec0e9 (diff)
downloadframeworks_native-8a7a67538a9977c892389bfcde76a8372aa0b56c.zip
frameworks_native-8a7a67538a9977c892389bfcde76a8372aa0b56c.tar.gz
frameworks_native-8a7a67538a9977c892389bfcde76a8372aa0b56c.tar.bz2
auto import from //branches/cupcake/...@126645
Diffstat (limited to 'libs/audioflinger')
-rw-r--r--libs/audioflinger/A2dpAudioInterface.cpp30
-rw-r--r--libs/audioflinger/A2dpAudioInterface.h9
-rw-r--r--libs/audioflinger/Android.mk4
-rw-r--r--libs/audioflinger/AudioDumpInterface.h2
-rw-r--r--libs/audioflinger/AudioFlinger.cpp9
-rw-r--r--libs/audioflinger/AudioFlinger.h2
-rw-r--r--libs/audioflinger/AudioHardwareGeneric.h2
-rw-r--r--libs/audioflinger/AudioHardwareStub.h2
8 files changed, 49 insertions, 11 deletions
diff --git a/libs/audioflinger/A2dpAudioInterface.cpp b/libs/audioflinger/A2dpAudioInterface.cpp
index b2a8e96..7242575 100644
--- a/libs/audioflinger/A2dpAudioInterface.cpp
+++ b/libs/audioflinger/A2dpAudioInterface.cpp
@@ -92,6 +92,14 @@ status_t A2dpAudioInterface::getMicMute(bool* state)
status_t A2dpAudioInterface::setParameter(const char *key, const char *value)
{
LOGD("setParameter %s,%s\n", key, value);
+
+ if (!key || !value)
+ return -EINVAL;
+
+ if (strcmp(key, "a2dp_sink_address") == 0) {
+ return mOutput->setAddress(value);
+ }
+
return 0;
}
@@ -121,6 +129,8 @@ A2dpAudioInterface::A2dpAudioStreamOut::A2dpAudioStreamOut() :
mFd(-1), mStandby(false), mStartCount(0), mRetryCount(0), mData(NULL),
mInitialized(false)
{
+ // use any address by default
+ strncpy(mA2dpAddress, "00:00:00:00:00:00", sizeof(mA2dpAddress));
}
status_t A2dpAudioInterface::A2dpAudioStreamOut::set(
@@ -154,7 +164,7 @@ ssize_t A2dpAudioInterface::A2dpAudioStreamOut::write(const void* buffer, size_t
size_t remaining = bytes;
if (!mInitialized) {
- status = a2dp_init("00:00:00:00:00:00", 44100, 2, &mData);
+ status = a2dp_init(mA2dpAddress, 44100, 2, &mData);
if (status < 0) {
LOGE("a2dp_init failed err: %d\n", status);
goto Error;
@@ -196,6 +206,24 @@ status_t A2dpAudioInterface::A2dpAudioStreamOut::standby()
return result;
}
+status_t A2dpAudioInterface::A2dpAudioStreamOut::setAddress(const char* address)
+{
+ if (strlen(address) < sizeof(mA2dpAddress))
+ return -EINVAL;
+
+ if (strcmp(address, mA2dpAddress)) {
+ strcpy(mA2dpAddress, address);
+
+ if (mInitialized) {
+ a2dp_cleanup(mData);
+ mData = NULL;
+ mInitialized = false;
+ }
+ }
+
+ return NO_ERROR;
+}
+
status_t A2dpAudioInterface::A2dpAudioStreamOut::dump(int fd, const Vector<String16>& args)
{
return NO_ERROR;
diff --git a/libs/audioflinger/A2dpAudioInterface.h b/libs/audioflinger/A2dpAudioInterface.h
index b8119a1..2197d0e 100644
--- a/libs/audioflinger/A2dpAudioInterface.h
+++ b/libs/audioflinger/A2dpAudioInterface.h
@@ -22,7 +22,7 @@
#include <utils/threads.h>
-#include <hardware/AudioHardwareBase.h>
+#include <hardware_legacy/AudioHardwareBase.h>
namespace android {
@@ -74,7 +74,7 @@ private:
uint32_t sampleRate);
virtual uint32_t sampleRate() const { return 44100; }
// SBC codec wants a multiple of 512
- virtual size_t bufferSize() const { return 512 * 30; }
+ virtual size_t bufferSize() const { return 512 * 20; }
virtual int channelCount() const { return 2; }
virtual int format() const { return AudioSystem::PCM_16_BIT; }
virtual uint32_t latency() const { return ((1000*channelCount()*bufferSize())/frameSize())/sampleRate() + 200; }
@@ -84,10 +84,15 @@ private:
virtual status_t dump(int fd, const Vector<String16>& args);
private:
+ friend class A2dpAudioInterface;
+ status_t setAddress(const char* address);
+
+ private:
int mFd;
bool mStandby;
int mStartCount;
int mRetryCount;
+ char mA2dpAddress[20];
void* mData;
bool mInitialized;
};
diff --git a/libs/audioflinger/Android.mk b/libs/audioflinger/Android.mk
index d16e3e1..50d516b 100644
--- a/libs/audioflinger/Android.mk
+++ b/libs/audioflinger/Android.mk
@@ -12,7 +12,7 @@ LOCAL_SHARED_LIBRARIES := \
libcutils \
libutils \
libmedia \
- libhardware
+ libhardware_legacy
ifeq ($(strip $(BOARD_USES_GENERIC_AUDIO)),true)
LOCAL_CFLAGS += -DGENERIC_AUDIO
@@ -35,7 +35,7 @@ LOCAL_SHARED_LIBRARIES := \
libcutils \
libutils \
libmedia \
- libhardware
+ libhardware_legacy
ifeq ($(strip $(BOARD_USES_GENERIC_AUDIO)),true)
LOCAL_STATIC_LIBRARIES += libaudiointerface
diff --git a/libs/audioflinger/AudioDumpInterface.h b/libs/audioflinger/AudioDumpInterface.h
index 82b5250..42204d6 100644
--- a/libs/audioflinger/AudioDumpInterface.h
+++ b/libs/audioflinger/AudioDumpInterface.h
@@ -21,7 +21,7 @@
#include <stdint.h>
#include <sys/types.h>
-#include <hardware/AudioHardwareBase.h>
+#include <hardware_legacy/AudioHardwareBase.h>
namespace android {
diff --git a/libs/audioflinger/AudioFlinger.cpp b/libs/audioflinger/AudioFlinger.cpp
index d4692ad..51b800c 100644
--- a/libs/audioflinger/AudioFlinger.cpp
+++ b/libs/audioflinger/AudioFlinger.cpp
@@ -38,7 +38,7 @@
#include <private/media/AudioTrackShared.h>
-#include <hardware/AudioHardwareInterface.h>
+#include <hardware_legacy/AudioHardwareInterface.h>
#include "AudioMixer.h"
#include "AudioFlinger.h"
@@ -832,10 +832,15 @@ bool AudioFlinger::isMusicActive() const
status_t AudioFlinger::setParameter(const char* key, const char* value)
{
- status_t result;
+ status_t result, result2;
AutoMutex lock(mHardwareLock);
mHardwareStatus = AUDIO_SET_PARAMETER;
result = mAudioHardware->setParameter(key, value);
+ if (mA2dpAudioInterface) {
+ result2 = mA2dpAudioInterface->setParameter(key, value);
+ if (result2)
+ result = result2;
+ }
mHardwareStatus = AUDIO_HW_IDLE;
return result;
}
diff --git a/libs/audioflinger/AudioFlinger.h b/libs/audioflinger/AudioFlinger.h
index 7c84e62..90bc72d 100644
--- a/libs/audioflinger/AudioFlinger.h
+++ b/libs/audioflinger/AudioFlinger.h
@@ -33,7 +33,7 @@
#include <utils/KeyedVector.h>
#include <utils/SortedVector.h>
-#include <hardware/AudioHardwareInterface.h>
+#include <hardware_legacy/AudioHardwareInterface.h>
#include "AudioBufferProvider.h"
diff --git a/libs/audioflinger/AudioHardwareGeneric.h b/libs/audioflinger/AudioHardwareGeneric.h
index bc006b8..a7822e1 100644
--- a/libs/audioflinger/AudioHardwareGeneric.h
+++ b/libs/audioflinger/AudioHardwareGeneric.h
@@ -23,7 +23,7 @@
#include <utils/threads.h>
-#include <hardware/AudioHardwareBase.h>
+#include <hardware_legacy/AudioHardwareBase.h>
namespace android {
diff --git a/libs/audioflinger/AudioHardwareStub.h b/libs/audioflinger/AudioHardwareStub.h
index 7ec5b95..24736ed 100644
--- a/libs/audioflinger/AudioHardwareStub.h
+++ b/libs/audioflinger/AudioHardwareStub.h
@@ -21,7 +21,7 @@
#include <stdint.h>
#include <sys/types.h>
-#include <hardware/AudioHardwareBase.h>
+#include <hardware_legacy/AudioHardwareBase.h>
namespace android {