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 <android/hardware/audio/common/6.0/types.h>
20 #include <android/hardware/audio/6.0/types.h>
21 #include "ireader.h"
22 
23 namespace android {
24 namespace hardware {
25 namespace audio {
26 namespace V6_0 {
27 namespace implementation {
28 
29 using namespace ::android::hardware::audio::common::V6_0;
30 using namespace ::android::hardware::audio::V6_0;
31 
32 struct DevicePortSink {
~DevicePortSinkDevicePortSink33     virtual ~DevicePortSink() {}
34     virtual Result getPresentationPosition(uint64_t &frames, TimeSpec &ts) = 0;
35     virtual size_t write(float volume, size_t bytesToWrite, IReader &) = 0;
36 
37     static std::unique_ptr<DevicePortSink> create(size_t readerBufferSizeHint,
38                                                   const DeviceAddress &,
39                                                   const AudioConfig &,
40                                                   const hidl_bitfield<AudioOutputFlag> &,
41                                                   uint64_t &frames);
42 };
43 
44 }  // namespace implementation
45 }  // namespace V6_0
46 }  // namespace audio
47 }  // namespace hardware
48 }  // namespace android
49