blob: 6bc192409c6dade81045beedfff234ec7e924e62 [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
17#ifndef BINDING_OBOE_STREAM_CONFIGURATION_H
18#define BINDING_OBOE_STREAM_CONFIGURATION_H
19
20#include <stdint.h>
21
22#include <binder/Parcel.h>
23#include <binder/Parcelable.h>
24#include <oboe/OboeDefinitions.h>
25
26using android::status_t;
27using android::Parcel;
28using android::Parcelable;
29
30namespace oboe {
31
32class OboeStreamConfiguration : public Parcelable {
33public:
34 OboeStreamConfiguration();
35 virtual ~OboeStreamConfiguration();
36
37 oboe_device_id_t getDeviceId() const {
38 return mDeviceId;
39 }
40
41 void setDeviceId(oboe_device_id_t deviceId) {
42 mDeviceId = deviceId;
43 }
44
45 oboe_sample_rate_t getSampleRate() const {
46 return mSampleRate;
47 }
48
49 void setSampleRate(oboe_sample_rate_t sampleRate) {
50 mSampleRate = sampleRate;
51 }
52
53 int32_t getSamplesPerFrame() const {
54 return mSamplesPerFrame;
55 }
56
57 void setSamplesPerFrame(int32_t samplesPerFrame) {
58 mSamplesPerFrame = samplesPerFrame;
59 }
60
61 oboe_audio_format_t getAudioFormat() const {
62 return mAudioFormat;
63 }
64
65 void setAudioFormat(oboe_audio_format_t audioFormat) {
66 mAudioFormat = audioFormat;
67 }
68
69 virtual status_t writeToParcel(Parcel* parcel) const override;
70
71 virtual status_t readFromParcel(const Parcel* parcel) override;
72
73 oboe_result_t validate();
74
75 void dump();
76
77protected:
78 oboe_device_id_t mDeviceId = OBOE_DEVICE_UNSPECIFIED;
79 oboe_sample_rate_t mSampleRate = OBOE_UNSPECIFIED;
80 int32_t mSamplesPerFrame = OBOE_UNSPECIFIED;
81 oboe_audio_format_t mAudioFormat = OBOE_AUDIO_FORMAT_UNSPECIFIED;
82};
83
84} /* namespace oboe */
85
86#endif //BINDING_OBOE_STREAM_CONFIGURATION_H