Home | History | Annotate | Download | only in audio_processing
      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 class ProcessingComponent {
     22  public:
     23   explicit ProcessingComponent(const AudioProcessingImpl* apm);
     24   virtual ~ProcessingComponent();
     25 
     26   virtual int Initialize();
     27   virtual int Destroy();
     28   virtual int get_version(char* version, int version_len_bytes) const = 0;
     29 
     30   bool is_component_enabled() const;
     31 
     32  protected:
     33   virtual int Configure();
     34   int EnableComponent(bool enable);
     35   void* handle(int index) const;
     36   int num_handles() const;
     37 
     38  private:
     39   virtual void* CreateHandle() const = 0;
     40   virtual int InitializeHandle(void* handle) const = 0;
     41   virtual int ConfigureHandle(void* handle) const = 0;
     42   virtual int DestroyHandle(void* handle) const = 0;
     43   virtual int num_handles_required() const = 0;
     44   virtual int GetHandleError(void* handle) const = 0;
     45 
     46   const AudioProcessingImpl* apm_;
     47   std::vector<void*> handles_;
     48   bool initialized_;
     49   bool enabled_;
     50   int num_handles_;
     51 };
     52 }  // namespace webrtc
     53 
     54 #endif  // WEBRTC_MODULES_AUDIO_PROCESSING_MAIN_SOURCE_PROCESSING_COMPONENT_H__
     55