summaryrefslogtreecommitdiffstats
path: root/audio/audio_hw_hal.cpp
diff options
context:
space:
mode:
authorJohn Grossman <johngro@google.com>2011-08-29 10:56:08 -0700
committerMike Lockwood <lockwood@android.com>2011-10-27 17:35:47 -0400
commit5b71e6fd76fe244719cb5a3f9ac24572acd9a3ca (patch)
treedd5037d1baa012ac981b89a2a9a900f933edf960 /audio/audio_hw_hal.cpp
parent617c80a82e5620b2f16348e4bd3d7fc3b76e9021 (diff)
downloadhardware_libhardware_legacy-5b71e6fd76fe244719cb5a3f9ac24572acd9a3ca.zip
hardware_libhardware_legacy-5b71e6fd76fe244719cb5a3f9ac24572acd9a3ca.tar.gz
hardware_libhardware_legacy-5b71e6fd76fe244719cb5a3f9ac24572acd9a3ca.tar.bz2
Add an implementation of get_next_write_timestamp.
Add a default implementation of get_next_write_timestamp to the C <--> C++ legacy audio HAL implementation allowing HALs using the legacy C++ AudioStreamOut to overload and implement get_next_write_timestamp. Default implementation returns INVALID_OPERATION to indicate that the functionality is not supported. Change-Id: I087347649e9ba186a74cb34aaadf989bf90720fe
Diffstat (limited to 'audio/audio_hw_hal.cpp')
-rw-r--r--audio/audio_hw_hal.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/audio/audio_hw_hal.cpp b/audio/audio_hw_hal.cpp
index f249f88..dd56c80 100644
--- a/audio/audio_hw_hal.cpp
+++ b/audio/audio_hw_hal.cpp
@@ -162,6 +162,14 @@ static int out_get_render_position(const struct audio_stream_out *stream,
return out->legacy_out->getRenderPosition(dsp_frames);
}
+static int out_get_next_write_timestamp(const struct audio_stream_out *stream,
+ int64_t *timestamp)
+{
+ const struct legacy_stream_out *out =
+ reinterpret_cast<const struct legacy_stream_out *>(stream);
+ return out->legacy_out->getNextWriteTimestamp(timestamp);
+}
+
static int out_add_audio_effect(const struct audio_stream *stream, effect_handle_t effect)
{
return 0;
@@ -433,6 +441,7 @@ static int adev_open_output_stream(struct audio_hw_device *dev,
out->stream.set_volume = out_set_volume;
out->stream.write = out_write;
out->stream.get_render_position = out_get_render_position;
+ out->stream.get_next_write_timestamp = out_get_next_write_timestamp;
*stream_out = &out->stream;
return 0;