niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 1 | /* |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +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 | |
| 11 | #ifndef WEBRTC_VOICE_ENGINE_VOE_FILE_IMPL_H |
| 12 | #define WEBRTC_VOICE_ENGINE_VOE_FILE_IMPL_H |
| 13 | |
pbos@webrtc.org | 956aa7e | 2013-05-21 13:52:32 +0000 | [diff] [blame^] | 14 | #include "webrtc/voice_engine/include/voe_file.h" |
| 15 | #include "webrtc/voice_engine/shared_data.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 16 | |
| 17 | namespace webrtc { |
| 18 | |
tommi@webrtc.org | a990e12 | 2012-04-26 15:28:22 +0000 | [diff] [blame] | 19 | class VoEFileImpl : public VoEFile |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 20 | { |
| 21 | public: |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 22 | // Playout file locally |
| 23 | |
| 24 | virtual int StartPlayingFileLocally( |
| 25 | int channel, |
| 26 | const char fileNameUTF8[1024], |
| 27 | bool loop = false, |
| 28 | FileFormats format = kFileFormatPcm16kHzFile, |
| 29 | float volumeScaling = 1.0, |
| 30 | int startPointMs = 0, |
| 31 | int stopPointMs = 0); |
| 32 | |
| 33 | virtual int StartPlayingFileLocally( |
| 34 | int channel, |
| 35 | InStream* stream, |
| 36 | FileFormats format = kFileFormatPcm16kHzFile, |
| 37 | float volumeScaling = 1.0, |
| 38 | int startPointMs = 0, int stopPointMs = 0); |
| 39 | |
| 40 | virtual int StopPlayingFileLocally(int channel); |
| 41 | |
| 42 | virtual int IsPlayingFileLocally(int channel); |
| 43 | |
| 44 | virtual int ScaleLocalFilePlayout(int channel, float scale); |
| 45 | |
| 46 | // Use file as microphone input |
| 47 | |
| 48 | virtual int StartPlayingFileAsMicrophone( |
| 49 | int channel, |
| 50 | const char fileNameUTF8[1024], |
| 51 | bool loop = false , |
| 52 | bool mixWithMicrophone = false, |
| 53 | FileFormats format = kFileFormatPcm16kHzFile, |
| 54 | float volumeScaling = 1.0); |
| 55 | |
| 56 | virtual int StartPlayingFileAsMicrophone( |
| 57 | int channel, |
| 58 | InStream* stream, |
| 59 | bool mixWithMicrophone = false, |
| 60 | FileFormats format = kFileFormatPcm16kHzFile, |
| 61 | float volumeScaling = 1.0); |
| 62 | |
| 63 | virtual int StopPlayingFileAsMicrophone(int channel); |
| 64 | |
| 65 | virtual int IsPlayingFileAsMicrophone(int channel); |
| 66 | |
| 67 | virtual int ScaleFileAsMicrophonePlayout(int channel, float scale); |
| 68 | |
| 69 | // Record speaker signal to file |
| 70 | |
| 71 | virtual int StartRecordingPlayout(int channel, |
| 72 | const char* fileNameUTF8, |
| 73 | CodecInst* compression = NULL, |
| 74 | int maxSizeBytes = -1); |
| 75 | |
| 76 | virtual int StartRecordingPlayout(int channel, |
| 77 | OutStream* stream, |
| 78 | CodecInst* compression = NULL); |
| 79 | |
| 80 | virtual int StopRecordingPlayout(int channel); |
| 81 | |
| 82 | // Record microphone signal to file |
| 83 | |
| 84 | virtual int StartRecordingMicrophone(const char* fileNameUTF8, |
| 85 | CodecInst* compression = NULL, |
| 86 | int maxSizeBytes = -1); |
| 87 | |
| 88 | virtual int StartRecordingMicrophone(OutStream* stream, |
| 89 | CodecInst* compression = NULL); |
| 90 | |
| 91 | virtual int StopRecordingMicrophone(); |
| 92 | |
| 93 | // Conversion between different file formats |
| 94 | |
| 95 | virtual int ConvertPCMToWAV(const char* fileNameInUTF8, |
| 96 | const char* fileNameOutUTF8); |
| 97 | |
| 98 | virtual int ConvertPCMToWAV(InStream* streamIn, |
| 99 | OutStream* streamOut); |
| 100 | |
| 101 | virtual int ConvertWAVToPCM(const char* fileNameInUTF8, |
| 102 | const char* fileNameOutUTF8); |
| 103 | |
| 104 | virtual int ConvertWAVToPCM(InStream* streamIn, |
| 105 | OutStream* streamOut); |
| 106 | |
| 107 | virtual int ConvertPCMToCompressed(const char* fileNameInUTF8, |
| 108 | const char* fileNameOutUTF8, |
| 109 | CodecInst* compression); |
| 110 | |
| 111 | virtual int ConvertPCMToCompressed(InStream* streamIn, |
| 112 | OutStream* streamOut, |
| 113 | CodecInst* compression); |
| 114 | |
| 115 | virtual int ConvertCompressedToPCM(const char* fileNameInUTF8, |
| 116 | const char* fileNameOutUTF8); |
| 117 | |
| 118 | virtual int ConvertCompressedToPCM(InStream* streamIn, |
| 119 | OutStream* streamOut); |
| 120 | |
| 121 | // Misc file functions |
| 122 | |
| 123 | virtual int GetFileDuration( |
| 124 | const char* fileNameUTF8, |
| 125 | int& durationMs, |
| 126 | FileFormats format = kFileFormatPcm16kHzFile); |
| 127 | |
| 128 | virtual int GetPlaybackPosition(int channel, int& positionMs); |
| 129 | |
| 130 | protected: |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 131 | VoEFileImpl(voe::SharedData* shared); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 132 | virtual ~VoEFileImpl(); |
| 133 | |
tommi@webrtc.org | 851becd | 2012-04-04 14:57:19 +0000 | [diff] [blame] | 134 | private: |
| 135 | voe::SharedData* _shared; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 136 | }; |
| 137 | |
| 138 | } // namespace webrtc |
| 139 | |
| 140 | #endif // WEBRTC_VOICE_ENGINE_VOE_FILE_IMPL_H |