blob: cc43a4814b4d07db4ed332aa8880e681ed20f386 [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"
Svet Ganov33761132021-05-13 22:51:08 +000026#include <android/content/AttributionSourceState.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
Svet Ganov33761132021-05-13 22:51:08 +000030using android::content::AttributionSourceState;
31
Ytai Ben-Tsvic5f45872020-08-18 10:39:44 -070032class AAudioStreamRequest {
Phil Burk828bea52017-01-03 17:22:09 -080033public:
Ytai Ben-Tsvic5f45872020-08-18 10:39:44 -070034 AAudioStreamRequest() = default;
35
36 // Construct based on a parcelable representation.
37 explicit AAudioStreamRequest(const StreamRequest& parcelable);
Phil Burk828bea52017-01-03 17:22:09 -080038
Svet Ganov33761132021-05-13 22:51:08 +000039 const AttributionSourceState &getAttributionSource() const {
40 return mAttributionSource;
Phil Burk828bea52017-01-03 17:22:09 -080041 }
42
Svet Ganov33761132021-05-13 22:51:08 +000043 void setAttributionSource(const AttributionSourceState &attributionSource) {
44 mAttributionSource = attributionSource;
Phil Burk828bea52017-01-03 17:22:09 -080045 }
46
Phil Burk71f35bb2017-04-13 16:05:07 -070047 bool isSharingModeMatchRequired() const {
48 return mSharingModeMatchRequired;
49 }
50
51 void setSharingModeMatchRequired(bool required) {
52 mSharingModeMatchRequired = required;
53 }
54
Phil Burkc0c70e32017-02-09 13:18:38 -080055 const AAudioStreamConfiguration &getConstantConfiguration() const {
56 return mConfiguration;
57 }
58
Phil Burk5ed503c2017-02-01 09:38:15 -080059 AAudioStreamConfiguration &getConfiguration() {
Phil Burk828bea52017-01-03 17:22:09 -080060 return mConfiguration;
61 }
62
Eric Laurenta54f1282017-07-01 19:39:32 -070063 bool isInService() const {
64 return mInService;
65 }
66
67 void setInService(bool inService) {
68 mInService = inService;
69 }
70
Phil Burkc0c70e32017-02-09 13:18:38 -080071 aaudio_result_t validate() const;
Phil Burk828bea52017-01-03 17:22:09 -080072
Phil Burkc0c70e32017-02-09 13:18:38 -080073 void dump() const;
Phil Burk828bea52017-01-03 17:22:09 -080074
Ytai Ben-Tsvic5f45872020-08-18 10:39:44 -070075 // Extract a parcelable representation of this object.
76 StreamRequest parcelable() const;
77
78private:
Phil Burk5ed503c2017-02-01 09:38:15 -080079 AAudioStreamConfiguration mConfiguration;
Svet Ganov33761132021-05-13 22:51:08 +000080 AttributionSourceState mAttributionSource;
Phil Burk71f35bb2017-04-13 16:05:07 -070081 bool mSharingModeMatchRequired = false;
Eric Laurenta54f1282017-07-01 19:39:32 -070082 bool mInService = false; // Stream opened by AAudioservice
Phil Burk828bea52017-01-03 17:22:09 -080083};
84
Phil Burk5ed503c2017-02-01 09:38:15 -080085} /* namespace aaudio */
Phil Burk828bea52017-01-03 17:22:09 -080086
Phil Burk5204d312017-05-04 17:16:13 -070087#endif //ANDROID_BINDING_AAUDIO_STREAM_REQUEST_H