OLD | NEW |
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 20 matching lines...) Expand all Loading... |
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 CloseSource(); | 38 CloseSource(); |
39 } | 39 } |
40 | 40 |
41 virtual void Begin() { | 41 virtual void OpenSource() { |
42 CloseSource(); | 42 CloseSource(); |
43 input_file_ = OpenTestDataFile(file_name_); | 43 input_file_ = OpenTestDataFile(file_name_); |
44 ASSERT_TRUE(input_file_ != NULL) << "Input file open failed. Filename: " | 44 ASSERT_TRUE(input_file_ != NULL) << "Input file open failed. Filename: " |
45 << file_name_; | 45 << file_name_; |
| 46 } |
46 | 47 |
47 y4m_input_open(&y4m_, input_file_, NULL, 0, 0); | 48 virtual void ReadSourceToStart() { |
| 49 ASSERT_TRUE(input_file_ != NULL); |
| 50 ASSERT_FALSE(y4m_input_open(&y4m_, input_file_, NULL, 0, 0)); |
48 framerate_numerator_ = y4m_.fps_n; | 51 framerate_numerator_ = y4m_.fps_n; |
49 framerate_denominator_ = y4m_.fps_d; | 52 framerate_denominator_ = y4m_.fps_d; |
50 | |
51 frame_ = 0; | 53 frame_ = 0; |
52 for (unsigned int i = 0; i < start_; i++) { | 54 for (unsigned int i = 0; i < start_; i++) { |
53 Next(); | 55 Next(); |
54 } | 56 } |
| 57 FillFrame(); |
| 58 } |
55 | 59 |
56 FillFrame(); | 60 virtual void Begin() { |
| 61 OpenSource(); |
| 62 ReadSourceToStart(); |
57 } | 63 } |
58 | 64 |
59 virtual void Next() { | 65 virtual void Next() { |
60 ++frame_; | 66 ++frame_; |
61 FillFrame(); | 67 FillFrame(); |
62 } | 68 } |
63 | 69 |
64 virtual vpx_image_t *img() const { | 70 virtual vpx_image_t *img() const { |
65 return (frame_ < limit_) ? img_.get() : NULL; | 71 return (frame_ < limit_) ? img_.get() : NULL; |
66 } | 72 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 unsigned int limit_; | 108 unsigned int limit_; |
103 unsigned int frame_; | 109 unsigned int frame_; |
104 int framerate_numerator_; | 110 int framerate_numerator_; |
105 int framerate_denominator_; | 111 int framerate_denominator_; |
106 y4m_input y4m_; | 112 y4m_input y4m_; |
107 }; | 113 }; |
108 | 114 |
109 } // namespace libvpx_test | 115 } // namespace libvpx_test |
110 | 116 |
111 #endif // TEST_Y4M_VIDEO_SOURCE_H_ | 117 #endif // TEST_Y4M_VIDEO_SOURCE_H_ |
OLD | NEW |