Home | History | Annotate | Download | only in 1.0
      1 /*
      2  * Copyright (C) 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 HARDWARE_GOOGLE_MEDIA_C2_V1_0_UTILS_CONFIGURABLEC2INTF_H
     18 #define HARDWARE_GOOGLE_MEDIA_C2_V1_0_UTILS_CONFIGURABLEC2INTF_H
     19 
     20 #include <C2Work.h>
     21 #include <C2Component.h>
     22 #include <C2Param.h>
     23 #include <C2.h>
     24 
     25 #include <hidl/HidlSupport.h>
     26 #include <utils/StrongPointer.h>
     27 #include <vector>
     28 #include <memory>
     29 
     30 namespace hardware {
     31 namespace google {
     32 namespace media {
     33 namespace c2 {
     34 namespace V1_0 {
     35 namespace utils {
     36 
     37 using ::android::sp;
     38 using ::android::hardware::hidl_string;
     39 using ::android::hardware::hidl_vec;
     40 using ::android::hardware::Return;
     41 using ::android::hardware::Void;
     42 
     43 /**
     44  * Common Codec 2.0 interface wrapper.
     45  */
     46 struct ConfigurableC2Intf {
     47     C2String getName() const { return mName; }
     48     /** C2ComponentInterface::query_vb sans stack params */
     49     virtual c2_status_t query(
     50             const std::vector<C2Param::Index> &indices,
     51             c2_blocking_t mayBlock,
     52             std::vector<std::unique_ptr<C2Param>>* const params) const = 0;
     53     /** C2ComponentInterface::config_vb */
     54     virtual c2_status_t config(
     55             const std::vector<C2Param*> &params,
     56             c2_blocking_t mayBlock,
     57             std::vector<std::unique_ptr<C2SettingResult>>* const failures) = 0;
     58     /** C2ComponentInterface::querySupportedParams_nb */
     59     virtual c2_status_t querySupportedParams(
     60             std::vector<std::shared_ptr<C2ParamDescriptor>>* const params) const = 0;
     61     /** C2ComponentInterface::querySupportedParams_nb */
     62     virtual c2_status_t querySupportedValues(
     63             std::vector<C2FieldSupportedValuesQuery>& fields, c2_blocking_t mayBlock) const = 0;
     64 
     65     virtual ~ConfigurableC2Intf() = default;
     66 
     67     ConfigurableC2Intf(const C2String& name) : mName(name) {}
     68 
     69 protected:
     70     C2String mName; /* cache component name */
     71 };
     72 
     73 }  // namespace utils
     74 }  // namespace V1_0
     75 }  // namespace c2
     76 }  // namespace media
     77 }  // namespace google
     78 }  // namespace hardware
     79 
     80 #endif  // HARDWARE_GOOGLE_MEDIA_C2_V1_0_UTILS_CONFIGURABLEC2INTF_H
     81