Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Side by Side Diff: webrtc/modules/utility/include/file_player.h

Issue 2622493002: Move FilePlayer and FileRecorder to Voice Engine (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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_INCLUDE_FILE_PLAYER_H_
12 #define WEBRTC_MODULES_UTILITY_INCLUDE_FILE_PLAYER_H_
13
14 #include <memory>
15
16 #include "webrtc/common_types.h"
17 #include "webrtc/modules/include/module_common_types.h"
18 #include "webrtc/typedefs.h"
19
20 namespace webrtc {
21
22 class FileCallback;
23
24 class FilePlayer {
25 public:
26 // The largest decoded frame size in samples (60ms with 32kHz sample rate).
27 enum { MAX_AUDIO_BUFFER_IN_SAMPLES = 60 * 32 };
28 enum { MAX_AUDIO_BUFFER_IN_BYTES = MAX_AUDIO_BUFFER_IN_SAMPLES * 2 };
29
30 // Note: will return NULL for unsupported formats.
31 static std::unique_ptr<FilePlayer> CreateFilePlayer(
32 const uint32_t instanceID,
33 const FileFormats fileFormat);
34
35 virtual ~FilePlayer() = default;
36
37 // Read 10 ms of audio at |frequencyInHz| to |outBuffer|. |lengthInSamples|
38 // will be set to the number of samples read (not the number of samples per
39 // channel).
40 virtual int Get10msAudioFromFile(int16_t* outBuffer,
41 size_t* lengthInSamples,
42 int frequencyInHz) = 0;
43
44 // Register callback for receiving file playing notifications.
45 virtual int32_t RegisterModuleFileCallback(FileCallback* callback) = 0;
46
47 // API for playing audio from fileName to channel.
48 // Note: codecInst is used for pre-encoded files.
49 virtual int32_t StartPlayingFile(const char* fileName,
50 bool loop,
51 uint32_t startPosition,
52 float volumeScaling,
53 uint32_t notification,
54 uint32_t stopPosition,
55 const CodecInst* codecInst) = 0;
56
57 // Note: codecInst is used for pre-encoded files.
58 virtual int32_t StartPlayingFile(InStream* sourceStream,
59 uint32_t startPosition,
60 float volumeScaling,
61 uint32_t notification,
62 uint32_t stopPosition,
63 const CodecInst* codecInst) = 0;
64
65 virtual int32_t StopPlayingFile() = 0;
66
67 virtual bool IsPlayingFile() const = 0;
68
69 virtual int32_t GetPlayoutPosition(uint32_t* durationMs) = 0;
70
71 // Set audioCodec to the currently used audio codec.
72 virtual int32_t AudioCodec(CodecInst* audioCodec) const = 0;
73
74 virtual int32_t Frequency() const = 0;
75
76 // Note: scaleFactor is in the range [0.0 - 2.0]
77 virtual int32_t SetAudioScaling(float scaleFactor) = 0;
78 };
79 } // namespace webrtc
80 #endif // WEBRTC_MODULES_UTILITY_INCLUDE_FILE_PLAYER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698