| 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 | |
| 84 virtual const uint8_t *cxdata() const { | 72 virtual const uint8_t *cxdata() const { |
| 85 return end_of_file_ ? NULL : buf_; | 73 return end_of_file_ ? NULL : buf_; |
| 86 } | 74 } |
| 87 virtual size_t frame_size() const { return buf_sz_; } | 75 virtual size_t frame_size() const { return buf_sz_; } |
| 88 virtual unsigned int frame_number() const { return frame_; } | 76 virtual unsigned int frame_number() const { return frame_; } |
| 89 | 77 |
| 90 protected: | 78 protected: |
| 91 std::string file_name_; | 79 std::string file_name_; |
| 92 VpxInputContext *vpx_ctx_; | 80 VpxInputContext *vpx_ctx_; |
| 93 WebmInputContext *webm_ctx_; | 81 WebmInputContext *webm_ctx_; |
| 94 uint8_t *buf_; | 82 uint8_t *buf_; |
| 95 size_t buf_sz_; | 83 size_t buf_sz_; |
| 96 unsigned int frame_; | 84 unsigned int frame_; |
| 97 bool end_of_file_; | 85 bool end_of_file_; |
| 98 }; | 86 }; |
| 99 | 87 |
| 100 } // namespace libvpx_test | 88 } // namespace libvpx_test |
| 101 | 89 |
| 102 #endif // TEST_WEBM_VIDEO_SOURCE_H_ | 90 #endif // TEST_WEBM_VIDEO_SOURCE_H_ |
| OLD | NEW |