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

Side by Side Diff: source/libvpx/test/y4m_video_source.h

Issue 181493009: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « source/libvpx/test/webm_video_source.h ('k') | source/libvpx/tools_common.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebM project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebM 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 #ifndef TEST_Y4M_VIDEO_SOURCE_H_ 10 #ifndef TEST_Y4M_VIDEO_SOURCE_H_
(...skipping 17 matching lines...) Expand all
28 start_(start), 28 start_(start),
29 limit_(limit), 29 limit_(limit),
30 frame_(0), 30 frame_(0),
31 framerate_numerator_(0), 31 framerate_numerator_(0),
32 framerate_denominator_(0), 32 framerate_denominator_(0),
33 y4m_() { 33 y4m_() {
34 } 34 }
35 35
36 virtual ~Y4mVideoSource() { 36 virtual ~Y4mVideoSource() {
37 vpx_img_free(img_.get()); 37 vpx_img_free(img_.get());
38 y4m_input_close(&y4m_); 38 CloseSource();
39 if (input_file_)
40 fclose(input_file_);
41 } 39 }
42 40
43 virtual void Begin() { 41 virtual void Begin() {
44 if (input_file_) 42 CloseSource();
45 fclose(input_file_);
46 input_file_ = OpenTestDataFile(file_name_); 43 input_file_ = OpenTestDataFile(file_name_);
47 ASSERT_TRUE(input_file_ != NULL) << "Input file open failed. Filename: " 44 ASSERT_TRUE(input_file_ != NULL) << "Input file open failed. Filename: "
48 << file_name_; 45 << file_name_;
49 46
50 y4m_input_open(&y4m_, input_file_, NULL, 0, 0); 47 y4m_input_open(&y4m_, input_file_, NULL, 0, 0);
51 framerate_numerator_ = y4m_.fps_n; 48 framerate_numerator_ = y4m_.fps_n;
52 framerate_denominator_ = y4m_.fps_d; 49 framerate_denominator_ = y4m_.fps_d;
53 50
54 frame_ = 0; 51 frame_ = 0;
55 for (unsigned int i = 0; i < start_; i++) { 52 for (unsigned int i = 0; i < start_; i++) {
(...skipping 26 matching lines...) Expand all
82 79
83 virtual unsigned int limit() const { return limit_; } 80 virtual unsigned int limit() const { return limit_; }
84 81
85 virtual void FillFrame() { 82 virtual void FillFrame() {
86 ASSERT_TRUE(input_file_ != NULL); 83 ASSERT_TRUE(input_file_ != NULL);
87 // Read a frame from input_file. 84 // Read a frame from input_file.
88 y4m_input_fetch_frame(&y4m_, input_file_, img_.get()); 85 y4m_input_fetch_frame(&y4m_, input_file_, img_.get());
89 } 86 }
90 87
91 protected: 88 protected:
89 void CloseSource() {
90 y4m_input_close(&y4m_);
91 y4m_ = y4m_input();
92 if (input_file_ != NULL) {
93 fclose(input_file_);
94 input_file_ = NULL;
95 }
96 }
97
92 std::string file_name_; 98 std::string file_name_;
93 FILE *input_file_; 99 FILE *input_file_;
94 testing::internal::scoped_ptr<vpx_image_t> img_; 100 testing::internal::scoped_ptr<vpx_image_t> img_;
95 unsigned int start_; 101 unsigned int start_;
96 unsigned int limit_; 102 unsigned int limit_;
97 unsigned int frame_; 103 unsigned int frame_;
98 int framerate_numerator_; 104 int framerate_numerator_;
99 int framerate_denominator_; 105 int framerate_denominator_;
100 y4m_input y4m_; 106 y4m_input y4m_;
101 }; 107 };
102 108
103 } // namespace libvpx_test 109 } // namespace libvpx_test
104 110
105 #endif // TEST_Y4M_VIDEO_SOURCE_H_ 111 #endif // TEST_Y4M_VIDEO_SOURCE_H_
OLDNEW
« no previous file with comments | « source/libvpx/test/webm_video_source.h ('k') | source/libvpx/tools_common.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698