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_WEBM_VIDEO_SOURCE_H_ | 10 #ifndef TEST_WEBM_VIDEO_SOURCE_H_ |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 | 62 |
63 void FillFrame() { | 63 void FillFrame() { |
64 ASSERT_TRUE(vpx_ctx_->file != NULL); | 64 ASSERT_TRUE(vpx_ctx_->file != NULL); |
65 const int status = webm_read_frame(webm_ctx_, &buf_, &buf_sz_, &buf_sz_); | 65 const int status = webm_read_frame(webm_ctx_, &buf_, &buf_sz_, &buf_sz_); |
66 ASSERT_GE(status, 0) << "webm_read_frame failed"; | 66 ASSERT_GE(status, 0) << "webm_read_frame failed"; |
67 if (status == 1) { | 67 if (status == 1) { |
68 end_of_file_ = true; | 68 end_of_file_ = true; |
69 } | 69 } |
70 } | 70 } |
71 | 71 |
| 72 void SeekToNextKeyFrame() { |
| 73 ASSERT_TRUE(vpx_ctx_->file != NULL); |
| 74 do { |
| 75 const int status = webm_read_frame(webm_ctx_, &buf_, &buf_sz_, &buf_sz_); |
| 76 ASSERT_GE(status, 0) << "webm_read_frame failed"; |
| 77 ++frame_; |
| 78 if (status == 1) { |
| 79 end_of_file_ = true; |
| 80 } |
| 81 } while (!webm_ctx_->is_key_frame && !end_of_file_); |
| 82 } |
| 83 |
72 virtual const uint8_t *cxdata() const { | 84 virtual const uint8_t *cxdata() const { |
73 return end_of_file_ ? NULL : buf_; | 85 return end_of_file_ ? NULL : buf_; |
74 } | 86 } |
75 virtual size_t frame_size() const { return buf_sz_; } | 87 virtual size_t frame_size() const { return buf_sz_; } |
76 virtual unsigned int frame_number() const { return frame_; } | 88 virtual unsigned int frame_number() const { return frame_; } |
77 | 89 |
78 protected: | 90 protected: |
79 std::string file_name_; | 91 std::string file_name_; |
80 VpxInputContext *vpx_ctx_; | 92 VpxInputContext *vpx_ctx_; |
81 WebmInputContext *webm_ctx_; | 93 WebmInputContext *webm_ctx_; |
82 uint8_t *buf_; | 94 uint8_t *buf_; |
83 size_t buf_sz_; | 95 size_t buf_sz_; |
84 unsigned int frame_; | 96 unsigned int frame_; |
85 bool end_of_file_; | 97 bool end_of_file_; |
86 }; | 98 }; |
87 | 99 |
88 } // namespace libvpx_test | 100 } // namespace libvpx_test |
89 | 101 |
90 #endif // TEST_WEBM_VIDEO_SOURCE_H_ | 102 #endif // TEST_WEBM_VIDEO_SOURCE_H_ |
OLD | NEW |