blob: 02341c8d2f028858f5fdb935ef86df09cfb89f2b [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"
Philip P. Moltmannbda45752020-07-17 16:41:18 -070026#include <android/media/permission/Identity.h>
Phil Burk828bea52017-01-03 17:22:09 -080027
Phil Burk5ed503c2017-02-01 09:38:15 -080028namespace aaudio {
Phil Burk828bea52017-01-03 17:22:09 -080029
Ytai Ben-Tsvic5f45872020-08-18 10:39:44 -070030class AAudioStreamRequest {
Phil Burk828bea52017-01-03 17:22:09 -080031public:
Ytai Ben-Tsvic5f45872020-08-18 10:39:44 -070032 AAudioStreamRequest() = default;
33
34 // Construct based on a parcelable representation.
35 explicit AAudioStreamRequest(const StreamRequest& parcelable);
Phil Burk828bea52017-01-03 17:22:09 -080036
Philip P. Moltmannbda45752020-07-17 16:41:18 -070037 const android::media::permission::Identity &getIdentity() const {
38 return mIdentity;
Phil Burk828bea52017-01-03 17:22:09 -080039 }
40
Philip P. Moltmannbda45752020-07-17 16:41:18 -070041 void setIdentity(const android::media::permission::Identity &identity) {
42 mIdentity = identity;
Phil Burk828bea52017-01-03 17:22:09 -080043 }
44
Phil Burk71f35bb2017-04-13 16:05:07 -070045 bool isSharingModeMatchRequired() const {
46 return mSharingModeMatchRequired;
47 }
48
49 void setSharingModeMatchRequired(bool required) {
50 mSharingModeMatchRequired = required;
51 }
52
Phil Burkc0c70e32017-02-09 13:18:38 -080053 const AAudioStreamConfiguration &getConstantConfiguration() const {
54 return mConfiguration;
55 }
56
Phil Burk5ed503c2017-02-01 09:38:15 -080057 AAudioStreamConfiguration &getConfiguration() {
Phil Burk828bea52017-01-03 17:22:09 -080058 return mConfiguration;
59 }
60
Eric Laurenta54f1282017-07-01 19:39:32 -070061 bool isInService() const {
62 return mInService;
63 }
64
65 void setInService(bool inService) {
66 mInService = inService;
67 }
68
Phil Burkc0c70e32017-02-09 13:18:38 -080069 aaudio_result_t validate() const;
Phil Burk828bea52017-01-03 17:22:09 -080070
Phil Burkc0c70e32017-02-09 13:18:38 -080071 void dump() const;
Phil Burk828bea52017-01-03 17:22:09 -080072
Ytai Ben-Tsvic5f45872020-08-18 10:39:44 -070073 // Extract a parcelable representation of this object.
74 StreamRequest parcelable() const;
75
76private:
Phil Burk5ed503c2017-02-01 09:38:15 -080077 AAudioStreamConfiguration mConfiguration;
Philip P. Moltmannbda45752020-07-17 16:41:18 -070078 android::media::permission::Identity mIdentity;
Phil Burk71f35bb2017-04-13 16:05:07 -070079 bool mSharingModeMatchRequired = false;
Eric Laurenta54f1282017-07-01 19:39:32 -070080 bool mInService = false; // Stream opened by AAudioservice
Phil Burk828bea52017-01-03 17:22:09 -080081};
82
Phil Burk5ed503c2017-02-01 09:38:15 -080083} /* namespace aaudio */
Phil Burk828bea52017-01-03 17:22:09 -080084
Phil Burk5204d312017-05-04 17:16:13 -070085#endif //ANDROID_BINDING_AAUDIO_STREAM_REQUEST_H