1 /*
2  * Copyright 2022 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_PARAM_TYPES_SPECIALIZATIONS_H
18 #define CODEC2_AIDL_UTILS_PARAM_TYPES_SPECIALIZATIONS_H
19 
20 #include <aidl/android/hardware/media/c2/FieldId.h>
21 #include <aidl/android/hardware/media/c2/FieldSupportedValues.h>
22 #include <aidl/android/hardware/media/c2/Params.h>
23 #include <aidl/android/hardware/media/c2/Status.h>
24 #include <codec2/common/ParamTypes.h>
25 
26 namespace android {
27 
28 using ::aidl::android::hardware::media::c2::FieldId;
29 using ::aidl::android::hardware::media::c2::FieldSupportedValues;
30 using ::aidl::android::hardware::media::c2::Params;
31 using ::aidl::android::hardware::media::c2::Status;
32 
33 // {offset, size} -> FieldId
34 template<>
35 void SetFieldId(FieldId *d, uint32_t offset, uint32_t size);
36 
37 // FieldId -> offset
38 template<>
39 uint32_t GetOffsetFromFieldId(const FieldId &s);
40 
41 // FieldId -> size
42 template<>
43 uint32_t GetSizeFromFieldId(const FieldId &s);
44 
45 template<>
46 void SetStatus(Status *dst, c2_status_t src);
47 
48 template<>
49 c2_status_t GetStatus(const Status &status);
50 
51 // C2FieldSupportedValues -> FieldSupportedValues
52 template<>
53 bool objcpy(FieldSupportedValues *d, const C2FieldSupportedValues &s);
54 
55 // FieldSupportedValues -> C2FieldSupportedValues
56 template<>
57 bool objcpy(C2FieldSupportedValues *d, const FieldSupportedValues &s);
58 
59 template<>
60 struct _ParamsBlobHelper<Params> { typedef std::vector<uint8_t> BlobType; };
61 
62 template<>
63 const std::vector<uint8_t> &GetBlob<Params>(const Params &params);
64 
65 template<>
66 std::vector<uint8_t> *GetBlob<Params>(Params *params);
67 
68 } // namespace android
69 
70 
71 
72 #endif  // CODEC2_AIDL_UTILS_PARAM_TYPES_SPECIALIZATIONS_H
73