Mikhail Naganov | 1054829 | 2016-10-31 10:39:47 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 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 | |
Steven Moreland | d6e4f03 | 2016-11-28 18:37:07 -0800 | [diff] [blame] | 17 | #ifndef ANDROID_HARDWARE_AUDIO_V2_0_STREAMIN_H |
| 18 | #define ANDROID_HARDWARE_AUDIO_V2_0_STREAMIN_H |
Mikhail Naganov | 1054829 | 2016-10-31 10:39:47 -0700 | [diff] [blame] | 19 | |
| 20 | #include <android/hardware/audio/2.0/IStreamIn.h> |
| 21 | #include <hidl/Status.h> |
| 22 | |
| 23 | #include <hidl/MQDescriptor.h> |
| 24 | |
| 25 | #include "Stream.h" |
| 26 | |
| 27 | namespace android { |
| 28 | namespace hardware { |
| 29 | namespace audio { |
| 30 | namespace V2_0 { |
| 31 | namespace implementation { |
| 32 | |
| 33 | using ::android::hardware::audio::common::V2_0::AudioChannelMask; |
| 34 | using ::android::hardware::audio::common::V2_0::AudioDevice; |
| 35 | using ::android::hardware::audio::common::V2_0::AudioFormat; |
| 36 | using ::android::hardware::audio::common::V2_0::AudioSource; |
| 37 | using ::android::hardware::audio::V2_0::DeviceAddress; |
| 38 | using ::android::hardware::audio::V2_0::IStream; |
| 39 | using ::android::hardware::audio::V2_0::IStreamIn; |
| 40 | using ::android::hardware::audio::V2_0::ParameterValue; |
| 41 | using ::android::hardware::audio::V2_0::Result; |
| 42 | using ::android::hardware::Return; |
| 43 | using ::android::hardware::Void; |
| 44 | using ::android::hardware::hidl_vec; |
| 45 | using ::android::hardware::hidl_string; |
| 46 | using ::android::sp; |
| 47 | |
| 48 | struct StreamIn : public IStreamIn { |
| 49 | StreamIn(audio_hw_device_t* device, audio_stream_in_t* stream); |
| 50 | |
| 51 | // Methods from ::android::hardware::audio::V2_0::IStream follow. |
| 52 | Return<uint64_t> getFrameSize() override; |
| 53 | Return<uint64_t> getFrameCount() override; |
| 54 | Return<uint64_t> getBufferSize() override; |
| 55 | Return<uint32_t> getSampleRate() override; |
| 56 | Return<void> getSupportedSampleRates(getSupportedSampleRates_cb _hidl_cb) override; |
| 57 | Return<Result> setSampleRate(uint32_t sampleRateHz) override; |
| 58 | Return<AudioChannelMask> getChannelMask() override; |
| 59 | Return<void> getSupportedChannelMasks(getSupportedChannelMasks_cb _hidl_cb) override; |
| 60 | Return<Result> setChannelMask(AudioChannelMask mask) override; |
| 61 | Return<AudioFormat> getFormat() override; |
| 62 | Return<void> getSupportedFormats(getSupportedFormats_cb _hidl_cb) override; |
| 63 | Return<Result> setFormat(AudioFormat format) override; |
| 64 | Return<void> getAudioProperties(getAudioProperties_cb _hidl_cb) override; |
| 65 | Return<Result> addEffect(uint64_t effectId) override; |
| 66 | Return<Result> removeEffect(uint64_t effectId) override; |
| 67 | Return<Result> standby() override; |
| 68 | Return<AudioDevice> getDevice() override; |
| 69 | Return<Result> setDevice(const DeviceAddress& address) override; |
| 70 | Return<Result> setConnectedState(const DeviceAddress& address, bool connected) override; |
| 71 | Return<Result> setHwAvSync(uint32_t hwAvSync) override; |
| 72 | Return<void> getParameters( |
| 73 | const hidl_vec<hidl_string>& keys, getParameters_cb _hidl_cb) override; |
| 74 | Return<Result> setParameters(const hidl_vec<ParameterValue>& parameters) override; |
Martijn Coenen | 70b9a15 | 2016-11-18 15:29:32 +0100 | [diff] [blame] | 75 | Return<void> debugDump(const hidl_handle& fd) override; |
Mikhail Naganov | 1054829 | 2016-10-31 10:39:47 -0700 | [diff] [blame] | 76 | |
| 77 | // Methods from ::android::hardware::audio::V2_0::IStreamIn follow. |
| 78 | Return<void> getAudioSource(getAudioSource_cb _hidl_cb) override; |
| 79 | Return<Result> setGain(float gain) override; |
| 80 | Return<void> read(uint64_t size, read_cb _hidl_cb) override; |
| 81 | Return<uint32_t> getInputFramesLost() override; |
| 82 | Return<void> getCapturePosition(getCapturePosition_cb _hidl_cb) override; |
| 83 | |
| 84 | private: |
| 85 | audio_hw_device_t *mDevice; |
| 86 | audio_stream_in_t *mStream; |
| 87 | sp<Stream> mStreamCommon; |
| 88 | |
| 89 | virtual ~StreamIn(); |
| 90 | }; |
| 91 | |
| 92 | } // namespace implementation |
| 93 | } // namespace V2_0 |
| 94 | } // namespace audio |
| 95 | } // namespace hardware |
| 96 | } // namespace android |
| 97 | |
Steven Moreland | d6e4f03 | 2016-11-28 18:37:07 -0800 | [diff] [blame] | 98 | #endif // ANDROID_HARDWARE_AUDIO_V2_0_STREAMIN_H |