diff options
author | Andrei Emeltchenko <andrei.emeltchenko@intel.com> | 2014-11-05 10:41:17 +0200 |
---|---|---|
committer | Szymon Janc <szymon.janc@tieto.com> | 2014-11-05 12:25:11 +0100 |
commit | ab7f3972887cd3a04cd2fc2ecd1452c9e3537151 (patch) | |
tree | 91ed8cd1655aafc9e810daefdbf818e5c85c2670 /android/hal-sco.c | |
parent | faf73e5b2829c7468d88f9b275381a024c2dde0a (diff) | |
download | bluez-ab7f3972887cd3a04cd2fc2ecd1452c9e3537151.tar.gz |
android/hal-sco: Remove deprecated API usage
Instead of deprecated functions use new ones. Fixes deprecation warnings
during build.
Diffstat (limited to 'android/hal-sco.c')
-rw-r--r-- | android/hal-sco.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/android/hal-sco.c b/android/hal-sco.c index d9c9a68e9..ca3022e0f 100644 --- a/android/hal-sco.c +++ b/android/hal-sco.c @@ -438,7 +438,11 @@ static ssize_t out_write(struct audio_stream_out *stream, const void *buffer, size_t bytes) { struct sco_stream_out *out = (struct sco_stream_out *) stream; +#if ANDROID_VERSION >= PLATFORM_VER(5, 0, 0) + size_t frame_num = bytes / audio_stream_out_frame_size(stream); +#else size_t frame_num = bytes / audio_stream_frame_size(&out->stream.common); +#endif size_t output_frame_num = frame_num; void *send_buf = out->downmix_buf; size_t total; @@ -507,8 +511,13 @@ static int out_set_sample_rate(struct audio_stream *stream, uint32_t rate) static size_t out_get_buffer_size(const struct audio_stream *stream) { struct sco_stream_out *out = (struct sco_stream_out *) stream; +#if ANDROID_VERSION >= PLATFORM_VER(5, 0, 0) + size_t size = audio_stream_out_frame_size(&out->stream) * + out->cfg.frame_num; +#else size_t size = audio_stream_frame_size(&out->stream.common) * out->cfg.frame_num; +#endif /* buffer size without resampling */ if (out->cfg.rate == AUDIO_STREAM_SCO_RATE) @@ -880,8 +889,13 @@ static int in_set_sample_rate(struct audio_stream *stream, uint32_t rate) static size_t in_get_buffer_size(const struct audio_stream *stream) { struct sco_stream_in *in = (struct sco_stream_in *) stream; +#if ANDROID_VERSION >= PLATFORM_VER(5, 0, 0) + size_t size = audio_stream_in_frame_size(&in->stream) * + in->cfg.frame_num; +#else size_t size = audio_stream_frame_size(&in->stream.common) * in->cfg.frame_num; +#endif /* buffer size without resampling */ if (in->cfg.rate == AUDIO_STREAM_SCO_RATE) @@ -1024,7 +1038,11 @@ static ssize_t in_read(struct audio_stream_in *stream, void *buffer, size_t bytes) { struct sco_stream_in *in = (struct sco_stream_in *) stream; +#if ANDROID_VERSION >= PLATFORM_VER(5, 0, 0) + size_t frame_size = audio_stream_in_frame_size(&in->stream); +#else size_t frame_size = audio_stream_frame_size(&stream->common); +#endif size_t frame_num = bytes / frame_size; size_t input_frame_num = frame_num; void *read_buf = buffer; |