Artem Titov | 0f03973 | 2018-03-07 11:20:51 | [diff] [blame] | 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 "modules/audio_device/include/audio_device.h" |
| 15 | |
| 16 | namespace webrtc { |
| 17 | namespace webrtc_impl { |
| 18 | |
| 19 | // AudioDeviceModuleDefault template adds default implementation for all |
| 20 | // AudioDeviceModule methods to the class, which inherits from |
| 21 | // AudioDeviceModuleDefault<T>. |
| 22 | template <typename T> |
| 23 | class AudioDeviceModuleDefault : public T { |
| 24 | public: |
| 25 | AudioDeviceModuleDefault() {} |
| 26 | virtual ~AudioDeviceModuleDefault() {} |
| 27 | |
| 28 | int32_t RegisterAudioCallback(AudioTransport* audioCallback) override { |
| 29 | return 0; |
| 30 | } |
| 31 | int32_t Init() override { return 0; } |
| 32 | int32_t InitSpeaker() override { return 0; } |
| 33 | int32_t SetPlayoutDevice(uint16_t index) override { return 0; } |
| 34 | int32_t SetPlayoutDevice( |
| 35 | AudioDeviceModule::WindowsDeviceType device) override { |
| 36 | return 0; |
| 37 | } |
| 38 | int32_t SetStereoPlayout(bool enable) override { return 0; } |
| 39 | int32_t StopPlayout() override { return 0; } |
| 40 | int32_t InitMicrophone() override { return 0; } |
| 41 | int32_t SetRecordingDevice(uint16_t index) override { return 0; } |
| 42 | int32_t SetRecordingDevice( |
| 43 | AudioDeviceModule::WindowsDeviceType device) override { |
| 44 | return 0; |
| 45 | } |
| 46 | int32_t SetStereoRecording(bool enable) override { return 0; } |
| 47 | int32_t StopRecording() override { return 0; } |
| 48 | |
| 49 | int32_t Terminate() override { return 0; } |
| 50 | |
| 51 | int32_t ActiveAudioLayer( |
| 52 | AudioDeviceModule::AudioLayer* audioLayer) const override { |
| 53 | return 0; |
| 54 | } |
| 55 | bool Initialized() const override { return true; } |
| 56 | int16_t PlayoutDevices() override { return 0; } |
| 57 | int16_t RecordingDevices() override { return 0; } |
| 58 | int32_t PlayoutDeviceName(uint16_t index, |
| 59 | char name[kAdmMaxDeviceNameSize], |
| 60 | char guid[kAdmMaxGuidSize]) override { |
| 61 | return 0; |
| 62 | } |
| 63 | int32_t RecordingDeviceName(uint16_t index, |
| 64 | char name[kAdmMaxDeviceNameSize], |
| 65 | char guid[kAdmMaxGuidSize]) override { |
| 66 | return 0; |
| 67 | } |
| 68 | int32_t PlayoutIsAvailable(bool* available) override { return 0; } |
| 69 | int32_t InitPlayout() override { return 0; } |
| 70 | bool PlayoutIsInitialized() const override { return true; } |
| 71 | int32_t RecordingIsAvailable(bool* available) override { return 0; } |
| 72 | int32_t InitRecording() override { return 0; } |
| 73 | bool RecordingIsInitialized() const override { return true; } |
| 74 | int32_t StartPlayout() override { return 0; } |
| 75 | bool Playing() const override { return false; } |
| 76 | int32_t StartRecording() override { return 0; } |
| 77 | bool Recording() const override { return false; } |
| 78 | bool SpeakerIsInitialized() const override { return true; } |
| 79 | bool MicrophoneIsInitialized() const override { return true; } |
| 80 | int32_t SpeakerVolumeIsAvailable(bool* available) override { return 0; } |
| 81 | int32_t SetSpeakerVolume(uint32_t volume) override { return 0; } |
| 82 | int32_t SpeakerVolume(uint32_t* volume) const override { return 0; } |
| 83 | int32_t MaxSpeakerVolume(uint32_t* maxVolume) const override { return 0; } |
| 84 | int32_t MinSpeakerVolume(uint32_t* minVolume) const override { return 0; } |
| 85 | int32_t MicrophoneVolumeIsAvailable(bool* available) override { return 0; } |
| 86 | int32_t SetMicrophoneVolume(uint32_t volume) override { return 0; } |
| 87 | int32_t MicrophoneVolume(uint32_t* volume) const override { return 0; } |
| 88 | int32_t MaxMicrophoneVolume(uint32_t* maxVolume) const override { return 0; } |
| 89 | int32_t MinMicrophoneVolume(uint32_t* minVolume) const override { return 0; } |
| 90 | int32_t SpeakerMuteIsAvailable(bool* available) override { return 0; } |
| 91 | int32_t SetSpeakerMute(bool enable) override { return 0; } |
| 92 | int32_t SpeakerMute(bool* enabled) const override { return 0; } |
| 93 | int32_t MicrophoneMuteIsAvailable(bool* available) override { return 0; } |
| 94 | int32_t SetMicrophoneMute(bool enable) override { return 0; } |
| 95 | int32_t MicrophoneMute(bool* enabled) const override { return 0; } |
| 96 | int32_t StereoPlayoutIsAvailable(bool* available) const override { |
| 97 | *available = false; |
| 98 | return 0; |
| 99 | } |
| 100 | int32_t StereoPlayout(bool* enabled) const override { return 0; } |
| 101 | int32_t StereoRecordingIsAvailable(bool* available) const override { |
| 102 | *available = false; |
| 103 | return 0; |
| 104 | } |
| 105 | int32_t StereoRecording(bool* enabled) const override { return 0; } |
| 106 | int32_t PlayoutDelay(uint16_t* delayMS) const override { |
| 107 | *delayMS = 0; |
| 108 | return 0; |
| 109 | } |
| 110 | bool BuiltInAECIsAvailable() const override { return false; } |
| 111 | int32_t EnableBuiltInAEC(bool enable) override { return -1; } |
| 112 | bool BuiltInAGCIsAvailable() const override { return false; } |
| 113 | int32_t EnableBuiltInAGC(bool enable) override { return -1; } |
| 114 | bool BuiltInNSIsAvailable() const override { return false; } |
| 115 | int32_t EnableBuiltInNS(bool enable) override { return -1; } |
| 116 | |
| 117 | #if defined(WEBRTC_IOS) |
| 118 | int GetPlayoutAudioParameters(AudioParameters* params) const override { |
| 119 | return -1; |
| 120 | } |
| 121 | int GetRecordAudioParameters(AudioParameters* params) const override { |
| 122 | return -1; |
| 123 | } |
| 124 | #endif // WEBRTC_IOS |
| 125 | }; |
| 126 | |
| 127 | } // namespace webrtc_impl |
| 128 | } // namespace webrtc |
| 129 | |
| 130 | #endif // MODULES_AUDIO_DEVICE_INCLUDE_AUDIO_DEVICE_DEFAULT_H_ |