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 <C2Component.h>
27 #include <C2Buffer.h>
28 #include <C2.h>
29 
30 #include <memory>
31 
32 namespace android {
33 namespace hardware {
34 namespace media {
35 namespace c2 {
36 namespace V1_0 {
37 namespace utils {
38 
39 using ::android::hardware::Return;
40 using ::android::hardware::Void;
41 using ::android::sp;
42 
43 struct ComponentStore;
44 
45 struct ComponentInterface : public IComponentInterface {
46     ComponentInterface(
47             const std::shared_ptr<C2ComponentInterface>& interface,
48             const std::shared_ptr<ParameterCache>& cache);
49     c2_status_t status() const;
50     virtual Return<sp<IConfigurable>> getConfigurable() override;
51 
52 protected:
53     std::shared_ptr<C2ComponentInterface> mInterface;
54     sp<CachedConfigurable> mConfigurable;
55     c2_status_t mInit;
56 };
57 
58 
59 }  // namespace utils
60 }  // namespace V1_0
61 }  // namespace c2
62 }  // namespace media
63 }  // namespace hardware
64 }  // namespace android
65 
66 #endif  // CODEC2_HIDL_V1_0_UTILS_COMPONENT_INTERFACE_H
67