1 /* 2 * Copyright (c) 2011 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 WEBRTC_MODULES_AUDIO_PROCESSING_MAIN_SOURCE_PROCESSING_COMPONENT_H_ 12 #define WEBRTC_MODULES_AUDIO_PROCESSING_MAIN_SOURCE_PROCESSING_COMPONENT_H_ 13 14 #include <vector> 15 16 #include "audio_processing.h" 17 18 namespace webrtc { 19 class AudioProcessingImpl; 20 21 /*template <class T> 22 class ComponentHandle { 23 public: 24 ComponentHandle(); 25 virtual ~ComponentHandle(); 26 27 virtual int Create() = 0; 28 virtual T* ptr() const = 0; 29 };*/ 30 31 class ProcessingComponent { 32 public: 33 explicit ProcessingComponent(const AudioProcessingImpl* apm); 34 virtual ~ProcessingComponent(); 35 36 virtual int Initialize(); 37 virtual int Destroy(); 38 virtual int get_version(char* version, int version_len_bytes) const = 0; 39 40 protected: 41 virtual int Configure(); 42 int EnableComponent(bool enable); 43 bool is_component_enabled() const; 44 void* handle(int index) const; 45 int num_handles() const; 46 47 private: 48 virtual void* CreateHandle() const = 0; 49 virtual int InitializeHandle(void* handle) const = 0; 50 virtual int ConfigureHandle(void* handle) const = 0; 51 virtual int DestroyHandle(void* handle) const = 0; 52 virtual int num_handles_required() const = 0; 53 virtual int GetHandleError(void* handle) const = 0; 54 55 const AudioProcessingImpl* apm_; 56 std::vector<void*> handles_; 57 bool initialized_; 58 bool enabled_; 59 int num_handles_; 60 }; 61 } // namespace webrtc 62 63 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_MAIN_SOURCE_PROCESSING_COMPONENT_H__ 64