xref: /aosp_15_r20/frameworks/av/include/media/MmapStreamCallback.h (revision ec779b8e0859a360c3d303172224686826e6e0e1)
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 
20 #include <media/AudioContainers.h>
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.
35      * \param[in] handle handle for the client stream to tear down.
36      */
37     virtual void onTearDown(audio_port_handle_t handle) = 0;
38 
39     /**
40      * The volume to be applied to the use case specified when opening the stream has changed
41      * \param[in] volume the new target volume
42      */
43     virtual void onVolumeChanged(float volume) = 0;
44 
45     /**
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.
48      */
49     virtual void onRoutingChanged(const DeviceIdVector& deviceIds) = 0;
50 
51   protected:
MmapStreamCallback()52     MmapStreamCallback() {}
~MmapStreamCallback()53     virtual ~MmapStreamCallback() {}
54 };
55 
56 
57 } // namespace android
58 
59 #endif // ANDROID_AUDIO_MMAP_STREAM_CALLBACK_H
60