Eric Laurent | fc23520 | 2016-12-20 18:48:17 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2016 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef ANDROID_AUDIO_MMAP_STREAM_CALLBACK_H |
| 18 | #define ANDROID_AUDIO_MMAP_STREAM_CALLBACK_H |
| 19 | |
Robert Wu | aeb1d00 | 2024-10-30 23:19:44 +0000 | [diff] [blame] | 20 | #include <media/AudioContainers.h> |
Eric Laurent | fc23520 | 2016-12-20 18:48:17 -0800 | [diff] [blame] | 21 | #include <system/audio.h> |
| 22 | #include <utils/Errors.h> |
| 23 | #include <utils/RefBase.h> |
| 24 | |
| 25 | namespace android { |
| 26 | |
| 27 | |
| 28 | class MmapStreamCallback : public virtual RefBase { |
| 29 | public: |
| 30 | |
| 31 | /** |
| 32 | * The mmap stream should be torn down because conditions that permitted its creation with |
| 33 | * the requested parameters have changed and do not allow it to operate with the requested |
| 34 | * constraints any more. |
Eric Laurent | 331679c | 2018-04-16 17:03:16 -0700 | [diff] [blame] | 35 | * \param[in] handle handle for the client stream to tear down. |
Eric Laurent | fc23520 | 2016-12-20 18:48:17 -0800 | [diff] [blame] | 36 | */ |
Eric Laurent | 331679c | 2018-04-16 17:03:16 -0700 | [diff] [blame] | 37 | virtual void onTearDown(audio_port_handle_t handle) = 0; |
Eric Laurent | fc23520 | 2016-12-20 18:48:17 -0800 | [diff] [blame] | 38 | |
| 39 | /** |
| 40 | * The volume to be applied to the use case specified when opening the stream has changed |
Robert Wu | 4389ae6 | 2022-02-17 18:39:41 +0000 | [diff] [blame] | 41 | * \param[in] volume the new target volume |
Eric Laurent | fc23520 | 2016-12-20 18:48:17 -0800 | [diff] [blame] | 42 | */ |
Robert Wu | 4389ae6 | 2022-02-17 18:39:41 +0000 | [diff] [blame] | 43 | virtual void onVolumeChanged(float volume) = 0; |
Eric Laurent | fc23520 | 2016-12-20 18:48:17 -0800 | [diff] [blame] | 44 | |
| 45 | /** |
Robert Wu | aeb1d00 | 2024-10-30 23:19:44 +0000 | [diff] [blame] | 46 | * The devices the stream is routed to/from has changed |
| 47 | * \param[in] deviceIds a set of the device IDs of the new devices. |
Eric Laurent | fc23520 | 2016-12-20 18:48:17 -0800 | [diff] [blame] | 48 | */ |
Robert Wu | aeb1d00 | 2024-10-30 23:19:44 +0000 | [diff] [blame] | 49 | virtual void onRoutingChanged(const DeviceIdVector& deviceIds) = 0; |
Eric Laurent | fc23520 | 2016-12-20 18:48:17 -0800 | [diff] [blame] | 50 | |
| 51 | protected: |
| 52 | MmapStreamCallback() {} |
| 53 | virtual ~MmapStreamCallback() {} |
| 54 | }; |
| 55 | |
| 56 | |
| 57 | } // namespace android |
| 58 | |
| 59 | #endif // ANDROID_AUDIO_MMAP_STREAM_CALLBACK_H |