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