OLD | NEW |
| (Empty) |
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_MODULES_UTILITY_SOURCE_FILE_PLAYER_IMPL_H_ | |
12 #define WEBRTC_MODULES_UTILITY_SOURCE_FILE_PLAYER_IMPL_H_ | |
13 | |
14 #include "webrtc/common_audio/resampler/include/resampler.h" | |
15 #include "webrtc/common_types.h" | |
16 #include "webrtc/engine_configurations.h" | |
17 #include "webrtc/modules/media_file/media_file.h" | |
18 #include "webrtc/modules/media_file/media_file_defines.h" | |
19 #include "webrtc/modules/utility/include/file_player.h" | |
20 #include "webrtc/modules/utility/source/coder.h" | |
21 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" | |
22 #include "webrtc/typedefs.h" | |
23 | |
24 namespace webrtc { | |
25 class FilePlayerImpl : public FilePlayer { | |
26 public: | |
27 FilePlayerImpl(uint32_t instanceID, FileFormats fileFormat); | |
28 ~FilePlayerImpl(); | |
29 | |
30 virtual int Get10msAudioFromFile(int16_t* outBuffer, | |
31 size_t& lengthInSamples, | |
32 int frequencyInHz); | |
33 virtual int32_t RegisterModuleFileCallback(FileCallback* callback); | |
34 virtual int32_t StartPlayingFile(const char* fileName, | |
35 bool loop, | |
36 uint32_t startPosition, | |
37 float volumeScaling, | |
38 uint32_t notification, | |
39 uint32_t stopPosition = 0, | |
40 const CodecInst* codecInst = NULL); | |
41 virtual int32_t StartPlayingFile(InStream& sourceStream, | |
42 uint32_t startPosition, | |
43 float volumeScaling, | |
44 uint32_t notification, | |
45 uint32_t stopPosition = 0, | |
46 const CodecInst* codecInst = NULL); | |
47 virtual int32_t StopPlayingFile(); | |
48 virtual bool IsPlayingFile() const; | |
49 virtual int32_t GetPlayoutPosition(uint32_t& durationMs); | |
50 virtual int32_t AudioCodec(CodecInst& audioCodec) const; | |
51 virtual int32_t Frequency() const; | |
52 virtual int32_t SetAudioScaling(float scaleFactor); | |
53 | |
54 protected: | |
55 int32_t SetUpAudioDecoder(); | |
56 | |
57 uint32_t _instanceID; | |
58 const FileFormats _fileFormat; | |
59 MediaFile& _fileModule; | |
60 | |
61 uint32_t _decodedLengthInMS; | |
62 | |
63 private: | |
64 AudioCoder _audioDecoder; | |
65 | |
66 CodecInst _codec; | |
67 int32_t _numberOf10MsPerFrame; | |
68 int32_t _numberOf10MsInDecoder; | |
69 | |
70 Resampler _resampler; | |
71 float _scaling; | |
72 }; | |
73 } // namespace webrtc | |
74 #endif // WEBRTC_MODULES_UTILITY_SOURCE_FILE_PLAYER_IMPL_H_ | |
OLD | NEW |