// 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. #include "DummyOutputStream.h" namespace audio_proxy { namespace service { DummyOutputStream::DummyOutputStream(const AudioConfig &config) : mChannelMask(config.channelMask), mFormat(config.format), mSampleRate(config.sampleRateHz) {} Return DummyOutputStream::getBufferSize() { return 0; } Return DummyOutputStream::getFrameCount() { return 0; } Return DummyOutputStream::getSupportedSampleRates( AudioFormat, getSupportedSampleRates_cb _hidl_cb) { _hidl_cb(Result::NOT_SUPPORTED, {}); return Void(); } Return DummyOutputStream::getSampleRate() { return mSampleRate; } Return DummyOutputStream::getSupportedChannelMasks( AudioFormat, getSupportedChannelMasks_cb _hidl_cb) { _hidl_cb(Result::NOT_SUPPORTED, {}); return Void(); } Return> DummyOutputStream::getChannelMask() { return mChannelMask; } Return DummyOutputStream::getSupportedFormats(getSupportedFormats_cb _hidl_cb) { _hidl_cb({}); return Void(); } Return DummyOutputStream::getFormat() { return mFormat; } Return DummyOutputStream::getLatency() { return 0; } Return DummyOutputStream::standby() { return Result::NOT_SUPPORTED; } Return DummyOutputStream::pause() { return Result::NOT_SUPPORTED; } Return DummyOutputStream::resume() { return Result::NOT_SUPPORTED; } Return DummyOutputStream::drain(AudioDrain) { return Result::NOT_SUPPORTED; } Return DummyOutputStream::prepareForWriting(uint32_t frameSize, uint32_t framesCount, prepareForWriting_cb _hidl_cb) { _hidl_cb(Result::NOT_SUPPORTED, {}, {}, {}, {}); return Void(); } Return DummyOutputStream::setParameters(const hidl_vec &context, const hidl_vec ¶meters) { // This method is invoked in AudioFlinger::PlaybackThread::preExit which logs // an error when the returned result is not OK. return Result::OK; } Return DummyOutputStream::getParameters(const hidl_vec &context, const hidl_vec &keys, getParameters_cb _hidl_cb) { _hidl_cb(Result::NOT_SUPPORTED, {}); return Void(); } Return DummyOutputStream::getFrameSize() { // This is a randomly picked value. return 1024; } Return DummyOutputStream::setSampleRate(uint32_t) { return Result::NOT_SUPPORTED; } Return DummyOutputStream::setChannelMask(hidl_bitfield) { return Result::NOT_SUPPORTED; } Return DummyOutputStream::setFormat(AudioFormat) { return Result::NOT_SUPPORTED; } Return DummyOutputStream::getAudioProperties(getAudioProperties_cb _hidl_cb) { _hidl_cb(mSampleRate, mChannelMask, mFormat); return Void(); } Return DummyOutputStream::addEffect(uint64_t) { return Result::NOT_SUPPORTED; } Return DummyOutputStream::removeEffect(uint64_t) { return Result::NOT_SUPPORTED; } Return DummyOutputStream::getDevices(getDevices_cb _hidl_cb) { _hidl_cb(Result::NOT_SUPPORTED, {}); return Void(); } Return DummyOutputStream::setDevices(const hidl_vec &) { return Result::NOT_SUPPORTED; } Return DummyOutputStream::setHwAvSync(uint32_t hwAvSync) { return Result::NOT_SUPPORTED; } Return DummyOutputStream::start() { return Result::NOT_SUPPORTED; } Return DummyOutputStream::stop() { return Result::NOT_SUPPORTED; } Return DummyOutputStream::createMmapBuffer(int32_t minSizeFrames, createMmapBuffer_cb _hidl_cb) { _hidl_cb(Result::NOT_SUPPORTED, {}); return Void(); } Return DummyOutputStream::getMmapPosition(getMmapPosition_cb _hidl_cb) { _hidl_cb(Result::NOT_SUPPORTED, {}); return Void(); } Return DummyOutputStream::close() { return Result::NOT_SUPPORTED; } Return DummyOutputStream::setVolume(float left, float right) { return Result::NOT_SUPPORTED; } Return DummyOutputStream::updateSourceMetadata(const SourceMetadata &) { return Void(); } Return DummyOutputStream::getRenderPosition(getRenderPosition_cb _hidl_cb) { _hidl_cb(Result::NOT_SUPPORTED, {}); return Void(); } Return DummyOutputStream::getNextWriteTimestamp(getNextWriteTimestamp_cb _hidl_cb) { _hidl_cb(Result::NOT_SUPPORTED, {}); return Void(); } Return DummyOutputStream::setCallback(const sp &) { return Result::NOT_SUPPORTED; } Return DummyOutputStream::clearCallback() { return Result::NOT_SUPPORTED; } Return DummyOutputStream::supportsPauseAndResume(supportsPauseAndResume_cb _hidl_cb) { _hidl_cb({}, {}); return Void(); } Return DummyOutputStream::supportsDrain() { return false; } Return DummyOutputStream::flush() { return Result::NOT_SUPPORTED; } Return DummyOutputStream::getPresentationPosition( getPresentationPosition_cb _hidl_cb) { _hidl_cb(Result::NOT_SUPPORTED, {}, {}); return Void(); } Return DummyOutputStream::selectPresentation(int32_t, int32_t) { return Result::NOT_SUPPORTED; } } // namespace service } // namespace audio_proxy