| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 SERVICES_VIDEO_CAPTURE_PUBLIC_CPP_VIDEO_CAPTURE_FORMAT_H_ | 5 #ifndef SERVICES_VIDEO_CAPTURE_PUBLIC_CPP_CAPTURE_SETTINGS_H_ |
| 6 #define SERVICES_VIDEO_CAPTURE_PUBLIC_CPP_VIDEO_CAPTURE_FORMAT_H_ | 6 #define SERVICES_VIDEO_CAPTURE_PUBLIC_CPP_CAPTURE_SETTINGS_H_ |
| 7 | 7 |
| 8 #include "media/capture/video_capture_types.h" | 8 #include "media/capture/video_capture_types.h" |
| 9 #include "ui/gfx/geometry/size.h" | 9 #include "ui/gfx/geometry/size.h" |
| 10 | 10 |
| 11 namespace video_capture { | 11 namespace video_capture { |
| 12 | 12 |
| 13 // Cpp equivalent of Mojo struct video_capture::mojom::VideoCaptureFormat. | 13 // Cpp equivalent of Mojo struct video_capture::mojom::CaptureFormat. |
| 14 struct VideoCaptureFormat { | 14 struct I420CaptureFormat { |
| 15 gfx::Size frame_size; | 15 gfx::Size frame_size; |
| 16 float frame_rate; | 16 float frame_rate; |
| 17 | 17 |
| 18 bool operator==(const VideoCaptureFormat& other) const { | 18 bool operator==(const I420CaptureFormat& other) const { |
| 19 return frame_size == other.frame_size && frame_rate == other.frame_rate; | 19 return frame_size == other.frame_size && frame_rate == other.frame_rate; |
| 20 } | 20 } |
| 21 | 21 |
| 22 void ConvertToMediaVideoCaptureFormat( | 22 void ConvertToMediaVideoCaptureFormat( |
| 23 media::VideoCaptureFormat* target) const { | 23 media::VideoCaptureFormat* target) const { |
| 24 target->frame_size = frame_size; | 24 target->frame_size = frame_size; |
| 25 target->frame_rate = frame_rate; | 25 target->frame_rate = frame_rate; |
| 26 target->pixel_format = media::PIXEL_FORMAT_I420; | 26 target->pixel_format = media::PIXEL_FORMAT_I420; |
| 27 target->pixel_storage = media::PIXEL_STORAGE_CPU; | 27 target->pixel_storage = media::PIXEL_STORAGE_CPU; |
| 28 } | 28 } |
| 29 }; | 29 }; |
| 30 | 30 |
| 31 // Cpp equivalent of Mojo struct video_capture::mojom::VideoCaptureSettings. | 31 // Cpp equivalent of Mojo struct video_capture::mojom::CaptureSettings. |
| 32 struct VideoCaptureSettings { | 32 struct CaptureSettings { |
| 33 VideoCaptureFormat format; | 33 I420CaptureFormat format; |
| 34 media::ResolutionChangePolicy resolution_change_policy; | 34 media::ResolutionChangePolicy resolution_change_policy; |
| 35 media::PowerLineFrequency power_line_frequency; | 35 media::PowerLineFrequency power_line_frequency; |
| 36 | 36 |
| 37 void ConvertToMediaVideoCaptureParams( | 37 void ConvertToMediaVideoCaptureParams( |
| 38 media::VideoCaptureParams* target) const { | 38 media::VideoCaptureParams* target) const { |
| 39 format.ConvertToMediaVideoCaptureFormat(&(target->requested_format)); | 39 format.ConvertToMediaVideoCaptureFormat(&(target->requested_format)); |
| 40 target->resolution_change_policy = resolution_change_policy; | 40 target->resolution_change_policy = resolution_change_policy; |
| 41 target->power_line_frequency = power_line_frequency; | 41 target->power_line_frequency = power_line_frequency; |
| 42 } | 42 } |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 } // namespace video_capture | 45 } // namespace video_capture |
| 46 | 46 |
| 47 #endif // SERVICES_VIDEO_CAPTURE_PUBLIC_CPP_VIDEO_CAPTURE_FORMAT_H_ | 47 #endif // SERVICES_VIDEO_CAPTURE_PUBLIC_CPP_CAPTURE_SETTINGS_H_ |
| OLD | NEW |