diff options
Diffstat (limited to 'test/y4m_test.cc')
-rw-r--r-- | test/y4m_test.cc | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/test/y4m_test.cc b/test/y4m_test.cc index 73ff68308..3927b7da4 100644 --- a/test/y4m_test.cc +++ b/test/y4m_test.cc @@ -138,14 +138,11 @@ INSTANTIATE_TEST_CASE_P(C, Y4mVideoSourceTest, class Y4mVideoWriteTest : public Y4mVideoSourceTest { protected: - Y4mVideoWriteTest() : Y4mVideoSourceTest() {} + Y4mVideoWriteTest() {} - virtual void ReplaceInputFp(FILE *input_file) { + virtual ~Y4mVideoWriteTest() { CloseSource(); - frame_ = 0; - input_file_ = input_file; - rewind(input_file_); - ReadSourceToStart(); + delete tmpfile_; } // Writes out a y4m file and then reads it back @@ -153,26 +150,28 @@ class Y4mVideoWriteTest ASSERT_TRUE(input_file_ != NULL); char buf[Y4M_BUFFER_SIZE] = {0}; const struct VpxRational framerate = {y4m_.fps_n, y4m_.fps_d}; - FILE *out_file = libvpx_test::OpenTempOutFile(); - ASSERT_TRUE(out_file != NULL); + tmpfile_ = new libvpx_test::TempOutFile; + ASSERT_TRUE(tmpfile_->file() != NULL); y4m_write_file_header(buf, sizeof(buf), kWidth, kHeight, &framerate, y4m_.vpx_fmt, y4m_.bit_depth); - fputs(buf, out_file); + fputs(buf, tmpfile_->file()); for (unsigned int i = start_; i < limit_; i++) { y4m_write_frame_header(buf, sizeof(buf)); - fputs(buf, out_file); - write_image_file(img(), out_file); + fputs(buf, tmpfile_->file()); + write_image_file(img(), tmpfile_->file()); Next(); } - ReplaceInputFp(out_file); + tmpfile_->CloseFile(); + Y4mVideoSourceTest::Init(tmpfile_->file_name(), limit_); } virtual void Init(const std::string &file_name, int limit) { Y4mVideoSourceTest::Init(file_name, limit); WriteY4mAndReadBack(); } + libvpx_test::TempOutFile *tmpfile_; }; TEST_P(Y4mVideoWriteTest, WriteTest) { |