blob: f43d4f1426fe5681742408f373d530a0f5042d11 [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
tommi@webrtc.org851becd2012-04-04 14:57:19 +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
11#ifndef WEBRTC_VOICE_ENGINE_VOE_FILE_IMPL_H
12#define WEBRTC_VOICE_ENGINE_VOE_FILE_IMPL_H
13
pbos@webrtc.org956aa7e2013-05-21 13:52:32 +000014#include "webrtc/voice_engine/include/voe_file.h"
15#include "webrtc/voice_engine/shared_data.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000016
17namespace webrtc {
18
tommi@webrtc.orga990e122012-04-26 15:28:22 +000019class VoEFileImpl : public VoEFile
niklase@google.com470e71d2011-07-07 08:21:25 +000020{
21public:
niklase@google.com470e71d2011-07-07 08:21:25 +000022 // 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
130protected:
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000131 VoEFileImpl(voe::SharedData* shared);
niklase@google.com470e71d2011-07-07 08:21:25 +0000132 virtual ~VoEFileImpl();
133
tommi@webrtc.org851becd2012-04-04 14:57:19 +0000134private:
135 voe::SharedData* _shared;
niklase@google.com470e71d2011-07-07 08:21:25 +0000136};
137
138} // namespace webrtc
139
140#endif // WEBRTC_VOICE_ENGINE_VOE_FILE_IMPL_H