/* * Copyright 2018 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ //#define LOG_NDEBUG 0 #define LOG_TAG "Codec2-ComponentInterface" #include #include #include #include #include #include #include #include #include #include #include namespace android { namespace hardware { namespace media { namespace c2 { namespace V1_0 { namespace utils { using namespace ::android; namespace /* unnamed */ { // Implementation of ConfigurableC2Intf based on C2ComponentInterface struct CompIntf : public ConfigurableC2Intf { CompIntf(const std::shared_ptr& intf) : ConfigurableC2Intf{intf->getName(), intf->getId()}, mIntf{intf} { } virtual c2_status_t config( const std::vector& params, c2_blocking_t mayBlock, std::vector>* const failures ) override { return mIntf->config_vb(params, mayBlock, failures); } virtual c2_status_t query( const std::vector& indices, c2_blocking_t mayBlock, std::vector>* const params ) const override { return mIntf->query_vb({}, indices, mayBlock, params); } virtual c2_status_t querySupportedParams( std::vector>* const params ) const override { return mIntf->querySupportedParams_nb(params); } virtual c2_status_t querySupportedValues( std::vector& fields, c2_blocking_t mayBlock) const override { return mIntf->querySupportedValues_vb(fields, mayBlock); } protected: std::shared_ptr mIntf; }; } // unnamed namespace // ComponentInterface ComponentInterface::ComponentInterface( const std::shared_ptr& intf, const std::shared_ptr& cache) : mInterface{intf}, mConfigurable{new CachedConfigurable(std::make_unique(intf))} { mInit = mConfigurable->init(cache); } c2_status_t ComponentInterface::status() const { return mInit; } Return> ComponentInterface::getConfigurable() { return mConfigurable; } } // namespace utils } // namespace V1_0 } // namespace c2 } // namespace media } // namespace hardware } // namespace android