niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 1 | /* |
bjornv@webrtc.org | 0c6f931 | 2012-01-30 09:39:08 +0000 | [diff] [blame] | 2 | * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 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 | |
bjornv@webrtc.org | 0c6f931 | 2012-01-30 09:39:08 +0000 | [diff] [blame] | 11 | #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_PROCESSING_COMPONENT_H_ |
| 12 | #define WEBRTC_MODULES_AUDIO_PROCESSING_PROCESSING_COMPONENT_H_ |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 13 | |
| 14 | #include <vector> |
| 15 | |
andrew@webrtc.org | 56e4a05 | 2014-02-27 22:23:17 +0000 | [diff] [blame] | 16 | #include "webrtc/common.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 17 | |
| 18 | namespace webrtc { |
andrew@webrtc.org | 61e596f | 2013-07-25 18:28:29 +0000 | [diff] [blame] | 19 | |
peah | fa6228e | 2015-11-16 16:27:42 -0800 | [diff] [blame] | 20 | // Functor to use when supplying a verifier function for the queue item |
| 21 | // verifcation. |
| 22 | template <typename T> |
| 23 | class RenderQueueItemVerifier { |
| 24 | public: |
| 25 | explicit RenderQueueItemVerifier(size_t minimum_capacity) |
| 26 | : minimum_capacity_(minimum_capacity) {} |
| 27 | |
| 28 | bool operator()(const std::vector<T>& v) const { |
| 29 | return v.capacity() >= minimum_capacity_; |
| 30 | } |
| 31 | |
| 32 | private: |
| 33 | size_t minimum_capacity_; |
| 34 | }; |
| 35 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 36 | class ProcessingComponent { |
| 37 | public: |
pbos@webrtc.org | 9162080 | 2013-08-02 11:44:11 +0000 | [diff] [blame] | 38 | ProcessingComponent(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 39 | virtual ~ProcessingComponent(); |
| 40 | |
| 41 | virtual int Initialize(); |
andrew@webrtc.org | 61e596f | 2013-07-25 18:28:29 +0000 | [diff] [blame] | 42 | virtual void SetExtraOptions(const Config& config) {} |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 43 | virtual int Destroy(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 44 | |
andrew@webrtc.org | 755b04a | 2011-11-15 16:57:56 +0000 | [diff] [blame] | 45 | bool is_component_enabled() const; |
| 46 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 47 | protected: |
| 48 | virtual int Configure(); |
| 49 | int EnableComponent(bool enable); |
Peter Kasting | 6955870 | 2016-01-12 16:26:35 -0800 | [diff] [blame] | 50 | void* handle(size_t index) const; |
| 51 | size_t num_handles() const; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 52 | |
| 53 | private: |
| 54 | virtual void* CreateHandle() const = 0; |
| 55 | virtual int InitializeHandle(void* handle) const = 0; |
| 56 | virtual int ConfigureHandle(void* handle) const = 0; |
bjornv@webrtc.org | 5964fe0 | 2014-04-22 06:52:28 +0000 | [diff] [blame] | 57 | virtual void DestroyHandle(void* handle) const = 0; |
Peter Kasting | 6955870 | 2016-01-12 16:26:35 -0800 | [diff] [blame] | 58 | virtual size_t num_handles_required() const = 0; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 59 | virtual int GetHandleError(void* handle) const = 0; |
| 60 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 61 | std::vector<void*> handles_; |
| 62 | bool initialized_; |
| 63 | bool enabled_; |
Peter Kasting | 6955870 | 2016-01-12 16:26:35 -0800 | [diff] [blame] | 64 | size_t num_handles_; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 65 | }; |
andrew@webrtc.org | 61e596f | 2013-07-25 18:28:29 +0000 | [diff] [blame] | 66 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 67 | } // namespace webrtc |
| 68 | |
bjornv@webrtc.org | 0c6f931 | 2012-01-30 09:39:08 +0000 | [diff] [blame] | 69 | #endif // WEBRTC_MODULES_AUDIO_PROCESSING_PROCESSING_COMPONENT_H__ |