| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MEDIA_VIDEO_CAPTURE_FILE_VIDEO_CAPTURE_DEVICE_H_ | 5 #ifndef MEDIA_VIDEO_CAPTURE_FILE_VIDEO_CAPTURE_DEVICE_H_ |
| 6 #define MEDIA_VIDEO_CAPTURE_FILE_VIDEO_CAPTURE_DEVICE_H_ | 6 #define MEDIA_VIDEO_CAPTURE_FILE_VIDEO_CAPTURE_DEVICE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/files/file.h" | 10 #include "base/files/file.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 static int64 ParseFileAndExtractVideoFormat( | 28 static int64 ParseFileAndExtractVideoFormat( |
| 29 base::File* file, | 29 base::File* file, |
| 30 media::VideoCaptureFormat* video_format); | 30 media::VideoCaptureFormat* video_format); |
| 31 static base::File OpenFileForRead(const base::FilePath& file_path); | 31 static base::File OpenFileForRead(const base::FilePath& file_path); |
| 32 | 32 |
| 33 // Constructor of the class, with a fully qualified file path as input, which | 33 // Constructor of the class, with a fully qualified file path as input, which |
| 34 // represents the Y4M video file to stream repeatedly. | 34 // represents the Y4M video file to stream repeatedly. |
| 35 explicit FileVideoCaptureDevice(const base::FilePath& file_path); | 35 explicit FileVideoCaptureDevice(const base::FilePath& file_path); |
| 36 | 36 |
| 37 // VideoCaptureDevice implementation, class methods. | 37 // VideoCaptureDevice implementation, class methods. |
| 38 virtual ~FileVideoCaptureDevice(); | 38 ~FileVideoCaptureDevice() override; |
| 39 virtual void AllocateAndStart( | 39 void AllocateAndStart(const VideoCaptureParams& params, |
| 40 const VideoCaptureParams& params, | 40 scoped_ptr<VideoCaptureDevice::Client> client) override; |
| 41 scoped_ptr<VideoCaptureDevice::Client> client) override; | 41 void StopAndDeAllocate() override; |
| 42 virtual void StopAndDeAllocate() override; | |
| 43 | 42 |
| 44 private: | 43 private: |
| 45 // Returns size in bytes of an I420 frame, not including possible paddings, | 44 // Returns size in bytes of an I420 frame, not including possible paddings, |
| 46 // defined by |capture_format_|. | 45 // defined by |capture_format_|. |
| 47 int CalculateFrameSize(); | 46 int CalculateFrameSize(); |
| 48 | 47 |
| 49 // Called on the |capture_thread_|. | 48 // Called on the |capture_thread_|. |
| 50 void OnAllocateAndStart(const VideoCaptureParams& params, | 49 void OnAllocateAndStart(const VideoCaptureParams& params, |
| 51 scoped_ptr<Client> client); | 50 scoped_ptr<Client> client); |
| 52 void OnStopAndDeAllocate(); | 51 void OnStopAndDeAllocate(); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 68 int frame_size_; | 67 int frame_size_; |
| 69 int64 current_byte_index_; | 68 int64 current_byte_index_; |
| 70 int64 first_frame_byte_index_; | 69 int64 first_frame_byte_index_; |
| 71 | 70 |
| 72 DISALLOW_COPY_AND_ASSIGN(FileVideoCaptureDevice); | 71 DISALLOW_COPY_AND_ASSIGN(FileVideoCaptureDevice); |
| 73 }; | 72 }; |
| 74 | 73 |
| 75 } // namespace media | 74 } // namespace media |
| 76 | 75 |
| 77 #endif // MEDIA_VIDEO_CAPTURE_FILE_VIDEO_CAPTURE_DEVICE_H_ | 76 #endif // MEDIA_VIDEO_CAPTURE_FILE_VIDEO_CAPTURE_DEVICE_H_ |
| OLD | NEW |