1 /*
2  *  Copyright (c) 2012 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_PROCESSING_COMPONENT_H_
12 #define WEBRTC_MODULES_AUDIO_PROCESSING_PROCESSING_COMPONENT_H_
13 
14 #include <vector>
15 
16 #include "webrtc/common.h"
17 
18 namespace webrtc {
19 
20 class ProcessingComponent {
21  public:
22   ProcessingComponent();
23   virtual ~ProcessingComponent();
24 
25   virtual int Initialize();
26   virtual void SetExtraOptions(const Config& config) {}
27   virtual int Destroy();
28 
29   bool is_component_enabled() const;
30 
31  protected:
32   virtual int Configure();
33   int EnableComponent(bool enable);
34   void* handle(int index) const;
35   int num_handles() const;
36 
37  private:
38   virtual void* CreateHandle() const = 0;
39   virtual int InitializeHandle(void* handle) const = 0;
40   virtual int ConfigureHandle(void* handle) const = 0;
41   virtual void DestroyHandle(void* handle) const = 0;
42   virtual int num_handles_required() const = 0;
43   virtual int GetHandleError(void* handle) const = 0;
44 
45   std::vector<void*> handles_;
46   bool initialized_;
47   bool enabled_;
48   int num_handles_;
49 };
50 
51 }  // namespace webrtc
52 
53 #endif  // WEBRTC_MODULES_AUDIO_PROCESSING_PROCESSING_COMPONENT_H__
54