| Index: webrtc/modules/video_coding/utility/ivf_file_writer.h
|
| diff --git a/webrtc/modules/video_coding/utility/ivf_file_writer.h b/webrtc/modules/video_coding/utility/ivf_file_writer.h
|
| index 25d68a2803498efd562208ac7ca0b86f2bf4ffbf..b556111aa5c1fc436dea85e967d65e9f269ee652 100644
|
| --- a/webrtc/modules/video_coding/utility/ivf_file_writer.h
|
| +++ b/webrtc/modules/video_coding/utility/ivf_file_writer.h
|
| @@ -15,38 +15,42 @@
|
| #include <string>
|
|
|
| #include "webrtc/base/constructormagic.h"
|
| +#include "webrtc/base/file.h"
|
| #include "webrtc/base/timeutils.h"
|
| #include "webrtc/modules/include/module_common_types.h"
|
| #include "webrtc/video_frame.h"
|
| -#include "webrtc/system_wrappers/include/file_wrapper.h"
|
|
|
| namespace webrtc {
|
|
|
| class IvfFileWriter {
|
| public:
|
| + // Takes ownership of the file, which will be closed either through
|
| + // Close or ~IvfFileWriter. If writing a frame would take the file above the
|
| + // |byte_limit| the file will be closed, the write (and all future writes)
|
| + // will fail. A |byte_limit| of 0 is equivalent to no limit.
|
| + static std::unique_ptr<IvfFileWriter> Wrap(rtc::File file, size_t byte_limit);
|
| ~IvfFileWriter();
|
|
|
| - static std::unique_ptr<IvfFileWriter> Open(const std::string& file_name,
|
| - VideoCodecType codec_type);
|
| - bool WriteFrame(const EncodedImage& encoded_image);
|
| + bool WriteFrame(const EncodedImage& encoded_image, VideoCodecType codec_type);
|
| bool Close();
|
|
|
| private:
|
| - IvfFileWriter(const std::string& path_name,
|
| - std::unique_ptr<FileWrapper> file,
|
| - VideoCodecType codec_type);
|
| + explicit IvfFileWriter(rtc::File file, size_t byte_limit);
|
| +
|
| bool WriteHeader();
|
| - bool InitFromFirstFrame(const EncodedImage& encoded_image);
|
| + bool InitFromFirstFrame(const EncodedImage& encoded_image,
|
| + VideoCodecType codec_type);
|
|
|
| - const VideoCodecType codec_type_;
|
| + VideoCodecType codec_type_;
|
| + size_t bytes_written_;
|
| + size_t byte_limit_;
|
| size_t num_frames_;
|
| uint16_t width_;
|
| uint16_t height_;
|
| int64_t last_timestamp_;
|
| bool using_capture_timestamps_;
|
| rtc::TimestampWrapAroundHandler wrap_handler_;
|
| - const std::string file_name_;
|
| - std::unique_ptr<FileWrapper> file_;
|
| + rtc::File file_;
|
|
|
| RTC_DISALLOW_COPY_AND_ASSIGN(IvfFileWriter);
|
| };
|
|
|