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

Unified Diff: webrtc/modules/video_coding/utility/ivf_file_writer.h

Issue 1853813002: Add support for writing raw encoder output to .ivf files. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Added checks Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
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
new file mode 100644
index 0000000000000000000000000000000000000000..6e630f55f9e9b79f96045023f9d6cef38b2062fd
--- /dev/null
+++ b/webrtc/modules/video_coding/utility/ivf_file_writer.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#ifndef WEBRTC_MODULES_VIDEO_CODING_UTILITY_IVF_FILE_WRITER_H_
+#define WEBRTC_MODULES_VIDEO_CODING_UTILITY_IVF_FILE_WRITER_H_
+
+#include <memory>
+#include <string>
+
+#include "webrtc/base/constructormagic.h"
+#include "webrtc/base/pathutils.h"
+#include "webrtc/base/stream.h"
+#include "webrtc/modules/include/module_common_types.h"
+#include "webrtc/video_frame.h"
+
+namespace webrtc {
+
+class IvfFileWriter {
+ public:
+ ~IvfFileWriter();
+
+ static std::unique_ptr<IvfFileWriter> Open(rtc::Pathname file_name,
+ RtpVideoCodecTypes codec_type);
+ static std::unique_ptr<IvfFileWriter> Open(rtc::StreamInterface* out_stream,
+ RtpVideoCodecTypes codec_type);
+ bool WriteFrame(const EncodedImage& encoded_image);
+ bool Close();
+
+ private:
+ IvfFileWriter(rtc::Pathname path_name, rtc::StreamInterface* out_stream);
+ bool WriteHeader(RtpVideoCodecTypes codec_type);
+
+ size_t num_frames_;
+ uint16_t width_;
+ uint16_t height_;
+ int64_t last_timestamp_;
+ rtc::Pathname file_name_;
+ std::unique_ptr<rtc::StreamInterface> out_stream_;
+
+ RTC_DISALLOW_COPY_AND_ASSIGN(IvfFileWriter);
+};
+
+} // namespace webrtc
+
+#endif // WEBRTC_MODULES_VIDEO_CODING_UTILITY_IVF_FILE_WRITER_H_

Powered by Google App Engine
This is Rietveld 408576698