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_VOICE_ENGINE_VOICE_ENGINE_IMPL_H
12#define WEBRTC_VOICE_ENGINE_VOICE_ENGINE_IMPL_H
13
14#include "webrtc/engine_configurations.h"
15#include "webrtc/system_wrappers/interface/atomic32.h"
16#include "webrtc/voice_engine/voe_base_impl.h"
17
18#ifdef WEBRTC_VOICE_ENGINE_AUDIO_PROCESSING_API
19#include "webrtc/voice_engine/voe_audio_processing_impl.h"
20#endif
21#ifdef WEBRTC_VOICE_ENGINE_CODEC_API
22#include "webrtc/voice_engine/voe_codec_impl.h"
23#endif
24#ifdef WEBRTC_VOICE_ENGINE_DTMF_API
25#include "webrtc/voice_engine/voe_dtmf_impl.h"
26#endif
27#ifdef WEBRTC_VOICE_ENGINE_EXTERNAL_MEDIA_API
28#include "webrtc/voice_engine/voe_external_media_impl.h"
29#endif
30#ifdef WEBRTC_VOICE_ENGINE_FILE_API
31#include "webrtc/voice_engine/voe_file_impl.h"
32#endif
33#ifdef WEBRTC_VOICE_ENGINE_HARDWARE_API
34#include "webrtc/voice_engine/voe_hardware_impl.h"
35#endif
36#ifdef WEBRTC_VOICE_ENGINE_NETEQ_STATS_API
37#include "webrtc/voice_engine/voe_neteq_stats_impl.h"
38#endif
39#include "webrtc/voice_engine/voe_network_impl.h"
40#ifdef WEBRTC_VOICE_ENGINE_RTP_RTCP_API
41#include "webrtc/voice_engine/voe_rtp_rtcp_impl.h"
42#endif
43#ifdef WEBRTC_VOICE_ENGINE_VIDEO_SYNC_API
44#include "webrtc/voice_engine/voe_video_sync_impl.h"
45#endif
46#ifdef WEBRTC_VOICE_ENGINE_VOLUME_CONTROL_API
47#include "webrtc/voice_engine/voe_volume_control_impl.h"
48#endif
49
50namespace webrtc
51{
52
53class VoiceEngineImpl : public voe::SharedData,  // Must be the first base class
54                        public VoiceEngine,
55#ifdef WEBRTC_VOICE_ENGINE_AUDIO_PROCESSING_API
56                        public VoEAudioProcessingImpl,
57#endif
58#ifdef WEBRTC_VOICE_ENGINE_CODEC_API
59                        public VoECodecImpl,
60#endif
61#ifdef WEBRTC_VOICE_ENGINE_DTMF_API
62                        public VoEDtmfImpl,
63#endif
64#ifdef WEBRTC_VOICE_ENGINE_EXTERNAL_MEDIA_API
65                        public VoEExternalMediaImpl,
66#endif
67#ifdef WEBRTC_VOICE_ENGINE_FILE_API
68                        public VoEFileImpl,
69#endif
70#ifdef WEBRTC_VOICE_ENGINE_HARDWARE_API
71                        public VoEHardwareImpl,
72#endif
73#ifdef WEBRTC_VOICE_ENGINE_NETEQ_STATS_API
74                        public VoENetEqStatsImpl,
75#endif
76                        public VoENetworkImpl,
77#ifdef WEBRTC_VOICE_ENGINE_RTP_RTCP_API
78                        public VoERTP_RTCPImpl,
79#endif
80#ifdef WEBRTC_VOICE_ENGINE_VIDEO_SYNC_API
81                        public VoEVideoSyncImpl,
82#endif
83#ifdef WEBRTC_VOICE_ENGINE_VOLUME_CONTROL_API
84                        public VoEVolumeControlImpl,
85#endif
86                        public VoEBaseImpl
87{
88public:
89    VoiceEngineImpl(const Config* config, bool owns_config) :
90        SharedData(*config),
91#ifdef WEBRTC_VOICE_ENGINE_AUDIO_PROCESSING_API
92        VoEAudioProcessingImpl(this),
93#endif
94#ifdef WEBRTC_VOICE_ENGINE_CODEC_API
95        VoECodecImpl(this),
96#endif
97#ifdef WEBRTC_VOICE_ENGINE_DTMF_API
98        VoEDtmfImpl(this),
99#endif
100#ifdef WEBRTC_VOICE_ENGINE_EXTERNAL_MEDIA_API
101        VoEExternalMediaImpl(this),
102#endif
103#ifdef WEBRTC_VOICE_ENGINE_FILE_API
104        VoEFileImpl(this),
105#endif
106#ifdef WEBRTC_VOICE_ENGINE_HARDWARE_API
107        VoEHardwareImpl(this),
108#endif
109#ifdef WEBRTC_VOICE_ENGINE_NETEQ_STATS_API
110        VoENetEqStatsImpl(this),
111#endif
112        VoENetworkImpl(this),
113#ifdef WEBRTC_VOICE_ENGINE_RTP_RTCP_API
114        VoERTP_RTCPImpl(this),
115#endif
116#ifdef WEBRTC_VOICE_ENGINE_VIDEO_SYNC_API
117        VoEVideoSyncImpl(this),
118#endif
119#ifdef WEBRTC_VOICE_ENGINE_VOLUME_CONTROL_API
120        VoEVolumeControlImpl(this),
121#endif
122        VoEBaseImpl(this),
123        _ref_count(0),
124        own_config_(owns_config ? config : NULL)
125    {
126    }
127    virtual ~VoiceEngineImpl()
128    {
129        assert(_ref_count.Value() == 0);
130    }
131
132    int AddRef();
133
134    // This implements the Release() method for all the inherited interfaces.
135    virtual int Release();
136
137private:
138    Atomic32 _ref_count;
139    scoped_ptr<const Config> own_config_;
140};
141
142}  // namespace webrtc
143
144#endif // WEBRTC_VOICE_ENGINE_VOICE_ENGINE_IMPL_H
145