OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #ifndef WEBRTC_MODULES_UTILITY_SOURCE_FILE_PLAYER_IMPL_H_ | 11 #ifndef WEBRTC_MODULES_UTILITY_SOURCE_FILE_PLAYER_IMPL_H_ |
12 #define WEBRTC_MODULES_UTILITY_SOURCE_FILE_PLAYER_IMPL_H_ | 12 #define WEBRTC_MODULES_UTILITY_SOURCE_FILE_PLAYER_IMPL_H_ |
13 | 13 |
14 #include "webrtc/common_audio/resampler/include/resampler.h" | 14 #include "webrtc/common_audio/resampler/include/resampler.h" |
15 #include "webrtc/common_types.h" | 15 #include "webrtc/common_types.h" |
16 #include "webrtc/engine_configurations.h" | 16 #include "webrtc/engine_configurations.h" |
17 #include "webrtc/modules/media_file/media_file.h" | 17 #include "webrtc/modules/media_file/media_file.h" |
18 #include "webrtc/modules/media_file/media_file_defines.h" | 18 #include "webrtc/modules/media_file/media_file_defines.h" |
19 #include "webrtc/modules/utility/include/file_player.h" | 19 #include "webrtc/modules/utility/include/file_player.h" |
20 #include "webrtc/modules/utility/source/coder.h" | 20 #include "webrtc/modules/utility/source/coder.h" |
21 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" | 21 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" |
22 #include "webrtc/typedefs.h" | 22 #include "webrtc/typedefs.h" |
23 | 23 |
24 namespace webrtc { | 24 namespace webrtc { |
25 class FilePlayerImpl : public FilePlayer | 25 class FilePlayerImpl : public FilePlayer { |
26 { | 26 public: |
27 public: | 27 FilePlayerImpl(uint32_t instanceID, FileFormats fileFormat); |
28 FilePlayerImpl(uint32_t instanceID, FileFormats fileFormat); | 28 ~FilePlayerImpl(); |
29 ~FilePlayerImpl(); | |
30 | 29 |
31 virtual int Get10msAudioFromFile( | 30 virtual int Get10msAudioFromFile(int16_t* outBuffer, |
32 int16_t* outBuffer, | 31 size_t& lengthInSamples, |
33 size_t& lengthInSamples, | 32 int frequencyInHz); |
34 int frequencyInHz); | 33 virtual int32_t RegisterModuleFileCallback(FileCallback* callback); |
35 virtual int32_t RegisterModuleFileCallback(FileCallback* callback); | 34 virtual int32_t StartPlayingFile(const char* fileName, |
36 virtual int32_t StartPlayingFile( | 35 bool loop, |
37 const char* fileName, | 36 uint32_t startPosition, |
38 bool loop, | 37 float volumeScaling, |
39 uint32_t startPosition, | 38 uint32_t notification, |
40 float volumeScaling, | 39 uint32_t stopPosition = 0, |
41 uint32_t notification, | 40 const CodecInst* codecInst = NULL); |
42 uint32_t stopPosition = 0, | 41 virtual int32_t StartPlayingFile(InStream& sourceStream, |
43 const CodecInst* codecInst = NULL); | 42 uint32_t startPosition, |
44 virtual int32_t StartPlayingFile( | 43 float volumeScaling, |
45 InStream& sourceStream, | 44 uint32_t notification, |
46 uint32_t startPosition, | 45 uint32_t stopPosition = 0, |
47 float volumeScaling, | 46 const CodecInst* codecInst = NULL); |
48 uint32_t notification, | 47 virtual int32_t StopPlayingFile(); |
49 uint32_t stopPosition = 0, | 48 virtual bool IsPlayingFile() const; |
50 const CodecInst* codecInst = NULL); | 49 virtual int32_t GetPlayoutPosition(uint32_t& durationMs); |
51 virtual int32_t StopPlayingFile(); | 50 virtual int32_t AudioCodec(CodecInst& audioCodec) const; |
52 virtual bool IsPlayingFile() const; | 51 virtual int32_t Frequency() const; |
53 virtual int32_t GetPlayoutPosition(uint32_t& durationMs); | 52 virtual int32_t SetAudioScaling(float scaleFactor); |
54 virtual int32_t AudioCodec(CodecInst& audioCodec) const; | |
55 virtual int32_t Frequency() const; | |
56 virtual int32_t SetAudioScaling(float scaleFactor); | |
57 | 53 |
58 protected: | 54 protected: |
59 int32_t SetUpAudioDecoder(); | 55 int32_t SetUpAudioDecoder(); |
60 | 56 |
61 uint32_t _instanceID; | 57 uint32_t _instanceID; |
62 const FileFormats _fileFormat; | 58 const FileFormats _fileFormat; |
63 MediaFile& _fileModule; | 59 MediaFile& _fileModule; |
64 | 60 |
65 uint32_t _decodedLengthInMS; | 61 uint32_t _decodedLengthInMS; |
66 | 62 |
67 private: | 63 private: |
68 AudioCoder _audioDecoder; | 64 AudioCoder _audioDecoder; |
69 | 65 |
70 CodecInst _codec; | 66 CodecInst _codec; |
71 int32_t _numberOf10MsPerFrame; | 67 int32_t _numberOf10MsPerFrame; |
72 int32_t _numberOf10MsInDecoder; | 68 int32_t _numberOf10MsInDecoder; |
73 | 69 |
74 Resampler _resampler; | 70 Resampler _resampler; |
75 float _scaling; | 71 float _scaling; |
76 }; | 72 }; |
77 } // namespace webrtc | 73 } // namespace webrtc |
78 #endif // WEBRTC_MODULES_UTILITY_SOURCE_FILE_PLAYER_IMPL_H_ | 74 #endif // WEBRTC_MODULES_UTILITY_SOURCE_FILE_PLAYER_IMPL_H_ |
OLD | NEW |