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

Unified Diff: webrtc/test/testsupport/frame_writer.h

Issue 2700493006: Add optional visualization file writers to VideoProcessor tests. (Closed)
Patch Set: kjellander comments 2. Created 3 years, 10 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
« no previous file with comments | « webrtc/test/testsupport/frame_reader_unittest.cc ('k') | webrtc/test/testsupport/frame_writer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/test/testsupport/frame_writer.h
diff --git a/webrtc/test/testsupport/frame_writer.h b/webrtc/test/testsupport/frame_writer.h
index 8a6b1c215259a0bede437dc9ab2eb94b688c4ae2..76298498ac68bc27ae407316639c0e36c75fb52d 100644
--- a/webrtc/test/testsupport/frame_writer.h
+++ b/webrtc/test/testsupport/frame_writer.h
@@ -42,28 +42,46 @@ class FrameWriter {
virtual size_t FrameLength() = 0;
};
-class FrameWriterImpl : public FrameWriter {
+// Writes raw I420 frames in sequence.
+class YuvFrameWriterImpl : public FrameWriter {
public:
// Creates a file handler. The input file is assumed to exist and be readable
// and the output file must be writable.
// Parameters:
// output_filename The file to write. Will be overwritten if already
// existing.
- // frame_length_in_bytes The size of each frame.
- // For YUV: 3*width*height/2
- FrameWriterImpl(std::string output_filename, size_t frame_length_in_bytes);
- ~FrameWriterImpl() override;
+ // width, height Size of each frame to read.
+ YuvFrameWriterImpl(std::string output_filename, int width, int height);
+ ~YuvFrameWriterImpl() override;
bool Init() override;
bool WriteFrame(uint8_t* frame_buffer) override;
void Close() override;
size_t FrameLength() override;
- private:
- std::string output_filename_;
+ protected:
+ const std::string output_filename_;
size_t frame_length_in_bytes_;
+ const int width_;
+ const int height_;
FILE* output_file_;
};
+// Writes raw I420 frames in sequence, but with Y4M file and frame headers for
+// more convenient playback in external media players.
+class Y4mFrameWriterImpl : public YuvFrameWriterImpl {
+ public:
+ Y4mFrameWriterImpl(std::string output_filename,
+ int width,
+ int height,
+ int frame_rate);
+ ~Y4mFrameWriterImpl() override;
+ bool Init() override;
+ bool WriteFrame(uint8_t* frame_buffer) override;
+
+ private:
+ const int frame_rate_;
+};
+
} // namespace test
} // namespace webrtc
« no previous file with comments | « webrtc/test/testsupport/frame_reader_unittest.cc ('k') | webrtc/test/testsupport/frame_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698