From 9c140b452a082071d145fcc31637de9d2d2f1be5 Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Tue, 11 Dec 2018 15:52:14 -0800 Subject: [Master port] Audio HAL: Add optional Destination to SinkMetadata This patch ports a change to the HAL interfaces done in master in order to have the same Audio common HAL interface in both AOSP and master. This is needed as the Bluetooth HAL uses the audio common HAL and needs to be frozen in the same state in both AOSP and MASTER. Currently this is used to indicate the output device when the input stream is from an intermediate processing module like MSD. Bug: 124247199 Bug: 120859615 Test: make Change-Id: I60bac5c24a263ab0b8965e9dbf9514445e88c270 Merged-In: I60bac5c24a263ab0b8965e9dbf9514445e88c270 --- audio/common/5.0/Android.bp | 4 ++++ audio/common/5.0/types.hal | 35 ++++++++++++++++++++++++++++++++++- 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/audio/common/5.0/Android.bp b/audio/common/5.0/Android.bp index c17f1442c..86d935475 100644 --- a/audio/common/5.0/Android.bp +++ b/audio/common/5.0/Android.bp @@ -9,6 +9,9 @@ hidl_interface { srcs: [ "types.hal", ], + interfaces: [ + "android.hidl.safe_union@1.0", + ], types: [ "AudioChannelMask", "AudioConfig", @@ -38,6 +41,7 @@ hidl_interface { "AudioSource", "AudioStreamType", "AudioUsage", + "DeviceAddress", "FixedChannelCount", "PlaybackTrackMetadata", "RecordTrackMetadata", diff --git a/audio/common/5.0/types.hal b/audio/common/5.0/types.hal index e5919cbc2..dab74645f 100644 --- a/audio/common/5.0/types.hal +++ b/audio/common/5.0/types.hal @@ -16,6 +16,8 @@ package android.hardware.audio.common@5.0; +import android.hidl.safe_union@1.0; + /* * * IDs and Handles @@ -601,6 +603,29 @@ enum AudioDevice : uint32_t { // Note that the 2.0 IN_ALL* have been moved to helper functions }; +/** + * IEEE 802 MAC address. + */ +typedef uint8_t[6] MacAddress; + +/** + * Specifies a device address in case when several devices of the same type + * can be connected (e.g. BT A2DP, USB). + */ +struct DeviceAddress { + AudioDevice device; // discriminator + union Address { + MacAddress mac; // used for BLUETOOTH_A2DP_* + uint8_t[4] ipv4; // used for IP + struct Alsa { + int32_t card; + int32_t device; + } alsa; // used for USB_* + } address; + string busAddress; // used for BUS + string rSubmixAddress; // used for REMOTE_SUBMIX +}; + /** * The audio output flags serve two purposes: * @@ -748,9 +773,17 @@ struct RecordTrackMetadata { * Must not be negative. */ float gain; + /** + * Indicates the destination of an input stream, can be left unspecified. + */ + safe_union Destination { + Monostate unspecified; + DeviceAddress device; + }; + Destination destination; }; -/** Metadatas of the source of a StreamIn. */ +/** Metadatas of the sink of a StreamIn. */ struct SinkMetadata { vec tracks; }; -- cgit v1.2.3