audioflinger: define MMAP HAL Stream control interface
Added definition of MmapStreamInterface used by Oboe service
to open, configure and control MMAP streams at the audio HAl.
This interface is implemented by audioflinger and abstracts the details
of interacting with audio policy manager and audio HAL from Oboe service.
A callback interface MmapStreamCallback is also defiend to communicate
volume and routing changes back to Oboe service.
Bug: 33398120
Test: build
Change-Id: If953d44903aaa4eb17ff16f1922ca16e5e0e0a87
diff --git a/include/media/MmapStreamCallback.h b/include/media/MmapStreamCallback.h
new file mode 100644
index 0000000..8098e79
--- /dev/null
+++ b/include/media/MmapStreamCallback.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_AUDIO_MMAP_STREAM_CALLBACK_H
+#define ANDROID_AUDIO_MMAP_STREAM_CALLBACK_H
+
+#include <system/audio.h>
+#include <utils/Errors.h>
+#include <utils/RefBase.h>
+
+namespace android {
+
+
+class MmapStreamCallback : public virtual RefBase {
+ public:
+
+ /**
+ * The mmap stream should be torn down because conditions that permitted its creation with
+ * the requested parameters have changed and do not allow it to operate with the requested
+ * constraints any more.
+ */
+ virtual void onTearDown() = 0;
+
+ /**
+ * The volume to be applied to the use case specified when opening the stream has changed
+ * \param[in] channels a channel mask containing all channels the volume should be applied to.
+ * \param[in] values the volume values to be applied to each channel. The size of the vector
+ * should correspond to the channel count retrieved with
+ * audio_channel_count_from_in_mask() or audio_channel_count_from_out_mask()
+ */
+ virtual void onVolumeChanged(audio_channel_mask_t channels, Vector<float> values) = 0;
+
+ /**
+ * The device the stream is routed to/from has changed
+ * \param[in] onRoutingChanged the unique device ID of the new device.
+ */
+ virtual void onRoutingChanged(audio_port_handle_t deviceId) = 0;
+
+ protected:
+ MmapStreamCallback() {}
+ virtual ~MmapStreamCallback() {}
+};
+
+
+} // namespace android
+
+#endif // ANDROID_AUDIO_MMAP_STREAM_CALLBACK_H