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 15 matching lines...) Expand all Loading... |
26 public: | 26 public: |
27 // The largest decoded frame size in samples (60ms with 32kHz sample rate). | 27 // The largest decoded frame size in samples (60ms with 32kHz sample rate). |
28 enum { MAX_AUDIO_BUFFER_IN_SAMPLES = 60 * 32 }; | 28 enum { MAX_AUDIO_BUFFER_IN_SAMPLES = 60 * 32 }; |
29 enum { MAX_AUDIO_BUFFER_IN_BYTES = MAX_AUDIO_BUFFER_IN_SAMPLES * 2 }; | 29 enum { MAX_AUDIO_BUFFER_IN_BYTES = MAX_AUDIO_BUFFER_IN_SAMPLES * 2 }; |
30 | 30 |
31 // Note: will return NULL for unsupported formats. | 31 // Note: will return NULL for unsupported formats. |
32 static std::unique_ptr<FilePlayer> NewFilePlayer( | 32 static std::unique_ptr<FilePlayer> NewFilePlayer( |
33 const uint32_t instanceID, | 33 const uint32_t instanceID, |
34 const FileFormats fileFormat); | 34 const FileFormats fileFormat); |
35 | 35 |
36 // Deprecated creation/destruction functions. Use NewFilePlayer instead. | |
37 static FilePlayer* CreateFilePlayer(const uint32_t instanceID, | |
38 const FileFormats fileFormat); | |
39 static void DestroyFilePlayer(FilePlayer* player); | |
40 | |
41 virtual ~FilePlayer() = default; | 36 virtual ~FilePlayer() = default; |
42 | 37 |
43 // Read 10 ms of audio at |frequencyInHz| to |outBuffer|. |lengthInSamples| | 38 // 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 | 39 // will be set to the number of samples read (not the number of samples per |
45 // channel). | 40 // channel). |
46 virtual int Get10msAudioFromFile(int16_t* outBuffer, | 41 virtual int Get10msAudioFromFile(int16_t* outBuffer, |
47 size_t* lengthInSamples, | 42 size_t* lengthInSamples, |
48 int frequencyInHz) = 0; | 43 int frequencyInHz) = 0; |
49 | 44 |
50 // Register callback for receiving file playing notifications. | 45 // Register callback for receiving file playing notifications. |
(...skipping 23 matching lines...) Expand all Loading... |
74 | 69 |
75 virtual int32_t GetPlayoutPosition(uint32_t* durationMs) = 0; | 70 virtual int32_t GetPlayoutPosition(uint32_t* durationMs) = 0; |
76 | 71 |
77 // Set audioCodec to the currently used audio codec. | 72 // Set audioCodec to the currently used audio codec. |
78 virtual int32_t AudioCodec(CodecInst* audioCodec) const = 0; | 73 virtual int32_t AudioCodec(CodecInst* audioCodec) const = 0; |
79 | 74 |
80 virtual int32_t Frequency() const = 0; | 75 virtual int32_t Frequency() const = 0; |
81 | 76 |
82 // Note: scaleFactor is in the range [0.0 - 2.0] | 77 // Note: scaleFactor is in the range [0.0 - 2.0] |
83 virtual int32_t SetAudioScaling(float scaleFactor) = 0; | 78 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 } | |
106 }; | 79 }; |
107 } // namespace webrtc | 80 } // namespace webrtc |
108 #endif // WEBRTC_MODULES_UTILITY_INCLUDE_FILE_PLAYER_H_ | 81 #endif // WEBRTC_MODULES_UTILITY_INCLUDE_FILE_PLAYER_H_ |
OLD | NEW |