| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 chunks_(0), | 83 chunks_(0), |
| 84 buf_(NULL), | 84 buf_(NULL), |
| 85 buf_sz_(0), | 85 buf_sz_(0), |
| 86 frame_(0), | 86 frame_(0), |
| 87 end_of_file_(false) { | 87 end_of_file_(false) { |
| 88 } | 88 } |
| 89 | 89 |
| 90 virtual ~WebMVideoSource() { | 90 virtual ~WebMVideoSource() { |
| 91 if (input_file_) | 91 if (input_file_) |
| 92 fclose(input_file_); | 92 fclose(input_file_); |
| 93 if (nestegg_ctx_) | 93 if (nestegg_ctx_ != NULL) { |
| 94 if (pkt_ != NULL) { |
| 95 nestegg_free_packet(pkt_); |
| 96 } |
| 94 nestegg_destroy(nestegg_ctx_); | 97 nestegg_destroy(nestegg_ctx_); |
| 98 } |
| 95 } | 99 } |
| 96 | 100 |
| 97 virtual void Init() { | 101 virtual void Init() { |
| 98 } | 102 } |
| 99 | 103 |
| 100 virtual void Begin() { | 104 virtual void Begin() { |
| 101 input_file_ = OpenTestDataFile(file_name_); | 105 input_file_ = OpenTestDataFile(file_name_); |
| 102 ASSERT_TRUE(input_file_ != NULL) << "Input file open failed. Filename: " | 106 ASSERT_TRUE(input_file_ != NULL) << "Input file open failed. Filename: " |
| 103 << file_name_; | 107 << file_name_; |
| 104 | 108 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 129 FillFrame(); | 133 FillFrame(); |
| 130 } | 134 } |
| 131 | 135 |
| 132 void FillFrame() { | 136 void FillFrame() { |
| 133 ASSERT_TRUE(input_file_ != NULL); | 137 ASSERT_TRUE(input_file_ != NULL); |
| 134 if (chunk_ >= chunks_) { | 138 if (chunk_ >= chunks_) { |
| 135 unsigned int track; | 139 unsigned int track; |
| 136 | 140 |
| 137 do { | 141 do { |
| 138 /* End of this packet, get another. */ | 142 /* End of this packet, get another. */ |
| 139 if (pkt_) | 143 if (pkt_ != NULL) { |
| 140 nestegg_free_packet(pkt_); | 144 nestegg_free_packet(pkt_); |
| 145 pkt_ = NULL; |
| 146 } |
| 141 | 147 |
| 142 int again = nestegg_read_packet(nestegg_ctx_, &pkt_); | 148 int again = nestegg_read_packet(nestegg_ctx_, &pkt_); |
| 143 ASSERT_GE(again, 0) << "nestegg_read_packet failed"; | 149 ASSERT_GE(again, 0) << "nestegg_read_packet failed"; |
| 144 if (!again) { | 150 if (!again) { |
| 145 end_of_file_ = true; | 151 end_of_file_ = true; |
| 146 return; | 152 return; |
| 147 } | 153 } |
| 148 | 154 |
| 149 ASSERT_FALSE(nestegg_packet_track(pkt_, &track)) | 155 ASSERT_FALSE(nestegg_packet_track(pkt_, &track)) |
| 150 << "nestegg_packet_track failed"; | 156 << "nestegg_packet_track failed"; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 176 unsigned int chunks_; | 182 unsigned int chunks_; |
| 177 uint8_t *buf_; | 183 uint8_t *buf_; |
| 178 size_t buf_sz_; | 184 size_t buf_sz_; |
| 179 unsigned int frame_; | 185 unsigned int frame_; |
| 180 bool end_of_file_; | 186 bool end_of_file_; |
| 181 }; | 187 }; |
| 182 | 188 |
| 183 } // namespace libvpx_test | 189 } // namespace libvpx_test |
| 184 | 190 |
| 185 #endif // TEST_WEBM_VIDEO_SOURCE_H_ | 191 #endif // TEST_WEBM_VIDEO_SOURCE_H_ |
| OLD | NEW |