Phil Burk | 5ed503c | 2017-02-01 09:38:15 -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 BINDING_IAAUDIOSERVICE_H |
| 18 | #define BINDING_IAAUDIOSERVICE_H |
| 19 | |
| 20 | #include <stdint.h> |
| 21 | #include <utils/RefBase.h> |
| 22 | #include <binder/TextOutput.h> |
| 23 | #include <binder/IInterface.h> |
| 24 | |
| 25 | #include <aaudio/AAudio.h> |
| 26 | |
| 27 | #include "binding/AAudioServiceDefinitions.h" |
| 28 | #include "binding/AudioEndpointParcelable.h" |
| 29 | #include "binding/AAudioStreamRequest.h" |
| 30 | #include "binding/AAudioStreamConfiguration.h" |
| 31 | |
| 32 | |
| 33 | namespace android { |
| 34 | |
| 35 | // Interface (our AIDL) - Shared by server and client |
| 36 | class IAAudioService : public IInterface { |
| 37 | public: |
| 38 | |
| 39 | DECLARE_META_INTERFACE(AAudioService); |
| 40 | |
| 41 | virtual aaudio_handle_t openStream(aaudio::AAudioStreamRequest &request, |
| 42 | aaudio::AAudioStreamConfiguration &configuration) = 0; |
| 43 | |
| 44 | virtual aaudio_result_t closeStream(aaudio_handle_t streamHandle) = 0; |
| 45 | |
| 46 | /* Get an immutable description of the in-memory queues |
| 47 | * used to communicate with the underlying HAL or Service. |
| 48 | */ |
| 49 | virtual aaudio_result_t getStreamDescription(aaudio_handle_t streamHandle, |
| 50 | aaudio::AudioEndpointParcelable &parcelable) = 0; |
| 51 | |
| 52 | /** |
| 53 | * Start the flow of data. |
| 54 | */ |
| 55 | virtual aaudio_result_t startStream(aaudio_handle_t streamHandle) = 0; |
| 56 | |
| 57 | /** |
| 58 | * Stop the flow of data such that start() can resume without loss of data. |
| 59 | */ |
| 60 | virtual aaudio_result_t pauseStream(aaudio_handle_t streamHandle) = 0; |
| 61 | |
| 62 | /** |
| 63 | * Discard any data held by the underlying HAL or Service. |
| 64 | */ |
| 65 | virtual aaudio_result_t flushStream(aaudio_handle_t streamHandle) = 0; |
| 66 | |
| 67 | /** |
| 68 | * Manage the specified thread as a low latency audio thread. |
| 69 | */ |
| 70 | virtual aaudio_result_t registerAudioThread(aaudio_handle_t streamHandle, pid_t clientThreadId, |
| 71 | aaudio_nanoseconds_t periodNanoseconds) = 0; |
| 72 | |
| 73 | virtual aaudio_result_t unregisterAudioThread(aaudio_handle_t streamHandle, |
| 74 | pid_t clientThreadId) = 0; |
| 75 | }; |
| 76 | |
| 77 | class BnAAudioService : public BnInterface<IAAudioService> { |
| 78 | public: |
| 79 | virtual status_t onTransact(uint32_t code, const Parcel& data, |
| 80 | Parcel* reply, uint32_t flags = 0); |
| 81 | |
| 82 | }; |
| 83 | |
| 84 | } /* namespace android */ |
| 85 | |
| 86 | #endif //BINDING_IAAUDIOSERVICE_H |