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 |
(...skipping 26 matching lines...) Expand all Loading... |
37 static FilePlayer* CreateFilePlayer(const uint32_t instanceID, | 37 static FilePlayer* CreateFilePlayer(const uint32_t instanceID, |
38 const FileFormats fileFormat); | 38 const FileFormats fileFormat); |
39 static void DestroyFilePlayer(FilePlayer* player); | 39 static void DestroyFilePlayer(FilePlayer* player); |
40 | 40 |
41 virtual ~FilePlayer() = default; | 41 virtual ~FilePlayer() = default; |
42 | 42 |
43 // Read 10 ms of audio at |frequencyInHz| to |outBuffer|. |lengthInSamples| | 43 // Read 10 ms of audio at |frequencyInHz| to |outBuffer|. |lengthInSamples| |
44 // will be set to the number of samples read (not the number of samples per | 44 // will be set to the number of samples read (not the number of samples per |
45 // channel). | 45 // channel). |
46 virtual int Get10msAudioFromFile(int16_t* outBuffer, | 46 virtual int Get10msAudioFromFile(int16_t* outBuffer, |
47 size_t& lengthInSamples, | 47 size_t* lengthInSamples, |
48 int frequencyInHz) = 0; | 48 int frequencyInHz) = 0; |
49 | 49 |
50 // Register callback for receiving file playing notifications. | 50 // Register callback for receiving file playing notifications. |
51 virtual int32_t RegisterModuleFileCallback(FileCallback* callback) = 0; | 51 virtual int32_t RegisterModuleFileCallback(FileCallback* callback) = 0; |
52 | 52 |
53 // API for playing audio from fileName to channel. | 53 // API for playing audio from fileName to channel. |
54 // Note: codecInst is used for pre-encoded files. | 54 // Note: codecInst is used for pre-encoded files. |
55 virtual int32_t StartPlayingFile(const char* fileName, | 55 virtual int32_t StartPlayingFile(const char* fileName, |
56 bool loop, | 56 bool loop, |
57 uint32_t startPosition, | 57 uint32_t startPosition, |
58 float volumeScaling, | 58 float volumeScaling, |
59 uint32_t notification, | 59 uint32_t notification, |
60 uint32_t stopPosition, | 60 uint32_t stopPosition, |
61 const CodecInst* codecInst) = 0; | 61 const CodecInst* codecInst) = 0; |
62 | 62 |
63 // Note: codecInst is used for pre-encoded files. | 63 // Note: codecInst is used for pre-encoded files. |
64 virtual int32_t StartPlayingFile(InStream& sourceStream, | 64 virtual int32_t StartPlayingFile(InStream* sourceStream, |
65 uint32_t startPosition, | 65 uint32_t startPosition, |
66 float volumeScaling, | 66 float volumeScaling, |
67 uint32_t notification, | 67 uint32_t notification, |
68 uint32_t stopPosition, | 68 uint32_t stopPosition, |
69 const CodecInst* codecInst) = 0; | 69 const CodecInst* codecInst) = 0; |
70 | 70 |
71 virtual int32_t StopPlayingFile() = 0; | 71 virtual int32_t StopPlayingFile() = 0; |
72 | 72 |
73 virtual bool IsPlayingFile() const = 0; | 73 virtual bool IsPlayingFile() const = 0; |
74 | 74 |
75 virtual int32_t GetPlayoutPosition(uint32_t& durationMs) = 0; | 75 virtual int32_t GetPlayoutPosition(uint32_t* durationMs) = 0; |
76 | 76 |
77 // Set audioCodec to the currently used audio codec. | 77 // Set audioCodec to the currently used audio codec. |
78 virtual int32_t AudioCodec(CodecInst& audioCodec) const = 0; | 78 virtual int32_t AudioCodec(CodecInst* audioCodec) const = 0; |
79 | 79 |
80 virtual int32_t Frequency() const = 0; | 80 virtual int32_t Frequency() const = 0; |
81 | 81 |
82 // Note: scaleFactor is in the range [0.0 - 2.0] | 82 // Note: scaleFactor is in the range [0.0 - 2.0] |
83 virtual int32_t SetAudioScaling(float scaleFactor) = 0; | 83 virtual int32_t SetAudioScaling(float scaleFactor) = 0; |
| 84 |
| 85 // Deprecated functions. Use the functions above with the same name instead. |
| 86 int Get10msAudioFromFile(int16_t* outBuffer, |
| 87 size_t& lengthInSamples, |
| 88 int frequencyInHz) { |
| 89 return Get10msAudioFromFile(outBuffer, &lengthInSamples, frequencyInHz); |
| 90 } |
| 91 int32_t StartPlayingFile(InStream& sourceStream, |
| 92 uint32_t startPosition, |
| 93 float volumeScaling, |
| 94 uint32_t notification, |
| 95 uint32_t stopPosition, |
| 96 const CodecInst* codecInst) { |
| 97 return StartPlayingFile(&sourceStream, startPosition, volumeScaling, |
| 98 notification, stopPosition, codecInst); |
| 99 } |
| 100 int32_t GetPlayoutPosition(uint32_t& durationMs) { |
| 101 return GetPlayoutPosition(&durationMs); |
| 102 } |
| 103 int32_t AudioCodec(CodecInst& audioCodec) const { |
| 104 return AudioCodec(&audioCodec); |
| 105 } |
84 }; | 106 }; |
85 } // namespace webrtc | 107 } // namespace webrtc |
86 #endif // WEBRTC_MODULES_UTILITY_INCLUDE_FILE_PLAYER_H_ | 108 #endif // WEBRTC_MODULES_UTILITY_INCLUDE_FILE_PLAYER_H_ |
OLD | NEW |