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

Side by Side Diff: webrtc/modules/video_coding/utility/ivf_file_writer.h

Issue 2303273002: Expose Ivf logging through the native API (Closed)
Patch Set: Nit Created 4 years, 2 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
1 /* 1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 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_VIDEO_CODING_UTILITY_IVF_FILE_WRITER_H_ 11 #ifndef WEBRTC_MODULES_VIDEO_CODING_UTILITY_IVF_FILE_WRITER_H_
12 #define WEBRTC_MODULES_VIDEO_CODING_UTILITY_IVF_FILE_WRITER_H_ 12 #define WEBRTC_MODULES_VIDEO_CODING_UTILITY_IVF_FILE_WRITER_H_
13 13
14 #include <memory> 14 #include <memory>
15 #include <string> 15 #include <string>
16 16
17 #include "webrtc/base/constructormagic.h" 17 #include "webrtc/base/constructormagic.h"
18 #include "webrtc/base/file.h"
18 #include "webrtc/base/timeutils.h" 19 #include "webrtc/base/timeutils.h"
19 #include "webrtc/modules/include/module_common_types.h" 20 #include "webrtc/modules/include/module_common_types.h"
20 #include "webrtc/video_frame.h" 21 #include "webrtc/video_frame.h"
21 #include "webrtc/system_wrappers/include/file_wrapper.h"
22 22
23 namespace webrtc { 23 namespace webrtc {
24 24
25 class IvfFileWriter { 25 class IvfFileWriter {
26 public: 26 public:
27 // Takes ownership of the file, which will be closed either through
28 // Close or ~IvfFileWriter. If writing a frame would take the file above the
29 // |byte_limit| the file will be closed, the write (and all future writes)
30 // will fail. A |byte_limit| of 0 is equivalent to no limit.
31 static std::unique_ptr<IvfFileWriter> Wrap(rtc::File file, size_t byte_limit);
27 ~IvfFileWriter(); 32 ~IvfFileWriter();
28 33
29 static std::unique_ptr<IvfFileWriter> Open(const std::string& file_name, 34 bool WriteFrame(const EncodedImage& encoded_image, VideoCodecType codec_type);
30 VideoCodecType codec_type);
31 bool WriteFrame(const EncodedImage& encoded_image);
32 bool Close(); 35 bool Close();
33 36
34 private: 37 private:
35 IvfFileWriter(const std::string& path_name, 38 explicit IvfFileWriter(rtc::File file, size_t byte_limit);
36 std::unique_ptr<FileWrapper> file, 39
37 VideoCodecType codec_type);
38 bool WriteHeader(); 40 bool WriteHeader();
39 bool InitFromFirstFrame(const EncodedImage& encoded_image); 41 bool InitFromFirstFrame(const EncodedImage& encoded_image,
42 VideoCodecType codec_type);
40 43
41 const VideoCodecType codec_type_; 44 VideoCodecType codec_type_;
45 size_t bytes_written_;
46 size_t byte_limit_;
42 size_t num_frames_; 47 size_t num_frames_;
43 uint16_t width_; 48 uint16_t width_;
44 uint16_t height_; 49 uint16_t height_;
45 int64_t last_timestamp_; 50 int64_t last_timestamp_;
46 bool using_capture_timestamps_; 51 bool using_capture_timestamps_;
47 rtc::TimestampWrapAroundHandler wrap_handler_; 52 rtc::TimestampWrapAroundHandler wrap_handler_;
48 const std::string file_name_; 53 rtc::File file_;
49 std::unique_ptr<FileWrapper> file_;
50 54
51 RTC_DISALLOW_COPY_AND_ASSIGN(IvfFileWriter); 55 RTC_DISALLOW_COPY_AND_ASSIGN(IvfFileWriter);
52 }; 56 };
53 57
54 } // namespace webrtc 58 } // namespace webrtc
55 59
56 #endif // WEBRTC_MODULES_VIDEO_CODING_UTILITY_IVF_FILE_WRITER_H_ 60 #endif // WEBRTC_MODULES_VIDEO_CODING_UTILITY_IVF_FILE_WRITER_H_
OLDNEW
« no previous file with comments | « webrtc/media/engine/fakewebrtccall.cc ('k') | webrtc/modules/video_coding/utility/ivf_file_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698