audio_device_default.h (5869B)
1 /* 2 * Copyright (c) 2018 The WebRTC project authors. All Rights Reserved. 3 * 4 * Use of this source code is governed by a BSD-style license 5 * that can be found in the LICENSE file in the root of the source 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 11 #ifndef MODULES_AUDIO_DEVICE_INCLUDE_AUDIO_DEVICE_DEFAULT_H_ 12 #define MODULES_AUDIO_DEVICE_INCLUDE_AUDIO_DEVICE_DEFAULT_H_ 13 14 #include <cstdint> 15 16 #include "api/audio/audio_device.h" 17 #include "api/audio/audio_device_defines.h" 18 19 namespace webrtc { 20 namespace webrtc_impl { 21 22 // AudioDeviceModuleDefault template adds default implementation for all 23 // AudioDeviceModule methods to the class, which inherits from 24 // AudioDeviceModuleDefault<T>. 25 template <typename T> 26 class AudioDeviceModuleDefault : public T { 27 public: 28 AudioDeviceModuleDefault() {} 29 virtual ~AudioDeviceModuleDefault() {} 30 31 int32_t RegisterAudioCallback(AudioTransport* /* audioCallback */) override { 32 return 0; 33 } 34 int32_t Init() override { return 0; } 35 int32_t InitSpeaker() override { return 0; } 36 int32_t SetPlayoutDevice(uint16_t /* index */) override { return 0; } 37 int32_t SetPlayoutDevice( 38 AudioDeviceModule::WindowsDeviceType /* device */) override { 39 return 0; 40 } 41 int32_t SetStereoPlayout(bool /* enable */) override { return 0; } 42 int32_t StopPlayout() override { return 0; } 43 int32_t InitMicrophone() override { return 0; } 44 int32_t SetRecordingDevice(uint16_t /* index */) override { return 0; } 45 int32_t SetRecordingDevice( 46 AudioDeviceModule::WindowsDeviceType /* device */) override { 47 return 0; 48 } 49 int32_t SetStereoRecording(bool /* enable */) override { return 0; } 50 int32_t StopRecording() override { return 0; } 51 52 int32_t Terminate() override { return 0; } 53 54 int32_t ActiveAudioLayer( 55 AudioDeviceModule::AudioLayer* /* audioLayer */) const override { 56 return 0; 57 } 58 bool Initialized() const override { return true; } 59 int16_t PlayoutDevices() override { return 0; } 60 int16_t RecordingDevices() override { return 0; } 61 int32_t PlayoutDeviceName(uint16_t /* index */, 62 char /* name */[kAdmMaxDeviceNameSize], 63 char /* guid */[kAdmMaxGuidSize]) override { 64 return 0; 65 } 66 int32_t RecordingDeviceName(uint16_t /* index */, 67 char /* name */[kAdmMaxDeviceNameSize], 68 char /* guid */[kAdmMaxGuidSize]) override { 69 return 0; 70 } 71 int32_t PlayoutIsAvailable(bool* /* available */) override { return 0; } 72 int32_t InitPlayout() override { return 0; } 73 bool PlayoutIsInitialized() const override { return true; } 74 int32_t RecordingIsAvailable(bool* /* available */) override { return 0; } 75 int32_t InitRecording() override { return 0; } 76 bool RecordingIsInitialized() const override { return true; } 77 int32_t StartPlayout() override { return 0; } 78 bool Playing() const override { return false; } 79 int32_t StartRecording() override { return 0; } 80 bool Recording() const override { return false; } 81 bool SpeakerIsInitialized() const override { return true; } 82 bool MicrophoneIsInitialized() const override { return true; } 83 int32_t SpeakerVolumeIsAvailable(bool* /* available */) override { return 0; } 84 int32_t SetSpeakerVolume(uint32_t /* volume */) override { return 0; } 85 int32_t SpeakerVolume(uint32_t* /* volume */) const override { return 0; } 86 int32_t MaxSpeakerVolume(uint32_t* /* maxVolume */) const override { 87 return 0; 88 } 89 int32_t MinSpeakerVolume(uint32_t* /* minVolume */) const override { 90 return 0; 91 } 92 int32_t MicrophoneVolumeIsAvailable(bool* /* available */) override { 93 return 0; 94 } 95 int32_t SetMicrophoneVolume(uint32_t /* volume */) override { return 0; } 96 int32_t MicrophoneVolume(uint32_t* /* volume */) const override { return 0; } 97 int32_t MaxMicrophoneVolume(uint32_t* /* maxVolume */) const override { 98 return 0; 99 } 100 int32_t MinMicrophoneVolume(uint32_t* /* minVolume */) const override { 101 return 0; 102 } 103 int32_t SpeakerMuteIsAvailable(bool* /* available */) override { return 0; } 104 int32_t SetSpeakerMute(bool /* enable */) override { return 0; } 105 int32_t SpeakerMute(bool* /* enabled */) const override { return 0; } 106 int32_t MicrophoneMuteIsAvailable(bool* /* available */) override { 107 return 0; 108 } 109 int32_t SetMicrophoneMute(bool /* enable */) override { return 0; } 110 int32_t MicrophoneMute(bool* /* enabled */) const override { return 0; } 111 int32_t StereoPlayoutIsAvailable(bool* available) const override { 112 *available = false; 113 return 0; 114 } 115 int32_t StereoPlayout(bool* /* enabled */) const override { return 0; } 116 int32_t StereoRecordingIsAvailable(bool* available) const override { 117 *available = false; 118 return 0; 119 } 120 int32_t StereoRecording(bool* /* enabled */) const override { return 0; } 121 int32_t PlayoutDelay(uint16_t* delayMS) const override { 122 *delayMS = 0; 123 return 0; 124 } 125 bool BuiltInAECIsAvailable() const override { return false; } 126 int32_t EnableBuiltInAEC(bool /* enable */) override { return -1; } 127 bool BuiltInAGCIsAvailable() const override { return false; } 128 int32_t EnableBuiltInAGC(bool /* enable */) override { return -1; } 129 bool BuiltInNSIsAvailable() const override { return false; } 130 int32_t EnableBuiltInNS(bool /* enable */) override { return -1; } 131 132 int32_t GetPlayoutUnderrunCount() const override { return -1; } 133 134 #if defined(WEBRTC_IOS) 135 int GetPlayoutAudioParameters(AudioParameters* params) const override { 136 return -1; 137 } 138 int GetRecordAudioParameters(AudioParameters* params) const override { 139 return -1; 140 } 141 #endif // WEBRTC_IOS 142 }; 143 144 } // namespace webrtc_impl 145 } // namespace webrtc 146 147 #endif // MODULES_AUDIO_DEVICE_INCLUDE_AUDIO_DEVICE_DEFAULT_H_