Phil Burk | 828bea5 | 2017-01-03 17:22:09 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 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 | |
Phil Burk | 5204d31 | 2017-05-04 17:16:13 -0700 | [diff] [blame] | 17 | #ifndef ANDROID_BINDING_AAUDIO_STREAM_REQUEST_H |
| 18 | #define ANDROID_BINDING_AAUDIO_STREAM_REQUEST_H |
Phil Burk | 828bea5 | 2017-01-03 17:22:09 -0800 | [diff] [blame] | 19 | |
| 20 | #include <stdint.h> |
| 21 | |
Phil Burk | a4eb0d8 | 2017-04-12 15:44:06 -0700 | [diff] [blame] | 22 | #include <aaudio/AAudio.h> |
Ytai Ben-Tsvi | c5f4587 | 2020-08-18 10:39:44 -0700 | [diff] [blame] | 23 | #include <aaudio/StreamRequest.h> |
Phil Burk | 828bea5 | 2017-01-03 17:22:09 -0800 | [diff] [blame] | 24 | |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 25 | #include "binding/AAudioStreamConfiguration.h" |
Phil Burk | 828bea5 | 2017-01-03 17:22:09 -0800 | [diff] [blame] | 26 | |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 27 | namespace aaudio { |
Phil Burk | 828bea5 | 2017-01-03 17:22:09 -0800 | [diff] [blame] | 28 | |
Ytai Ben-Tsvi | c5f4587 | 2020-08-18 10:39:44 -0700 | [diff] [blame] | 29 | class AAudioStreamRequest { |
Phil Burk | 828bea5 | 2017-01-03 17:22:09 -0800 | [diff] [blame] | 30 | public: |
Ytai Ben-Tsvi | c5f4587 | 2020-08-18 10:39:44 -0700 | [diff] [blame] | 31 | AAudioStreamRequest() = default; |
| 32 | |
| 33 | // Construct based on a parcelable representation. |
| 34 | explicit AAudioStreamRequest(const StreamRequest& parcelable); |
Phil Burk | 828bea5 | 2017-01-03 17:22:09 -0800 | [diff] [blame] | 35 | |
| 36 | uid_t getUserId() const { |
| 37 | return mUserId; |
| 38 | } |
| 39 | |
| 40 | void setUserId(uid_t userId) { |
| 41 | mUserId = userId; |
| 42 | } |
| 43 | |
| 44 | pid_t getProcessId() const { |
| 45 | return mProcessId; |
| 46 | } |
| 47 | |
| 48 | void setProcessId(pid_t processId) { |
| 49 | mProcessId = processId; |
| 50 | } |
| 51 | |
Phil Burk | 71f35bb | 2017-04-13 16:05:07 -0700 | [diff] [blame] | 52 | bool isSharingModeMatchRequired() const { |
| 53 | return mSharingModeMatchRequired; |
| 54 | } |
| 55 | |
| 56 | void setSharingModeMatchRequired(bool required) { |
| 57 | mSharingModeMatchRequired = required; |
| 58 | } |
| 59 | |
Phil Burk | c0c70e3 | 2017-02-09 13:18:38 -0800 | [diff] [blame] | 60 | const AAudioStreamConfiguration &getConstantConfiguration() const { |
| 61 | return mConfiguration; |
| 62 | } |
| 63 | |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 64 | AAudioStreamConfiguration &getConfiguration() { |
Phil Burk | 828bea5 | 2017-01-03 17:22:09 -0800 | [diff] [blame] | 65 | return mConfiguration; |
| 66 | } |
| 67 | |
Eric Laurent | a54f128 | 2017-07-01 19:39:32 -0700 | [diff] [blame] | 68 | bool isInService() const { |
| 69 | return mInService; |
| 70 | } |
| 71 | |
| 72 | void setInService(bool inService) { |
| 73 | mInService = inService; |
| 74 | } |
| 75 | |
Phil Burk | c0c70e3 | 2017-02-09 13:18:38 -0800 | [diff] [blame] | 76 | aaudio_result_t validate() const; |
Phil Burk | 828bea5 | 2017-01-03 17:22:09 -0800 | [diff] [blame] | 77 | |
Phil Burk | c0c70e3 | 2017-02-09 13:18:38 -0800 | [diff] [blame] | 78 | void dump() const; |
Phil Burk | 828bea5 | 2017-01-03 17:22:09 -0800 | [diff] [blame] | 79 | |
Ytai Ben-Tsvi | c5f4587 | 2020-08-18 10:39:44 -0700 | [diff] [blame] | 80 | // Extract a parcelable representation of this object. |
| 81 | StreamRequest parcelable() const; |
| 82 | |
| 83 | private: |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 84 | AAudioStreamConfiguration mConfiguration; |
Phil Burk | 15f7cab | 2017-08-04 09:13:31 -0700 | [diff] [blame] | 85 | uid_t mUserId = (uid_t) -1; |
| 86 | pid_t mProcessId = (pid_t) -1; |
Phil Burk | 71f35bb | 2017-04-13 16:05:07 -0700 | [diff] [blame] | 87 | bool mSharingModeMatchRequired = false; |
Eric Laurent | a54f128 | 2017-07-01 19:39:32 -0700 | [diff] [blame] | 88 | bool mInService = false; // Stream opened by AAudioservice |
Phil Burk | 828bea5 | 2017-01-03 17:22:09 -0800 | [diff] [blame] | 89 | }; |
| 90 | |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 91 | } /* namespace aaudio */ |
Phil Burk | 828bea5 | 2017-01-03 17:22:09 -0800 | [diff] [blame] | 92 | |
Phil Burk | 5204d31 | 2017-05-04 17:16:13 -0700 | [diff] [blame] | 93 | #endif //ANDROID_BINDING_AAUDIO_STREAM_REQUEST_H |