summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Rocard <krocard@google.com>2018-01-24 19:12:06 -0800
committerKevin Rocard <krocard@google.com>2018-02-01 16:17:34 -0800
commit14dbb1edcefae1722a22c8866a6a0c5ee15f5e02 (patch)
treed6de4ffa16ae4419261fc318fb0e2cb02816d40b
parent0fd5bc2dcec7b951d070ae485a34d291ce35e647 (diff)
downloadandroid_hardware_interfaces-14dbb1edcefae1722a22c8866a6a0c5ee15f5e02.tar.gz
android_hardware_interfaces-14dbb1edcefae1722a22c8866a6a0c5ee15f5e02.tar.bz2
android_hardware_interfaces-14dbb1edcefae1722a22c8866a6a0c5ee15f5e02.zip
Audio V4: Forward tracks attributes to the hal
Forward to the HAL the audio usage, audio content types and volume of playback tracks to the stream out they are playing to. Forward to the HAL the audio source and volume of record tracks to the stream in they are playing to. This will allow the HAL to better tune its effects and remove the need to inject a fake effect (volume listener) to get the tracks volume. Bug: 38184704 Test: none Change-Id: Iede0f7aa518608c3b3ce1497f059f672aac109b2 Signed-off-by: Kevin Rocard <krocard@google.com>
-rw-r--r--audio/4.0/IDevice.hal9
-rw-r--r--audio/4.0/IStreamIn.hal6
-rw-r--r--audio/4.0/IStreamOut.hal6
-rw-r--r--audio/4.0/types.hal33
-rw-r--r--audio/common/4.0/types.hal10
5 files changed, 62 insertions, 2 deletions
diff --git a/audio/4.0/IDevice.hal b/audio/4.0/IDevice.hal
index 4bc2d4db0..591e56509 100644
--- a/audio/4.0/IDevice.hal
+++ b/audio/4.0/IDevice.hal
@@ -109,6 +109,8 @@ interface IDevice {
* @param device device type and (if needed) address.
* @param config stream configuration.
* @param flags additional flags.
+ * @param sourceMetadata Description of the audio that will be played.
+ May be used by implementations to configure hardware effects.
* @return retval operation completion status.
* @return outStream created output stream.
* @return suggestedConfig in case of invalid parameters, suggested config.
@@ -117,7 +119,8 @@ interface IDevice {
AudioIoHandle ioHandle,
DeviceAddress device,
AudioConfig config,
- bitfield<AudioOutputFlag> flags) generates (
+ bitfield<AudioOutputFlag> flags,
+ SourceMetadata sourceMetadata) generates (
Result retval,
IStreamOut outStream,
AudioConfig suggestedConfig);
@@ -132,6 +135,8 @@ interface IDevice {
* @param config stream configuration.
* @param flags additional flags.
* @param source source specification.
+ * @param sinkMetadata Description of the audio that is suggested by the client.
+ * May be used by implementations to configure hardware effects.
* @return retval operation completion status.
* @return inStream in case of success, created input stream.
* @return suggestedConfig in case of invalid parameters, suggested config.
@@ -141,7 +146,7 @@ interface IDevice {
DeviceAddress device,
AudioConfig config,
bitfield<AudioInputFlag> flags,
- AudioSource source) generates (
+ SinkMetadata sinkMetadata) generates (
Result retval,
IStreamIn inStream,
AudioConfig suggestedConfig);
diff --git a/audio/4.0/IStreamIn.hal b/audio/4.0/IStreamIn.hal
index ea2826ea3..3b1fd40c5 100644
--- a/audio/4.0/IStreamIn.hal
+++ b/audio/4.0/IStreamIn.hal
@@ -84,6 +84,12 @@ interface IStreamIn extends IStream {
};
/**
+ * Called when the metadata of the stream's sink has been changed.
+ * @param sinkMetadata Description of the audio that is suggested by the clients.
+ */
+ updateSinkMetadata(SinkMetadata sinkMetadata);
+
+ /**
* Set up required transports for receiving audio buffers from the driver.
*
* The transport consists of three message queues:
diff --git a/audio/4.0/IStreamOut.hal b/audio/4.0/IStreamOut.hal
index 02f169730..585bffed6 100644
--- a/audio/4.0/IStreamOut.hal
+++ b/audio/4.0/IStreamOut.hal
@@ -78,6 +78,12 @@ interface IStreamOut extends IStream {
};
/**
+ * Called when the metadata of the stream's source has been changed.
+ * @param sourceMetadata Description of the audio that is played by the clients.
+ */
+ updateSourceMetadata(SourceMetadata sourceMetadata);
+
+ /**
* Set up required transports for passing audio buffers to the driver.
*
* The transport consists of three message queues:
diff --git a/audio/4.0/types.hal b/audio/4.0/types.hal
index 5c95e4be2..1563b36cf 100644
--- a/audio/4.0/types.hal
+++ b/audio/4.0/types.hal
@@ -117,3 +117,36 @@ enum MessageQueueFlagBits : uint32_t {
NOT_EMPTY = 1 << 0,
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<PlaybackTrackMetadata> 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<RecordTrackMetadata> tracks;
+};
diff --git a/audio/common/4.0/types.hal b/audio/common/4.0/types.hal
index e9e717366..b1c15f321 100644
--- a/audio/common/4.0/types.hal
+++ b/audio/common/4.0/types.hal
@@ -671,6 +671,16 @@ enum AudioUsage : int32_t {
ASSISTANT = 16,
};
+/** Type of audio generated by an application. */
+@export(name="audio_content_type_t", value_prefix="AUDIO_CONTENT_TYPE_")
+enum AudioContentType : uint32_t {
+ UNKNOWN = 0,
+ SPEECH = 1,
+ MUSIC = 2,
+ MOVIE = 3,
+ SONIFICATION = 4,
+};
+
/**
* Additional information about the stream passed to hardware decoders.
*/