1 /*
2  * Copyright 2018 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 CODEC2_AIDL_UTILS_COMPONENT_INTERFACE_H
18 #define CODEC2_AIDL_UTILS_COMPONENT_INTERFACE_H
19 
20 #include <codec2/aidl/Configurable.h>
21 #include <codec2/aidl/ParamTypes.h>
22 
23 #include <aidl/android/hardware/media/c2/BnComponentInterface.h>
24 
25 #include <codec2/common/MultiAccessUnitHelper.h>
26 
27 #include <C2Component.h>
28 #include <C2Buffer.h>
29 #include <C2.h>
30 
31 #include <memory>
32 #include <set>
33 
34 namespace aidl {
35 namespace android {
36 namespace hardware {
37 namespace media {
38 namespace c2 {
39 namespace utils {
40 
41 using ::android::MultiAccessUnitInterface;
42 
43 struct ComponentInterface : public BnComponentInterface {
44     ComponentInterface(
45             const std::shared_ptr<C2ComponentInterface>& interface,
46             const std::shared_ptr<ParameterCache>& cache);
47     ComponentInterface(
48         const std::shared_ptr<C2ComponentInterface>& interface,
49         const std::shared_ptr<MultiAccessUnitInterface>& largeBufferIntf,
50         const std::shared_ptr<ParameterCache>& cache);
51     c2_status_t status() const;
52     ::ndk::ScopedAStatus getConfigurable(
53             std::shared_ptr<IConfigurable> *intf) override;
54 
55 protected:
56     std::shared_ptr<C2ComponentInterface> mInterface;
57     std::shared_ptr<CachedConfigurable> mConfigurable;
58     c2_status_t mInit;
59 };
60 
61 }  // namespace utils
62 }  // namespace c2
63 }  // namespace media
64 }  // namespace hardware
65 }  // namespace android
66 }  // namespace aidl
67 
68 #endif  // CODEC2_AIDL_UTILS_COMPONENT_INTERFACE_H
69