1 /*
2 * Copyright (C) 2023 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 #define LOG_TAG "AHAL_Stream"
18 #include <android-base/logging.h>
19
20 #include "core-impl/Module.h"
21 #include "core-impl/StreamStub.h"
22
23 using aidl::android::hardware::audio::common::SinkMetadata;
24 using aidl::android::hardware::audio::common::SourceMetadata;
25 using aidl::android::media::audio::common::AudioDevice;
26 using aidl::android::media::audio::common::AudioOffloadInfo;
27 using aidl::android::media::audio::common::MicrophoneInfo;
28
29 namespace aidl::android::hardware::audio::core {
30
StreamStub(StreamContext * context,const Metadata & metadata)31 StreamStub::StreamStub(StreamContext* context, const Metadata& metadata)
32 : StreamCommonImpl(context, metadata), DriverStubImpl(getContext()) {}
33
~StreamStub()34 StreamStub::~StreamStub() {
35 cleanupWorker();
36 }
37
StreamInStub(StreamContext && context,const SinkMetadata & sinkMetadata,const std::vector<MicrophoneInfo> & microphones)38 StreamInStub::StreamInStub(StreamContext&& context, const SinkMetadata& sinkMetadata,
39 const std::vector<MicrophoneInfo>& microphones)
40 : StreamIn(std::move(context), microphones), StreamStub(&mContextInstance, sinkMetadata) {}
41
StreamOutStub(StreamContext && context,const SourceMetadata & sourceMetadata,const std::optional<AudioOffloadInfo> & offloadInfo)42 StreamOutStub::StreamOutStub(StreamContext&& context, const SourceMetadata& sourceMetadata,
43 const std::optional<AudioOffloadInfo>& offloadInfo)
44 : StreamOut(std::move(context), offloadInfo), StreamStub(&mContextInstance, sourceMetadata) {}
45
46 } // namespace aidl::android::hardware::audio::core
47