/* * Copyright (C) 2020 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_TAG "EffectsFactory7.0" #include #include #include "Effect.h" using ::android::hardware::hidl_string; using ::android::hardware::hidl_vec; using ::android::hardware::Return; using ::android::hardware::Void; using namespace ::android::hardware::audio::common::V7_0; // Make an alias for enumerations generated from the APM config XSD. namespace xsd { using namespace ::android::audio::policy::configuration::V7_0; } namespace android::hardware::audio::effect::V7_0::implementation { Return Effect::init() { return Result::OK; } Return Effect::setConfig( const EffectConfig& config, const ::android::sp& inputBufferProvider, const ::android::sp& outputBufferProvider) { (void)config; (void)inputBufferProvider; (void)outputBufferProvider; return Result::OK; } Return Effect::reset() { return Result::OK; } Return Effect::enable() { if (!mEnabled) { mEnabled = true; return Result::OK; } else { return Result::NOT_SUPPORTED; } } Return Effect::disable() { if (mEnabled) { mEnabled = false; return Result::OK; } else { return Result::NOT_SUPPORTED; } } Return Effect::setDevice(const DeviceAddress& device) { (void)device; return Result::OK; } Return Effect::setAndGetVolume(const hidl_vec& volumes, setAndGetVolume_cb _hidl_cb) { (void)volumes; _hidl_cb(Result::OK, hidl_vec{}); return Void(); } Return Effect::volumeChangeNotification(const hidl_vec& volumes) { (void)volumes; return Result::OK; } Return Effect::setAudioMode(AudioMode mode) { (void)mode; return Result::OK; } Return Effect::setConfigReverse( const EffectConfig& config, const ::android::sp& inputBufferProvider, const ::android::sp& outputBufferProvider) { (void)config; (void)inputBufferProvider; (void)outputBufferProvider; return Result::OK; } Return Effect::setInputDevice(const DeviceAddress& device) { (void)device; return Result::OK; } Return Effect::getConfig(getConfig_cb _hidl_cb) { EffectConfig config; // inputCfg left unspecified. config.outputCfg.base.format.value(toString(xsd::AudioFormat::AUDIO_FORMAT_PCM_16_BIT)); config.outputCfg.base.sampleRateHz.value(48000); config.outputCfg.base.channelMask.value( toString(xsd::AudioChannelMask::AUDIO_CHANNEL_OUT_STEREO)); config.outputCfg.accessMode.value(EffectBufferAccess::ACCESS_ACCUMULATE); _hidl_cb(Result::OK, config); return Void(); } Return Effect::getConfigReverse(getConfigReverse_cb _hidl_cb) { _hidl_cb(Result::OK, EffectConfig{}); return Void(); } Return Effect::getSupportedAuxChannelsConfigs(uint32_t maxConfigs, getSupportedAuxChannelsConfigs_cb _hidl_cb) { (void)maxConfigs; _hidl_cb(Result::OK, hidl_vec{}); return Void(); } Return Effect::getAuxChannelsConfig(getAuxChannelsConfig_cb _hidl_cb) { _hidl_cb(Result::OK, EffectAuxChannelsConfig{}); return Void(); } Return Effect::setAuxChannelsConfig(const EffectAuxChannelsConfig& config) { (void)config; return Result::OK; } Return Effect::setAudioSource(const hidl_string& source) { (void)source; return Result::OK; } Return Effect::offload(const EffectOffloadParameter& param) { (void)param; return Result::OK; } Return Effect::getDescriptor(getDescriptor_cb _hidl_cb) { _hidl_cb(Result::OK, mDescriptor); return Void(); } Return Effect::prepareForProcessing(prepareForProcessing_cb _hidl_cb) { _hidl_cb(Result::OK, MQDescriptor{}); return Void(); } Return Effect::setProcessBuffers(const AudioBuffer& inBuffer, const AudioBuffer& outBuffer) { (void)inBuffer; (void)outBuffer; return Result::OK; } Return Effect::command(uint32_t commandId, const hidl_vec& data, uint32_t resultMaxSize, command_cb _hidl_cb) { (void)commandId; (void)data; (void)resultMaxSize; _hidl_cb(-EINVAL, hidl_vec{}); return Void(); } Return Effect::setParameter(const hidl_vec& parameter, const hidl_vec& value) { (void)parameter; (void)value; return Result::OK; } Return Effect::getParameter(const hidl_vec& parameter, uint32_t valueMaxSize, getParameter_cb _hidl_cb) { (void)parameter; (void)valueMaxSize; _hidl_cb(Result::OK, hidl_vec{}); return Void(); } Return Effect::getSupportedConfigsForFeature(uint32_t featureId, uint32_t maxConfigs, uint32_t configSize, getSupportedConfigsForFeature_cb _hidl_cb) { (void)featureId; (void)maxConfigs; (void)configSize; _hidl_cb(Result::OK, 0, hidl_vec{}); return Void(); } Return Effect::getCurrentConfigForFeature(uint32_t featureId, uint32_t configSize, getCurrentConfigForFeature_cb _hidl_cb) { (void)featureId; (void)configSize; _hidl_cb(Result::OK, hidl_vec{}); return Void(); } Return Effect::setCurrentConfigForFeature(uint32_t featureId, const hidl_vec& configData) { (void)featureId; (void)configData; return Result::OK; } Return Effect::close() { return Result::OK; } } // namespace android::hardware::audio::effect::V7_0::implementation