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_INTERFACE_FILE_RECORDER_H_ | 11 #ifndef WEBRTC_MODULES_UTILITY_INTERFACE_FILE_RECORDER_H_ |
12 #define WEBRTC_MODULES_UTILITY_INTERFACE_FILE_RECORDER_H_ | 12 #define WEBRTC_MODULES_UTILITY_INTERFACE_FILE_RECORDER_H_ |
13 | 13 |
14 #include "webrtc/common_types.h" | 14 #include "webrtc/common_types.h" |
15 #include "webrtc/engine_configurations.h" | 15 #include "webrtc/engine_configurations.h" |
16 #include "webrtc/modules/audio_coding/main/interface/audio_coding_module_typedef
s.h" | |
17 #include "webrtc/modules/interface/module_common_types.h" | 16 #include "webrtc/modules/interface/module_common_types.h" |
18 #include "webrtc/modules/media_file/interface/media_file_defines.h" | 17 #include "webrtc/modules/media_file/interface/media_file_defines.h" |
19 #include "webrtc/system_wrappers/interface/tick_util.h" | 18 #include "webrtc/system_wrappers/interface/tick_util.h" |
20 #include "webrtc/typedefs.h" | 19 #include "webrtc/typedefs.h" |
21 #include "webrtc/video_frame.h" | 20 #include "webrtc/video_frame.h" |
22 | 21 |
23 namespace webrtc { | 22 namespace webrtc { |
24 | 23 |
25 class FileRecorder | 24 class FileRecorder |
26 { | 25 { |
27 public: | 26 public: |
28 | 27 |
29 // Note: will return NULL for unsupported formats. | 28 // Note: will return NULL for unsupported formats. |
30 static FileRecorder* CreateFileRecorder(const uint32_t instanceID, | 29 static FileRecorder* CreateFileRecorder(const uint32_t instanceID, |
31 const FileFormats fileFormat); | 30 const FileFormats fileFormat); |
32 | 31 |
33 static void DestroyFileRecorder(FileRecorder* recorder); | 32 static void DestroyFileRecorder(FileRecorder* recorder); |
34 | 33 |
35 virtual int32_t RegisterModuleFileCallback( | 34 virtual int32_t RegisterModuleFileCallback( |
36 FileCallback* callback) = 0; | 35 FileCallback* callback) = 0; |
37 | 36 |
38 virtual FileFormats RecordingFileFormat() const = 0; | 37 virtual FileFormats RecordingFileFormat() const = 0; |
39 | 38 |
40 virtual int32_t StartRecordingAudioFile( | 39 virtual int32_t StartRecordingAudioFile( |
41 const char* fileName, | 40 const char* fileName, |
42 const CodecInst& codecInst, | 41 const CodecInst& codecInst, |
43 uint32_t notification, | 42 uint32_t notification) = 0; |
44 ACMAMRPackingFormat amrFormat = AMRFileStorage) = 0; | |
45 | 43 |
46 virtual int32_t StartRecordingAudioFile( | 44 virtual int32_t StartRecordingAudioFile( |
47 OutStream& destStream, | 45 OutStream& destStream, |
48 const CodecInst& codecInst, | 46 const CodecInst& codecInst, |
49 uint32_t notification, | 47 uint32_t notification) = 0; |
50 ACMAMRPackingFormat amrFormat = AMRFileStorage) = 0; | |
51 | 48 |
52 // Stop recording. | 49 // Stop recording. |
53 // Note: this API is for both audio and video. | 50 // Note: this API is for both audio and video. |
54 virtual int32_t StopRecording() = 0; | 51 virtual int32_t StopRecording() = 0; |
55 | 52 |
56 // Return true if recording. | 53 // Return true if recording. |
57 // Note: this API is for both audio and video. | 54 // Note: this API is for both audio and video. |
58 virtual bool IsRecording() const = 0; | 55 virtual bool IsRecording() const = 0; |
59 | 56 |
60 virtual int32_t codec_info(CodecInst& codecInst) const = 0; | 57 virtual int32_t codec_info(CodecInst& codecInst) const = 0; |
61 | 58 |
62 // Write frame to file. Frame should contain 10ms of un-ecoded audio data. | 59 // Write frame to file. Frame should contain 10ms of un-ecoded audio data. |
63 virtual int32_t RecordAudioToFile( | 60 virtual int32_t RecordAudioToFile( |
64 const AudioFrame& frame, | 61 const AudioFrame& frame, |
65 const TickTime* playoutTS = NULL) = 0; | 62 const TickTime* playoutTS = NULL) = 0; |
66 | 63 |
67 // Open/create the file specified by fileName for writing audio/video data | 64 // Open/create the file specified by fileName for writing audio/video data |
68 // (relative path is allowed). audioCodecInst specifies the encoding of the | 65 // (relative path is allowed). audioCodecInst specifies the encoding of the |
69 // audio data. videoCodecInst specifies the encoding of the video data. | 66 // audio data. videoCodecInst specifies the encoding of the video data. |
70 // Only video data will be recorded if videoOnly is true. amrFormat | 67 // Only video data will be recorded if videoOnly is true. amrFormat |
71 // specifies the amr/amrwb storage format. | 68 // specifies the amr/amrwb storage format. |
72 // Note: the file format is AVI. | 69 // Note: the file format is AVI. |
73 virtual int32_t StartRecordingVideoFile( | 70 virtual int32_t StartRecordingVideoFile( |
74 const char* fileName, | 71 const char* fileName, |
75 const CodecInst& audioCodecInst, | 72 const CodecInst& audioCodecInst, |
76 const VideoCodec& videoCodecInst, | 73 const VideoCodec& videoCodecInst, |
77 ACMAMRPackingFormat amrFormat = AMRFileStorage, | |
78 bool videoOnly = false) = 0; | 74 bool videoOnly = false) = 0; |
79 | 75 |
80 // Record the video frame in videoFrame to AVI file. | 76 // Record the video frame in videoFrame to AVI file. |
81 virtual int32_t RecordVideoToFile(const VideoFrame& videoFrame) = 0; | 77 virtual int32_t RecordVideoToFile(const VideoFrame& videoFrame) = 0; |
82 | 78 |
83 protected: | 79 protected: |
84 virtual ~FileRecorder() {} | 80 virtual ~FileRecorder() {} |
85 | 81 |
86 }; | 82 }; |
87 } // namespace webrtc | 83 } // namespace webrtc |
88 #endif // WEBRTC_MODULES_UTILITY_INTERFACE_FILE_RECORDER_H_ | 84 #endif // WEBRTC_MODULES_UTILITY_INTERFACE_FILE_RECORDER_H_ |
OLD | NEW |