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_HIDL_V1_0_UTILS_COMPONENT_INTERFACE_H
18 #define CODEC2_HIDL_V1_0_UTILS_COMPONENT_INTERFACE_H
19 
20 #include <codec2/hidl/1.0/Configurable.h>
21 #include <codec2/hidl/1.0/types.h>
22 
23 #include <android/hardware/media/c2/1.0/IComponentInterface.h>
24 #include <hidl/Status.h>
25 
26 #include <codec2/common/MultiAccessUnitHelper.h>
27 
28 #include <C2Component.h>
29 #include <C2Buffer.h>
30 #include <C2Config.h>
31 #include <util/C2InterfaceHelper.h>
32 #include <C2.h>
33 
34 #include <set>
35 #include <memory>
36 
37 namespace android {
38 namespace hardware {
39 namespace media {
40 namespace c2 {
41 namespace V1_0 {
42 namespace utils {
43 
44 using ::android::hardware::Return;
45 using ::android::hardware::Void;
46 using ::android::sp;
47 using ::android::MultiAccessUnitInterface;
48 
49 struct ComponentStore;
50 
51 struct ComponentInterface : public IComponentInterface {
52     ComponentInterface(
53             const std::shared_ptr<C2ComponentInterface>& interface,
54             const std::shared_ptr<ParameterCache>& cache);
55 
56     ComponentInterface(
57             const std::shared_ptr<C2ComponentInterface>& interface,
58             const std::shared_ptr<MultiAccessUnitInterface>& largeBufferIntf,
59             const std::shared_ptr<ParameterCache>& cache);
60     c2_status_t status() const;
61     virtual Return<sp<IConfigurable>> getConfigurable() override;
62 
63 protected:
64     std::shared_ptr<C2ComponentInterface> mInterface;
65     sp<CachedConfigurable> mConfigurable;
66     c2_status_t mInit;
67 };
68 
69 
70 }  // namespace utils
71 }  // namespace V1_0
72 }  // namespace c2
73 }  // namespace media
74 }  // namespace hardware
75 }  // namespace android
76 
77 #endif  // CODEC2_HIDL_V1_0_UTILS_COMPONENT_INTERFACE_H
78