blob: c090d22245685a41e69e962dc3b3ddbe63b9c8d9 [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
bjornv@webrtc.org0c6f9312012-01-30 09:39:08 +00002 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
niklase@google.com470e71d2011-07-07 08:21:25 +00003 *
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
bjornv@webrtc.org0c6f9312012-01-30 09:39:08 +000011#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_PROCESSING_COMPONENT_H_
12#define WEBRTC_MODULES_AUDIO_PROCESSING_PROCESSING_COMPONENT_H_
niklase@google.com470e71d2011-07-07 08:21:25 +000013
14#include <vector>
15
pbos@webrtc.org7fad4b82013-05-28 08:11:59 +000016#include "webrtc/modules/audio_processing/include/audio_processing.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000017
18namespace webrtc {
andrew@webrtc.org61e596f2013-07-25 18:28:29 +000019
niklase@google.com470e71d2011-07-07 08:21:25 +000020class AudioProcessingImpl;
21
niklase@google.com470e71d2011-07-07 08:21:25 +000022class ProcessingComponent {
23 public:
pbos@webrtc.org91620802013-08-02 11:44:11 +000024 ProcessingComponent();
niklase@google.com470e71d2011-07-07 08:21:25 +000025 explicit ProcessingComponent(const AudioProcessingImpl* apm);
26 virtual ~ProcessingComponent();
27
28 virtual int Initialize();
andrew@webrtc.org61e596f2013-07-25 18:28:29 +000029 virtual void SetExtraOptions(const Config& config) {}
niklase@google.com470e71d2011-07-07 08:21:25 +000030 virtual int Destroy();
niklase@google.com470e71d2011-07-07 08:21:25 +000031
andrew@webrtc.org755b04a2011-11-15 16:57:56 +000032 bool is_component_enabled() const;
33
niklase@google.com470e71d2011-07-07 08:21:25 +000034 protected:
35 virtual int Configure();
36 int EnableComponent(bool enable);
niklase@google.com470e71d2011-07-07 08:21:25 +000037 void* handle(int index) const;
38 int num_handles() const;
39
40 private:
41 virtual void* CreateHandle() const = 0;
42 virtual int InitializeHandle(void* handle) const = 0;
43 virtual int ConfigureHandle(void* handle) const = 0;
44 virtual int DestroyHandle(void* handle) const = 0;
45 virtual int num_handles_required() const = 0;
46 virtual int GetHandleError(void* handle) const = 0;
47
48 const AudioProcessingImpl* apm_;
49 std::vector<void*> handles_;
50 bool initialized_;
51 bool enabled_;
52 int num_handles_;
53};
andrew@webrtc.org61e596f2013-07-25 18:28:29 +000054
niklase@google.com470e71d2011-07-07 08:21:25 +000055} // namespace webrtc
56
bjornv@webrtc.org0c6f9312012-01-30 09:39:08 +000057#endif // WEBRTC_MODULES_AUDIO_PROCESSING_PROCESSING_COMPONENT_H__