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 module media.mojom; | 5 module media.mojom; |
6 | 6 |
7 // Equivalent to idl MediaSettingsRange, arbitrary range representing the | 7 // Equivalent to idl MediaSettingsRange, arbitrary range representing the |
8 // allowed variations of a Capability or an Option. | 8 // allowed variations of a Capability or an Option. |
9 // https://www.w3.org/TR/image-capture/#MediaSettingsRange | 9 // https://w3c.github.io/mediacapture-image/#mediasettingsrange-section |
10 struct Range { | 10 struct Range { |
11 double max; | 11 double max; |
12 double min; | 12 double min; |
13 double current; | 13 double current; |
14 double step; | 14 double step; |
15 }; | 15 }; |
16 | 16 |
17 // https://www.w3.org/TR/image-capture/#MeteringMode | 17 // https://w3c.github.io/mediacapture-image/#mediasettingsrange-section |
18 enum MeteringMode { NONE, MANUAL, SINGLE_SHOT, CONTINUOUS }; | 18 enum MeteringMode { NONE, MANUAL, SINGLE_SHOT, CONTINUOUS }; |
19 | 19 |
20 // https://www.w3.org/TR/image-capture/#FillLightMode | 20 // https://w3c.github.io/mediacapture-image/#redeyereduction-section |
21 enum FillLightMode { NONE, OFF, AUTO, FLASH, TORCH }; | 21 enum RedEyeReduction { NEVER, ALWAYS, CONTROLLABLE }; |
22 | 22 |
23 // Equivalent to idl PhotoCapabilities, | 23 // https://www.w3.org/TR/image-capture/#FillLightMode |
24 // https://www.w3.org/TR/image-capture/#PhotoCapabilities | 24 enum FillLightMode { OFF, AUTO, FLASH }; |
| 25 |
| 26 // Equivalent to idl's MediaTrackCapabilities plus PhotoCapabilities. |
25 struct PhotoCapabilities { | 27 struct PhotoCapabilities { |
| 28 // https://w3c.github.io/mediacapture-image/#mediatrackcapabilities-section |
26 MeteringMode white_balance_mode; | 29 MeteringMode white_balance_mode; |
| 30 MeteringMode exposure_mode; |
| 31 MeteringMode focus_mode; |
| 32 |
| 33 Range exposure_compensation; |
27 Range color_temperature; | 34 Range color_temperature; |
28 MeteringMode exposure_mode; | |
29 Range exposure_compensation; | |
30 Range iso; | 35 Range iso; |
31 bool red_eye_reduction; | |
32 MeteringMode focus_mode; | |
33 | 36 |
34 Range brightness; | 37 Range brightness; |
35 Range contrast; | 38 Range contrast; |
36 Range saturation; | 39 Range saturation; |
37 Range sharpness; | 40 Range sharpness; |
| 41 |
| 42 Range zoom; |
| 43 |
| 44 bool torch; |
| 45 |
| 46 // https://w3c.github.io/mediacapture-image/##photocapabilities-section |
| 47 RedEyeReduction red_eye_reduction; |
38 Range height; | 48 Range height; |
39 Range width; | 49 Range width; |
40 Range zoom; | 50 array<FillLightMode> fill_light_mode; |
41 FillLightMode fill_light_mode; | |
42 }; | 51 }; |
43 | 52 |
44 // Equivalent to idl Point2D. | 53 // Equivalent to idl Point2D. |
| 54 // https://w3c.github.io/mediacapture-image/#point2d-section |
45 // TODO(mcasas): use gfx::mojom::PointF after https://crbug.com/640049. | 55 // TODO(mcasas): use gfx::mojom::PointF after https://crbug.com/640049. |
46 struct Point2D { | 56 struct Point2D { |
47 float x; | 57 float x; |
48 float y; | 58 float y; |
49 }; | 59 }; |
50 | 60 |
51 // Equivalent to idl PhotoSettings, | 61 // Equivalent to idl PhotoSettings + MediaTrackSettings/MediaTrackConstraintSet. |
52 // https://www.w3.org/TR/image-capture/#PhotoSettings | 62 // PODs cannot be nullable, i.e. uint32? bla doesn't work, use |has_bla| flags. |
53 struct PhotoSettings { | 63 struct PhotoSettings { |
54 // uint32 cannot be nullable, i.e. uint32? does not work, use instead a flag. | 64 // https://w3c.github.io/mediacapture-image/#mediatracksettings-section and |
| 65 // https://w3c.github.io/mediacapture-image/#mediatrackconstraintset-section |
55 bool has_white_balance_mode; | 66 bool has_white_balance_mode; |
56 MeteringMode white_balance_mode; | 67 MeteringMode white_balance_mode; |
57 bool has_color_temperature; | |
58 double color_temperature; | |
59 bool has_exposure_mode; | 68 bool has_exposure_mode; |
60 MeteringMode exposure_mode; | 69 MeteringMode exposure_mode; |
61 bool has_exposure_compensation; | |
62 double exposure_compensation; | |
63 bool has_iso; | |
64 double iso; | |
65 bool has_red_eye_reduction; | |
66 bool red_eye_reduction; | |
67 bool has_focus_mode; | 70 bool has_focus_mode; |
68 MeteringMode focus_mode; | 71 MeteringMode focus_mode; |
69 array<Point2D> points_of_interest; | 72 array<Point2D> points_of_interest; |
70 | 73 |
| 74 bool has_exposure_compensation; |
| 75 double exposure_compensation; |
| 76 bool has_color_temperature; |
| 77 double color_temperature; |
| 78 bool has_iso; |
| 79 double iso; |
| 80 |
71 bool has_brightness; | 81 bool has_brightness; |
72 double brightness; | 82 double brightness; |
73 bool has_contrast; | 83 bool has_contrast; |
74 double contrast; | 84 double contrast; |
75 bool has_saturation; | 85 bool has_saturation; |
76 double saturation; | 86 double saturation; |
77 bool has_sharpness; | 87 bool has_sharpness; |
78 double sharpness; | 88 double sharpness; |
| 89 |
79 bool has_zoom; | 90 bool has_zoom; |
80 double zoom; | 91 double zoom; |
| 92 |
| 93 bool has_torch; |
| 94 bool torch; |
| 95 |
| 96 // https://w3c.github.io/mediacapture-image/##photosettings-section |
| 97 bool has_fill_light_mode; |
| 98 FillLightMode fill_light_mode; |
81 bool has_width; | 99 bool has_width; |
82 double width; | 100 double width; |
83 bool has_height; | 101 bool has_height; |
84 double height; | 102 double height; |
85 bool has_fill_light_mode; | 103 bool has_red_eye_reduction; |
86 FillLightMode fill_light_mode; | 104 bool red_eye_reduction; |
87 }; | 105 }; |
88 | 106 |
89 // This is a mojo move-only equivalent of a Blob, i.e. MIME type and Data. | 107 // This is a mojo move-only equivalent of a Blob, i.e. MIME type and Data. |
90 struct Blob { | 108 struct Blob { |
91 string mime_type; | 109 string mime_type; |
92 array<uint8> data; | 110 array<uint8> data; |
93 }; | 111 }; |
94 | 112 |
95 // |source_id| is the renderer-side UUID identifier of the image capture device. | 113 // |source_id| is the renderer-side UUID identifier of the image capture device. |
96 interface ImageCapture | 114 interface ImageCapture |
97 { | 115 { |
98 // Retrieves the image capture device capabilities and current settings. | 116 // Retrieves the image capture device capabilities and current settings. |
99 // https://www.w3.org/TR/image-capture/#dom-imagecapture-getphotocapabilitie
s | 117 // https://www.w3.org/TR/image-capture/#dom-imagecapture-getphotocapabilitie
s |
100 GetCapabilities(string source_id) | 118 GetCapabilities(string source_id) |
101 => (PhotoCapabilities capabilities); | 119 => (PhotoCapabilities capabilities); |
102 | 120 |
103 // Sets the |settings| on the associated video capture device. | 121 // Sets the |settings| on the associated video capture device. |
104 // https://www.w3.org/TR/image-capture/#dom-imagecapture-setoptions | 122 // https://www.w3.org/TR/image-capture/#dom-imagecapture-setoptions |
105 SetOptions(string source_id, PhotoSettings settings) | 123 SetOptions(string source_id, PhotoSettings settings) |
106 => (bool success); | 124 => (bool success); |
107 | 125 |
108 // Takes a Photo from the given |source_id|, returning it encoded in |blob| | 126 // Takes a Photo from the given |source_id|, returning it encoded in |blob| |
109 // with the format specified in its |mime_type|. | 127 // with the format specified in its |mime_type|. |
110 // https://www.w3.org/TR/image-capture/#dom-imagecapture-takephoto | 128 // https://www.w3.org/TR/image-capture/#dom-imagecapture-takephoto |
111 TakePhoto(string source_id) | 129 TakePhoto(string source_id) |
112 => (Blob blob); | 130 => (Blob blob); |
113 }; | 131 }; |
OLD | NEW |