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