From 9be7bde296fdf601ffe16236bf84106142e1e276 Mon Sep 17 00:00:00 2001 From: Kevin Rocard Date: Tue, 20 Nov 2018 17:15:39 -0800 Subject: [PATCH] Audio V5: move Stream Metadata to common So that it can be used by the Bluetooth HAL. Test: compile Change-Id: I2e2b1e12e1f837183c4edbd1d330a13a67d1ecaf Signed-off-by: Kevin Rocard --- audio/5.0/types.hal | 33 ------------------- audio/common/5.0/types.hal | 33 +++++++++++++++++++ .../default/include/core/default/Device.h | 5 ++- .../functional/4.0/AudioPrimaryHidlHalUtils.h | 5 +++ 4 files changed, 42 insertions(+), 34 deletions(-) diff --git a/audio/5.0/types.hal b/audio/5.0/types.hal index f58bfb0a77..988f584b62 100644 --- a/audio/5.0/types.hal +++ b/audio/5.0/types.hal @@ -122,39 +122,6 @@ enum MessageQueueFlagBits : uint32_t { NOT_FULL = 1 << 1 }; -/** Metadata of a playback track for a StreamOut. */ -struct PlaybackTrackMetadata { - AudioUsage usage; - AudioContentType contentType; - /** - * Positive linear gain applied to the track samples. 0 being muted and 1 is no attenuation, - * 2 means double amplification... - * Must not be negative. - */ - float gain; -}; - -/** Metadatas of the source of a StreamOut. */ -struct SourceMetadata { - vec tracks; -}; - -/** Metadata of a record track for a StreamIn. */ -struct RecordTrackMetadata { - AudioSource source; - /** - * Positive linear gain applied to the track samples. 0 being muted and 1 is no attenuation, - * 2 means double amplification... - * Must not be negative. - */ - float gain; -}; - -/** Metadatas of the source of a StreamIn. */ -struct SinkMetadata { - vec tracks; -}; - /* * Microphone information * diff --git a/audio/common/5.0/types.hal b/audio/common/5.0/types.hal index eb09b1fa00..2ce2929dce 100644 --- a/audio/common/5.0/types.hal +++ b/audio/common/5.0/types.hal @@ -706,6 +706,39 @@ struct AudioConfig { uint64_t frameCount; }; +/** Metadata of a playback track for a StreamOut. */ +struct PlaybackTrackMetadata { + AudioUsage usage; + AudioContentType contentType; + /** + * Positive linear gain applied to the track samples. 0 being muted and 1 is no attenuation, + * 2 means double amplification... + * Must not be negative. + */ + float gain; +}; + +/** Metadatas of the source of a StreamOut. */ +struct SourceMetadata { + vec tracks; +}; + +/** Metadata of a record track for a StreamIn. */ +struct RecordTrackMetadata { + AudioSource source; + /** + * Positive linear gain applied to the track samples. 0 being muted and 1 is no attenuation, + * 2 means double amplification... + * Must not be negative. + */ + float gain; +}; + +/** Metadatas of the source of a StreamIn. */ +struct SinkMetadata { + vec tracks; +}; + /* * diff --git a/audio/core/all-versions/default/include/core/default/Device.h b/audio/core/all-versions/default/include/core/default/Device.h index 75ae8d3520..9975d5bdeb 100644 --- a/audio/core/all-versions/default/include/core/default/Device.h +++ b/audio/core/all-versions/default/include/core/default/Device.h @@ -60,9 +60,12 @@ using ::android::hardware::audio::CPP_VERSION::IStreamOut; using ::android::hardware::audio::CPP_VERSION::ParameterValue; using ::android::hardware::audio::CPP_VERSION::Result; -#if MAJOR_VERSION >= 4 +#if MAJOR_VERSION == 4 using ::android::hardware::audio::CPP_VERSION::SinkMetadata; using ::android::hardware::audio::CPP_VERSION::SourceMetadata; +#elif MAJOR_VERSION >= 5 +using ::android::hardware::audio::common::CPP_VERSION::SinkMetadata; +using ::android::hardware::audio::common::CPP_VERSION::SourceMetadata; #endif struct Device : public IDevice, public ParametersUtil { diff --git a/audio/core/all-versions/vts/functional/4.0/AudioPrimaryHidlHalUtils.h b/audio/core/all-versions/vts/functional/4.0/AudioPrimaryHidlHalUtils.h index c30f3785c7..8415053ffc 100644 --- a/audio/core/all-versions/vts/functional/4.0/AudioPrimaryHidlHalUtils.h +++ b/audio/core/all-versions/vts/functional/4.0/AudioPrimaryHidlHalUtils.h @@ -35,8 +35,13 @@ using Rotation = ::android::hardware::audio::CPP_VERSION::IPrimaryDevice::Rotati using ::android::hardware::audio::common::CPP_VERSION::AudioContentType; using ::android::hardware::audio::common::CPP_VERSION::AudioUsage; using ::android::hardware::audio::CPP_VERSION::MicrophoneInfo; +#if MAJOR_VERSION < 5 using ::android::hardware::audio::CPP_VERSION::SinkMetadata; using ::android::hardware::audio::CPP_VERSION::SourceMetadata; +#else +using ::android::hardware::audio::common::CPP_VERSION::SinkMetadata; +using ::android::hardware::audio::common::CPP_VERSION::SourceMetadata; +#endif struct Parameters { template