blob: 8d90034dea9468392ddf0a9385fc11a761402563 [file] [log] [blame]
Phil Burk204a1632017-01-03 17:23:43 -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 Burkfbf031e2017-10-12 15:58:31 -070017#define LOG_TAG "AAudioStreamRequest"
Phil Burkc0c70e32017-02-09 13:18:38 -080018//#define LOG_NDEBUG 0
19#include <utils/Log.h>
20
Phil Burk204a1632017-01-03 17:23:43 -080021#include <stdint.h>
22
23#include <sys/mman.h>
Phil Burk204a1632017-01-03 17:23:43 -080024
Phil Burka4eb0d82017-04-12 15:44:06 -070025#include <aaudio/AAudio.h>
Phil Burk204a1632017-01-03 17:23:43 -080026
Phil Burk5ed503c2017-02-01 09:38:15 -080027#include "binding/AAudioStreamConfiguration.h"
28#include "binding/AAudioStreamRequest.h"
Phil Burk204a1632017-01-03 17:23:43 -080029
Phil Burk5ed503c2017-02-01 09:38:15 -080030using namespace aaudio;
Phil Burk204a1632017-01-03 17:23:43 -080031
Ytai Ben-Tsvic5f45872020-08-18 10:39:44 -070032AAudioStreamRequest::AAudioStreamRequest(const StreamRequest& parcelable) :
33 mConfiguration(std::move(parcelable.params)),
Svet Ganov33761132021-05-13 22:51:08 +000034 mAttributionSource(parcelable.attributionSource),
Ytai Ben-Tsvic5f45872020-08-18 10:39:44 -070035 mSharingModeMatchRequired(parcelable.sharingModeMatchRequired),
36 mInService(parcelable.inService) {
Phil Burk204a1632017-01-03 17:23:43 -080037}
38
Ytai Ben-Tsvic5f45872020-08-18 10:39:44 -070039StreamRequest AAudioStreamRequest::parcelable() const {
40 StreamRequest result;
41 result.params = std::move(mConfiguration).parcelable();
Svet Ganov33761132021-05-13 22:51:08 +000042 result.attributionSource = mAttributionSource;
Ytai Ben-Tsvic5f45872020-08-18 10:39:44 -070043 result.sharingModeMatchRequired = mSharingModeMatchRequired;
44 result.inService = mInService;
45 return result;
Phil Burk204a1632017-01-03 17:23:43 -080046}
47
Phil Burkc0c70e32017-02-09 13:18:38 -080048aaudio_result_t AAudioStreamRequest::validate() const {
Phil Burk204a1632017-01-03 17:23:43 -080049 return mConfiguration.validate();
50}
51
Phil Burkc0c70e32017-02-09 13:18:38 -080052void AAudioStreamRequest::dump() const {
Svet Ganov33761132021-05-13 22:51:08 +000053 ALOGD("mAttributionSource = %s", mAttributionSource.toString().c_str());
Phil Burkfbf031e2017-10-12 15:58:31 -070054 ALOGD("mSharingModeMatchRequired = %d", mSharingModeMatchRequired);
55 ALOGD("mInService = %d", mInService);
Phil Burk204a1632017-01-03 17:23:43 -080056 mConfiguration.dump();
57}