1 /* 2 * Copyright (C) 2020 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 #pragma once 18 #include <memory> 19 #include PATH(android/hardware/audio/common/COMMON_TYPES_FILE_VERSION/types.h) 20 #include PATH(android/hardware/audio/COMMON_TYPES_FILE_VERSION/types.h) 21 #include "iwriter.h" 22 23 namespace android { 24 namespace hardware { 25 namespace audio { 26 namespace CPP_VERSION { 27 namespace implementation { 28 29 using namespace ::android::hardware::audio::common::COMMON_TYPES_CPP_VERSION; 30 using namespace ::android::hardware::audio::CORE_TYPES_CPP_VERSION; 31 32 struct DevicePortSource { ~DevicePortSourceDevicePortSource33 virtual ~DevicePortSource() {} 34 virtual Result getCapturePosition(uint64_t &frames, uint64_t &time) = 0; 35 virtual size_t read(float volume, size_t bytesToRead, IWriter &) = 0; 36 37 static std::unique_ptr<DevicePortSource> create(size_t writerBufferSizeHint, 38 const DeviceAddress &, 39 const AudioConfig &, 40 const hidl_vec<AudioInOutFlag> &, 41 uint64_t &frames); 42 43 static bool validateDeviceAddress(const DeviceAddress &); 44 }; 45 46 } // namespace implementation 47 } // namespace CPP_VERSION 48 } // namespace audio 49 } // namespace hardware 50 } // namespace android 51