1 /* 2 * Copyright (C) 2024 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 #include <aidl/android/hardware/audio/core/BnStreamOut.h> 18 19 using namespace aidl::android::hardware::audio::common; 20 using namespace aidl::android::hardware::audio::core; 21 using namespace aidl::android::media::audio::common; 22 23 namespace aidl::android::hardware::audio::core { 24 25 class StreamOutMock : public BnStreamOut { 26 ndk::ScopedAStatus getStreamCommon(std::shared_ptr<IStreamCommon>* _aidl_return) override; 27 ndk::ScopedAStatus getHwVolume(std::vector<float>* _aidl_return) override; 28 ndk::ScopedAStatus setHwVolume(const std::vector<float>& in_channelVolumes) override; 29 ndk::ScopedAStatus getAudioDescriptionMixLevel(float* _aidl_return) override; 30 ndk::ScopedAStatus setAudioDescriptionMixLevel(float in_leveldB) override; 31 ndk::ScopedAStatus getDualMonoMode(AudioDualMonoMode* _aidl_return) override; 32 ndk::ScopedAStatus setDualMonoMode(AudioDualMonoMode in_mode) override; 33 ndk::ScopedAStatus getPlaybackRateParameters(AudioPlaybackRate* _aidl_return) override; 34 ndk::ScopedAStatus setPlaybackRateParameters(const AudioPlaybackRate& in_playbackRate) override; 35 updateMetadata(const SourceMetadata &)36 ndk::ScopedAStatus updateMetadata(const SourceMetadata&) override { 37 return ndk::ScopedAStatus::ok(); 38 } updateOffloadMetadata(const AudioOffloadMetadata &)39 ndk::ScopedAStatus updateOffloadMetadata(const AudioOffloadMetadata&) override { 40 return ndk::ScopedAStatus::ok(); 41 } getRecommendedLatencyModes(std::vector<AudioLatencyMode> *)42 ndk::ScopedAStatus getRecommendedLatencyModes(std::vector<AudioLatencyMode>*) override { 43 return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION); 44 } setLatencyMode(AudioLatencyMode)45 ndk::ScopedAStatus setLatencyMode(AudioLatencyMode) override { 46 return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION); 47 } selectPresentation(int32_t,int32_t)48 ndk::ScopedAStatus selectPresentation(int32_t, int32_t) override { 49 return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION); 50 } 51 52 private: 53 AudioPlaybackRate mPlaybackRateParameters; 54 AudioDualMonoMode mDualMonoMode; 55 float mAudioDescriptionMixLeveldB; 56 std::vector<float> mHwVolume; 57 std::shared_ptr<IStreamCommon> mStreamCommon; 58 }; 59 60 } // namespace aidl::android::hardware::audio::core 61