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

Side by Side Diff: webrtc/modules/media_file/interface/media_file.h

Issue 1414793020: Remove interface directories kept to avoid breaking downstream. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 1 month 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_MEDIA_FILE_INCLUDE_MEDIA_FILE_H_
12 #define WEBRTC_MODULES_MEDIA_FILE_INCLUDE_MEDIA_FILE_H_
13
14 #pragma message("WARNING: media_file/interface is DEPRECATED; use media_file/inc lude")
15
16 #include "webrtc/common_types.h"
17 #include "webrtc/modules/include/module.h"
18 #include "webrtc/modules/include/module_common_types.h"
19 #include "webrtc/modules/media_file/include/media_file_defines.h"
20 #include "webrtc/typedefs.h"
21
22 namespace webrtc {
23 class MediaFile : public Module
24 {
25 public:
26 // Factory method. Constructor disabled. id is the identifier for the
27 // MediaFile instance.
28 static MediaFile* CreateMediaFile(const int32_t id);
29 static void DestroyMediaFile(MediaFile* module);
30
31 // Put 10-60ms of audio data from file into the audioBuffer depending on
32 // codec frame size. dataLengthInBytes is both an input and output
33 // parameter. As input parameter it indicates the size of audioBuffer.
34 // As output parameter it indicates the number of bytes written to
35 // audioBuffer.
36 // Note: This API only play mono audio but can be used on file containing
37 // audio with more channels (in which case the audio will be converted to
38 // mono).
39 virtual int32_t PlayoutAudioData(
40 int8_t* audioBuffer,
41 size_t& dataLengthInBytes) = 0;
42
43 // Put 10-60ms, depending on codec frame size, of audio data from file into
44 // audioBufferLeft and audioBufferRight. The buffers contain the left and
45 // right channel of played out stereo audio.
46 // dataLengthInBytes is both an input and output parameter. As input
47 // parameter it indicates the size of both audioBufferLeft and
48 // audioBufferRight. As output parameter it indicates the number of bytes
49 // written to both audio buffers.
50 // Note: This API can only be successfully called for WAV files with stereo
51 // audio.
52 virtual int32_t PlayoutStereoData(
53 int8_t* audioBufferLeft,
54 int8_t* audioBufferRight,
55 size_t& dataLengthInBytes) = 0;
56
57 // Open the file specified by fileName (relative path is allowed) for
58 // reading. FileCallback::PlayNotification(..) will be called after
59 // notificationTimeMs of the file has been played if notificationTimeMs is
60 // greater than zero. If loop is true the file will be played until
61 // StopPlaying() is called. When end of file is reached the file is read
62 // from the start. format specifies the type of file fileName refers to.
63 // codecInst specifies the encoding of the audio data. Note that
64 // file formats that contain this information (like WAV files) don't need to
65 // provide a non-NULL codecInst. startPointMs and stopPointMs, unless zero,
66 // specify what part of the file should be read. From startPointMs ms to
67 // stopPointMs ms.
68 // Note: codecInst.channels should be set to 2 for stereo (and 1 for
69 // mono). Stereo audio is only supported for WAV files.
70 virtual int32_t StartPlayingAudioFile(
71 const char* fileName,
72 const uint32_t notificationTimeMs = 0,
73 const bool loop = false,
74 const FileFormats format = kFileFormatPcm16kHzFile,
75 const CodecInst* codecInst = NULL,
76 const uint32_t startPointMs = 0,
77 const uint32_t stopPointMs = 0) = 0;
78
79 // Prepare for playing audio from stream.
80 // FileCallback::PlayNotification(..) will be called after
81 // notificationTimeMs of the file has been played if notificationTimeMs is
82 // greater than zero. format specifies the type of file fileName refers to.
83 // codecInst specifies the encoding of the audio data. Note that
84 // file formats that contain this information (like WAV files) don't need to
85 // provide a non-NULL codecInst. startPointMs and stopPointMs, unless zero,
86 // specify what part of the file should be read. From startPointMs ms to
87 // stopPointMs ms.
88 // Note: codecInst.channels should be set to 2 for stereo (and 1 for
89 // mono). Stereo audio is only supported for WAV files.
90 virtual int32_t StartPlayingAudioStream(
91 InStream& stream,
92 const uint32_t notificationTimeMs = 0,
93 const FileFormats format = kFileFormatPcm16kHzFile,
94 const CodecInst* codecInst = NULL,
95 const uint32_t startPointMs = 0,
96 const uint32_t stopPointMs = 0) = 0;
97
98 // Stop playing from file or stream.
99 virtual int32_t StopPlaying() = 0;
100
101 // Return true if playing.
102 virtual bool IsPlaying() = 0;
103
104
105 // Set durationMs to the number of ms that has been played from file.
106 virtual int32_t PlayoutPositionMs(
107 uint32_t& durationMs) const = 0;
108
109 // Write one audio frame, i.e. the bufferLength first bytes of audioBuffer,
110 // to file. The audio frame size is determined by the codecInst.pacsize
111 // parameter of the last sucessfull StartRecordingAudioFile(..) call.
112 // Note: bufferLength must be exactly one frame.
113 virtual int32_t IncomingAudioData(
114 const int8_t* audioBuffer,
115 const size_t bufferLength) = 0;
116
117 // Open/creates file specified by fileName for writing (relative path is
118 // allowed). FileCallback::RecordNotification(..) will be called after
119 // notificationTimeMs of audio data has been recorded if
120 // notificationTimeMs is greater than zero.
121 // format specifies the type of file that should be created/opened.
122 // codecInst specifies the encoding of the audio data. maxSizeBytes
123 // specifies the number of bytes allowed to be written to file if it is
124 // greater than zero.
125 // Note: codecInst.channels should be set to 2 for stereo (and 1 for
126 // mono). Stereo is only supported for WAV files.
127 virtual int32_t StartRecordingAudioFile(
128 const char* fileName,
129 const FileFormats format,
130 const CodecInst& codecInst,
131 const uint32_t notificationTimeMs = 0,
132 const uint32_t maxSizeBytes = 0) = 0;
133
134 // Prepare for recording audio to stream.
135 // FileCallback::RecordNotification(..) will be called after
136 // notificationTimeMs of audio data has been recorded if
137 // notificationTimeMs is greater than zero.
138 // format specifies the type of file that stream should correspond to.
139 // codecInst specifies the encoding of the audio data.
140 // Note: codecInst.channels should be set to 2 for stereo (and 1 for
141 // mono). Stereo is only supported for WAV files.
142 virtual int32_t StartRecordingAudioStream(
143 OutStream& stream,
144 const FileFormats format,
145 const CodecInst& codecInst,
146 const uint32_t notificationTimeMs = 0) = 0;
147
148 // Stop recording to file or stream.
149 virtual int32_t StopRecording() = 0;
150
151 // Return true if recording.
152 virtual bool IsRecording() = 0;
153
154 // Set durationMs to the number of ms that has been recorded to file.
155 virtual int32_t RecordDurationMs(uint32_t& durationMs) = 0;
156
157 // Return true if recording or playing is stereo.
158 virtual bool IsStereo() = 0;
159
160 // Register callback to receive media file related notifications. Disables
161 // callbacks if callback is NULL.
162 virtual int32_t SetModuleFileCallback(FileCallback* callback) = 0;
163
164 // Set durationMs to the size of the file (in ms) specified by fileName.
165 // format specifies the type of file fileName refers to. freqInHz specifies
166 // the sampling frequency of the file.
167 virtual int32_t FileDurationMs(
168 const char* fileName,
169 uint32_t& durationMs,
170 const FileFormats format,
171 const uint32_t freqInHz = 16000) = 0;
172
173 // Update codecInst according to the current audio codec being used for
174 // reading or writing.
175 virtual int32_t codec_info(CodecInst& codecInst) const = 0;
176
177 protected:
178 MediaFile() {}
179 virtual ~MediaFile() {}
180 };
181 } // namespace webrtc
182 #endif // WEBRTC_MODULES_MEDIA_FILE_INCLUDE_MEDIA_FILE_H_
OLDNEW
« no previous file with comments | « webrtc/modules/interface/module_common_types.h ('k') | webrtc/modules/media_file/interface/media_file_defines.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698