| OLD | NEW |
| (Empty) |
| 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 #ifndef WEBRTC_VOICE_ENGINE_VOE_EXTERNAL_MEDIA_H | |
| 11 #define WEBRTC_VOICE_ENGINE_VOE_EXTERNAL_MEDIA_H | |
| 12 | |
| 13 #include "webrtc/common_types.h" | |
| 14 | |
| 15 namespace webrtc { | |
| 16 | |
| 17 class VoiceEngine; | |
| 18 class AudioFrame; | |
| 19 | |
| 20 class WEBRTC_DLLEXPORT VoEMediaProcess { | |
| 21 public: | |
| 22 // The VoiceEngine user should override the Process() method in a | |
| 23 // derived class. Process() will be called when audio is ready to | |
| 24 // be processed. The audio can be accessed in several different modes | |
| 25 // given by the |type| parameter. The function should modify the | |
| 26 // original data and ensure that it is copied back to the |audio10ms| | |
| 27 // array. The number of samples in the frame cannot be changed. | |
| 28 // The sampling frequency will depend upon the codec used. | |
| 29 // If |isStereo| is true, audio10ms will contain 16-bit PCM data | |
| 30 // samples in interleaved stereo format (L0,R0,L1,R1,...). | |
| 31 virtual void Process(int channel, | |
| 32 ProcessingTypes type, | |
| 33 int16_t audio10ms[], | |
| 34 size_t length, | |
| 35 int samplingFreq, | |
| 36 bool isStereo) = 0; | |
| 37 | |
| 38 protected: | |
| 39 virtual ~VoEMediaProcess() {} | |
| 40 }; | |
| 41 | |
| 42 class WEBRTC_DLLEXPORT VoEExternalMedia { | |
| 43 public: | |
| 44 // Factory for the VoEExternalMedia sub-API. Increases an internal | |
| 45 // reference counter if successful. Returns NULL if the API is not | |
| 46 // supported or if construction fails. | |
| 47 static VoEExternalMedia* GetInterface(VoiceEngine* voiceEngine); | |
| 48 | |
| 49 // Releases the VoEExternalMedia sub-API and decreases an internal | |
| 50 // reference counter. Returns the new reference count. This value should | |
| 51 // be zero for all sub-API:s before the VoiceEngine object can be safely | |
| 52 // deleted. | |
| 53 virtual int Release() = 0; | |
| 54 | |
| 55 // Installs a VoEMediaProcess derived instance and activates external | |
| 56 // media for the specified |channel| and |type|. | |
| 57 virtual int RegisterExternalMediaProcessing( | |
| 58 int channel, | |
| 59 ProcessingTypes type, | |
| 60 VoEMediaProcess& processObject) = 0; | |
| 61 | |
| 62 // Removes the VoEMediaProcess derived instance and deactivates external | |
| 63 // media for the specified |channel| and |type|. | |
| 64 virtual int DeRegisterExternalMediaProcessing(int channel, | |
| 65 ProcessingTypes type) = 0; | |
| 66 | |
| 67 // Pulls an audio frame from the specified |channel| for external mixing. | |
| 68 // If the |desired_sample_rate_hz| is 0, the signal will be returned with | |
| 69 // its native frequency, otherwise it will be resampled. Valid frequencies | |
| 70 // are 16, 22, 32, 44 or 48 kHz. | |
| 71 virtual int GetAudioFrame(int channel, | |
| 72 int desired_sample_rate_hz, | |
| 73 AudioFrame* frame) = 0; | |
| 74 | |
| 75 // Sets the state of external mixing. Cannot be changed during playback. | |
| 76 virtual int SetExternalMixing(int channel, bool enable) = 0; | |
| 77 | |
| 78 protected: | |
| 79 VoEExternalMedia() {} | |
| 80 virtual ~VoEExternalMedia() {} | |
| 81 }; | |
| 82 | |
| 83 } // namespace webrtc | |
| 84 | |
| 85 #endif // WEBRTC_VOICE_ENGINE_VOE_EXTERNAL_MEDIA_H | |
| OLD | NEW |