| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2011 The WebRTC 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 | 10 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 // Closes the input file if open. Essentially makes this class impossible | 39 // Closes the input file if open. Essentially makes this class impossible |
| 40 // to use anymore. Will also be invoked by the destructor. | 40 // to use anymore. Will also be invoked by the destructor. |
| 41 virtual void Close() = 0; | 41 virtual void Close() = 0; |
| 42 | 42 |
| 43 // Frame length in bytes of a single frame image. | 43 // Frame length in bytes of a single frame image. |
| 44 virtual size_t FrameLength() = 0; | 44 virtual size_t FrameLength() = 0; |
| 45 // Total number of frames in the input video source. | 45 // Total number of frames in the input video source. |
| 46 virtual int NumberOfFrames() = 0; | 46 virtual int NumberOfFrames() = 0; |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 class FrameReaderImpl : public FrameReader { | 49 class YuvFrameReaderImpl : public FrameReader { |
| 50 public: | 50 public: |
| 51 // Creates a file handler. The input file is assumed to exist and be readable. | 51 // Creates a file handler. The input file is assumed to exist and be readable. |
| 52 // Parameters: | 52 // Parameters: |
| 53 // input_filename The file to read from. | 53 // input_filename The file to read from. |
| 54 // width, height Size of each frame to read. | 54 // width, height Size of each frame to read. |
| 55 FrameReaderImpl(std::string input_filename, int width, int height); | 55 YuvFrameReaderImpl(std::string input_filename, int width, int height); |
| 56 ~FrameReaderImpl() override; | 56 ~YuvFrameReaderImpl() override; |
| 57 bool Init() override; | 57 bool Init() override; |
| 58 rtc::scoped_refptr<I420Buffer> ReadFrame() override; | 58 rtc::scoped_refptr<I420Buffer> ReadFrame() override; |
| 59 void Close() override; | 59 void Close() override; |
| 60 size_t FrameLength() override; | 60 size_t FrameLength() override; |
| 61 int NumberOfFrames() override; | 61 int NumberOfFrames() override; |
| 62 | 62 |
| 63 private: | 63 private: |
| 64 std::string input_filename_; | 64 const std::string input_filename_; |
| 65 size_t frame_length_in_bytes_; | 65 size_t frame_length_in_bytes_; |
| 66 int width_; | 66 const int width_; |
| 67 int height_; | 67 const int height_; |
| 68 int number_of_frames_; | 68 int number_of_frames_; |
| 69 FILE* input_file_; | 69 FILE* input_file_; |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 } // namespace test | 72 } // namespace test |
| 73 } // namespace webrtc | 73 } // namespace webrtc |
| 74 | 74 |
| 75 #endif // WEBRTC_TEST_TESTSUPPORT_FRAME_READER_H_ | 75 #endif // WEBRTC_TEST_TESTSUPPORT_FRAME_READER_H_ |
| OLD | NEW |