Abstract away access to audio streams HAL in AudioFlinger
In this CL all direct access to audio_stream_t, audio_stream_out_t, and
audio_stream_in_t their functions is encapsulated within the new
hierarchy of Stream[In|Out]HalLocal classes. AudioFlinger uses
interface classes Stream[In|Out]HalInterface to access these functions.
Note that NBAIO still receives raw HAL stream handles and needs to be
converted separately.
Bug: 30222631
Test: manual with Loopback app
Change-Id: I6388cfa2006791c9c0aa7bb186719209726a2d48
diff --git a/services/audioflinger/DeviceHalInterface.h b/services/audioflinger/DeviceHalInterface.h
index ea682f0..b5767ef 100644
--- a/services/audioflinger/DeviceHalInterface.h
+++ b/services/audioflinger/DeviceHalInterface.h
@@ -24,12 +24,12 @@
namespace android {
+class StreamInHalInterface;
+class StreamOutHalInterface;
+
class DeviceHalInterface : public RefBase
{
public:
- // The destructor automatically closes the device.
- virtual ~DeviceHalInterface() {}
-
// Sets the value of 'devices' to a bitmask of 1 or more values of audio_devices_t.
virtual status_t getSupportedDevices(uint32_t *devices) = 0;
@@ -69,26 +69,24 @@
// Creates and opens the audio hardware output stream. The stream is closed
// by releasing all references to the returned object.
- // FIXME: Enable when StreamOutHalInterface is introduced.
- // virtual status_t openOutputStream(
- // audio_io_handle_t handle,
- // audio_devices_t devices,
- // audio_output_flags_t flags,
- // struct audio_config *config,
- // const char *address,
- // sp<StreamOutHalInterface> *outStream) = 0;
+ virtual status_t openOutputStream(
+ audio_io_handle_t handle,
+ audio_devices_t devices,
+ audio_output_flags_t flags,
+ struct audio_config *config,
+ const char *address,
+ sp<StreamOutHalInterface> *outStream) = 0;
// Creates and opens the audio hardware input stream. The stream is closed
// by releasing all references to the returned object.
- // FIXME: Enable when StreamInHalInterface is introduced.
- // virtual status_t openInputStream(
- // audio_io_handle_t handle,
- // audio_devices_t devices,
- // struct audio_config *config,
- // audio_input_flags_t flags,
- // const char *address,
- // audio_source_t source,
- // sp<StreamInHalInterface> *inStream) = 0;
+ virtual status_t openInputStream(
+ audio_io_handle_t handle,
+ audio_devices_t devices,
+ struct audio_config *config,
+ audio_input_flags_t flags,
+ const char *address,
+ audio_source_t source,
+ sp<StreamInHalInterface> *inStream) = 0;
// Creates an audio patch between several source and sink ports.
virtual status_t createAudioPatch(
@@ -112,6 +110,9 @@
protected:
// Subclasses can not be constructed directly by clients.
DeviceHalInterface() {}
+
+ // The destructor automatically closes the device.
+ virtual ~DeviceHalInterface() {}
};
} // namespace android