blob: 31d3ea10071d7bed05654b85c5c328dbf81c9117 [file] [log] [blame]
Phil Burk828bea52017-01-03 17:22:09 -08001/*
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 Burk5204d312017-05-04 17:16:13 -070017#ifndef ANDROID_BINDING_AAUDIO_STREAM_REQUEST_H
18#define ANDROID_BINDING_AAUDIO_STREAM_REQUEST_H
Phil Burk828bea52017-01-03 17:22:09 -080019
20#include <stdint.h>
21
Phil Burka4eb0d82017-04-12 15:44:06 -070022#include <aaudio/AAudio.h>
Ytai Ben-Tsvic5f45872020-08-18 10:39:44 -070023#include <aaudio/StreamRequest.h>
Phil Burk828bea52017-01-03 17:22:09 -080024
Phil Burk5ed503c2017-02-01 09:38:15 -080025#include "binding/AAudioStreamConfiguration.h"
Phil Burk828bea52017-01-03 17:22:09 -080026
Phil Burk5ed503c2017-02-01 09:38:15 -080027namespace aaudio {
Phil Burk828bea52017-01-03 17:22:09 -080028
Ytai Ben-Tsvic5f45872020-08-18 10:39:44 -070029class AAudioStreamRequest {
Phil Burk828bea52017-01-03 17:22:09 -080030public:
Ytai Ben-Tsvic5f45872020-08-18 10:39:44 -070031 AAudioStreamRequest() = default;
32
33 // Construct based on a parcelable representation.
34 explicit AAudioStreamRequest(const StreamRequest& parcelable);
Phil Burk828bea52017-01-03 17:22:09 -080035
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 Burk71f35bb2017-04-13 16:05:07 -070052 bool isSharingModeMatchRequired() const {
53 return mSharingModeMatchRequired;
54 }
55
56 void setSharingModeMatchRequired(bool required) {
57 mSharingModeMatchRequired = required;
58 }
59
Phil Burkc0c70e32017-02-09 13:18:38 -080060 const AAudioStreamConfiguration &getConstantConfiguration() const {
61 return mConfiguration;
62 }
63
Phil Burk5ed503c2017-02-01 09:38:15 -080064 AAudioStreamConfiguration &getConfiguration() {
Phil Burk828bea52017-01-03 17:22:09 -080065 return mConfiguration;
66 }
67
Eric Laurenta54f1282017-07-01 19:39:32 -070068 bool isInService() const {
69 return mInService;
70 }
71
72 void setInService(bool inService) {
73 mInService = inService;
74 }
75
Phil Burkc0c70e32017-02-09 13:18:38 -080076 aaudio_result_t validate() const;
Phil Burk828bea52017-01-03 17:22:09 -080077
Phil Burkc0c70e32017-02-09 13:18:38 -080078 void dump() const;
Phil Burk828bea52017-01-03 17:22:09 -080079
Ytai Ben-Tsvic5f45872020-08-18 10:39:44 -070080 // Extract a parcelable representation of this object.
81 StreamRequest parcelable() const;
82
83private:
Phil Burk5ed503c2017-02-01 09:38:15 -080084 AAudioStreamConfiguration mConfiguration;
Phil Burk15f7cab2017-08-04 09:13:31 -070085 uid_t mUserId = (uid_t) -1;
86 pid_t mProcessId = (pid_t) -1;
Phil Burk71f35bb2017-04-13 16:05:07 -070087 bool mSharingModeMatchRequired = false;
Eric Laurenta54f1282017-07-01 19:39:32 -070088 bool mInService = false; // Stream opened by AAudioservice
Phil Burk828bea52017-01-03 17:22:09 -080089};
90
Phil Burk5ed503c2017-02-01 09:38:15 -080091} /* namespace aaudio */
Phil Burk828bea52017-01-03 17:22:09 -080092
Phil Burk5204d312017-05-04 17:16:13 -070093#endif //ANDROID_BINDING_AAUDIO_STREAM_REQUEST_H