summaryrefslogtreecommitdiffstats
path: root/include/media/AudioIoDescriptor.h
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2015-05-01 11:38:42 -0700
committerEric Laurent <elaurent@google.com>2015-05-06 10:14:42 -0700
commit296fb13dd9b5e90d6a05cce897c3b1e7914a478a (patch)
treed3ed4e6ff2902da6f556d038c71605c091b75f64 /include/media/AudioIoDescriptor.h
parent32fa6d0e65dbf956e253a1006e9419dce2fe75c9 (diff)
downloadframeworks_av-296fb13dd9b5e90d6a05cce897c3b1e7914a478a.zip
frameworks_av-296fb13dd9b5e90d6a05cce897c3b1e7914a478a.tar.gz
frameworks_av-296fb13dd9b5e90d6a05cce897c3b1e7914a478a.tar.bz2
Implement audio device callback
Add class AudioSystem::AudioDeviceCallback notifying AudioSystem clients upon device selection change on a given input or output thread. Maintain a list of installed callback per I/O handle in AudioSystem and call registered callbacks when an OPEN of CONFIG_CHANGED event is received on IAudioFlingerClient::ioConfigChanged(). Add methods to AudioTrack and AudioRecord to add and remove device change callbacks. Add methods to AudioTrack and AudioRecord to query currently selected device. ioConfigChanged() events now convey the audio patch describing the input or output thread routing. Fix AudioRecord failure to start when invalidation is handled by start(). Change-Id: I9e938adf025fa712337c63b1e02a8c18f2a20d39
Diffstat (limited to 'include/media/AudioIoDescriptor.h')
-rw-r--r--include/media/AudioIoDescriptor.h21
1 files changed, 20 insertions, 1 deletions
diff --git a/include/media/AudioIoDescriptor.h b/include/media/AudioIoDescriptor.h
index 2437901..c94b738 100644
--- a/include/media/AudioIoDescriptor.h
+++ b/include/media/AudioIoDescriptor.h
@@ -33,12 +33,31 @@ enum audio_io_config_event {
class AudioIoDescriptor : public RefBase {
public:
AudioIoDescriptor() :
+ mIoHandle(AUDIO_IO_HANDLE_NONE),
mSamplingRate(0), mFormat(AUDIO_FORMAT_DEFAULT), mChannelMask(AUDIO_CHANNEL_NONE),
- mFrameCount(0), mLatency(0) {}
+ mFrameCount(0), mLatency(0)
+ {
+ memset(&mPatch, 0, sizeof(struct audio_patch));
+ }
virtual ~AudioIoDescriptor() {}
+ audio_port_handle_t getDeviceId() {
+ if (mPatch.num_sources != 0 && mPatch.num_sinks != 0) {
+ if (mPatch.sources[0].type == AUDIO_PORT_TYPE_MIX) {
+ // this is an output mix
+ // FIXME: the API only returns the first device in case of multiple device selection
+ return mPatch.sinks[0].id;
+ } else {
+ // this is an input mix
+ return mPatch.sources[0].id;
+ }
+ }
+ return AUDIO_PORT_HANDLE_NONE;
+ }
+
audio_io_handle_t mIoHandle;
+ struct audio_patch mPatch;
uint32_t mSamplingRate;
audio_format_t mFormat;
audio_channel_mask_t mChannelMask;