Chromium Code Reviews| 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 module arc.mojom; | |
| 6 | |
| 7 import "arc_camera3_metadata.mojom"; | |
| 8 | |
| 9 [Extensible] | |
| 10 enum HalPixelFormat { | |
| 11 HAL_PIXEL_FORMAT_RGBA_8888 = 0x1, | |
| 12 HAL_PIXEL_FORMAT_RGBX_8888 = 0x2, | |
| 13 HAL_PIXEL_FORMAT_BGRA_8888 = 0x5, | |
| 14 HAL_PIXEL_FORMAT_YCrCb_420_SP = 0x11, | |
| 15 HAL_PIXEL_FORMAT_YCbCr_422_I = 0x14, | |
| 16 HAL_PIXEL_FORMAT_BLOB = 0x21, | |
| 17 HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED = 0x22, | |
| 18 HAL_PIXEL_FORMAT_YCbCr_420_888 = 0x23, | |
| 19 HAL_PIXEL_FORMAT_YV12 = 0x32315659, | |
| 20 }; | |
| 21 | |
| 22 // The following enums are from Android's camera HAL v3 API header. | |
| 23 // (hardware/libhardware/include/hardware/camera3.h) | |
| 24 | |
| 25 enum CameraFacing { | |
| 26 CAMERA_FACING_BACK = 0, | |
| 27 CAMERA_FACING_FRONT = 1, | |
| 28 CAMERA_FACING_EXTERNAL = 2, | |
| 29 }; | |
| 30 | |
| 31 enum Camera3StreamType { | |
| 32 CAMERA3_STREAM_OUTPUT = 0, | |
| 33 CAMERA3_STREAM_INPUT = 1, | |
| 34 CAMERA3_STREAM_BIDIRECTIONAL = 2, | |
| 35 CAMERA3_NUM_STREAM_TYPES, | |
| 36 }; | |
| 37 | |
| 38 enum Camera3StreamRotation { | |
| 39 CAMERA3_STREAM_ROTATION_0 = 0, | |
| 40 CAMERA3_STREAM_ROTATION_90 = 1, | |
| 41 CAMERA3_STREAM_ROTATION_180 = 2, | |
| 42 CAMERA3_STREAM_ROTATION_270 = 3, | |
| 43 }; | |
| 44 | |
| 45 [Extensible] | |
| 46 enum Camera3StreamConfigurationMode { | |
| 47 CAMERA3_STREAM_CONFIGURATION_NORMAL_MODE = 0, | |
| 48 CAMERA3_STREAM_CONFIGURATION_CONSTRAINED_HIGH_SPEED_MODE =1, | |
| 49 CAMERA3_VENDOR_STREAM_CONFIGURATION_MODE_START = 0x8000, | |
| 50 }; | |
| 51 | |
| 52 [Extensible] | |
| 53 enum Camera3RequestTemplate { | |
| 54 CAMERA3_TEMPLATE_PREVIEW = 1, | |
| 55 CAMERA3_TEMPLATE_STILL_CAPTURE = 2, | |
| 56 CAMERA3_TEMPLATE_VIDEO_RECORD = 3, | |
| 57 CAMERA3_TEMPLATE_VIDEO_SNAPSHOT = 4, | |
| 58 CAMERA3_TEMPLATE_ZERO_SHUTTER_LAG = 5, | |
| 59 CAMERA3_TEMPLATE_MANUAL = 6, | |
| 60 CAMERA3_TEMPLATE_COUNT, | |
| 61 CAMERA3_VENDOR_TEMPLATE_START = 0x40000000, | |
| 62 }; | |
| 63 | |
| 64 enum Camera3BufferStatus { | |
| 65 CAMERA3_BUFFER_STATUS_OK = 0, | |
| 66 CAMERA3_BUFFER_STATUS_ERROR = 1, | |
| 67 }; | |
| 68 | |
| 69 enum Camera3MsgType { | |
| 70 CAMERA3_MSG_ERROR = 1, | |
| 71 CAMERA3_MSG_SHUTTER = 2, | |
| 72 CAMEAR3_NUM_MESSAGES, | |
| 73 }; | |
| 74 | |
| 75 struct Camera3Stream { | |
| 76 uint64 id; | |
| 77 Camera3StreamType stream_type; | |
| 78 uint32 width; | |
| 79 uint32 height; | |
| 80 HalPixelFormat format; | |
| 81 uint32 usage; | |
| 82 uint32 max_buffers; | |
| 83 uint32 data_space; | |
| 84 Camera3StreamRotation rotation; | |
| 85 }; | |
| 86 | |
| 87 struct Camera3StreamConfiguration { | |
| 88 uint32 num_streams; | |
| 89 array<Camera3Stream> streams; | |
| 90 Camera3StreamConfigurationMode operation_mode; | |
| 91 int32 error; // Used to piggyback error code returned by driver. | |
| 92 }; | |
| 93 | |
| 94 struct Camera3StreamBuffer { | |
| 95 uint64 stream_id; | |
| 96 uint64 buffer_id; | |
| 97 Camera3BufferStatus status; | |
| 98 handle? acquire_fence; | |
| 99 handle? release_fence; | |
| 100 }; | |
| 101 | |
| 102 struct Camera3CaptureRequest { | |
| 103 uint32 frame_number; | |
| 104 CameraMetadata settings; | |
| 105 Camera3StreamBuffer? input_buffer; | |
| 106 uint32 num_output_buffers; | |
| 107 array<Camera3StreamBuffer> output_buffers; | |
| 108 }; | |
| 109 | |
| 110 interface Camera3DeviceOps { | |
|
chfremer
2017/04/27 22:41:41
I see that there are documenting comments in the C
jcliang
2017/04/28 04:47:57
I'll add some comments to briefly explain the flow
| |
| 111 Initialize@0(Camera3CallbackOps callback_ops) => (int32 result); | |
| 112 | |
| 113 ConfigureStreams@1(Camera3StreamConfiguration config) => | |
| 114 (Camera3StreamConfiguration updated_config); | |
| 115 | |
| 116 ConstructDefaultRequestSettings@2(Camera3RequestTemplate type) => | |
| 117 (CameraMetadata? settings); | |
| 118 | |
| 119 ProcessCaptureRequest@3(Camera3CaptureRequest request) => (int32 result); | |
| 120 | |
| 121 Dump@4(handle fd); | |
| 122 | |
| 123 Flush@5() => (int32 result); | |
| 124 | |
| 125 enum BufferType { | |
| 126 GRALLOC = 0, // gralloc buffer. Needs to be imported through GBM. | |
| 127 SHM = 1, // shared memory buffer. Can be mmapped directly. | |
| 128 // Add DMABUF when needed. | |
| 129 }; | |
| 130 | |
| 131 RegisterBuffer@6(uint64 buffer_id, BufferType type, array<handle> fds, | |
|
chfremer
2017/04/27 22:41:41
It seems the buffers are specific to a particular
jcliang
2017/04/28 04:47:58
This mojom is used by both Android and Chrome to t
| |
| 132 uint32 drm_format, HalPixelFormat hal_pixel_format, | |
| 133 uint32 width, uint32 height, array<uint32> strides, | |
| 134 array<uint32> offsets) => | |
| 135 (int32 result); | |
| 136 | |
| 137 Close@7() => (int32 result); | |
| 138 }; | |
| 139 | |
| 140 struct Camera3CaptureResult { | |
| 141 uint32 frame_number; | |
| 142 CameraMetadata result; | |
| 143 uint32 num_output_buffers; | |
| 144 array<Camera3StreamBuffer>? output_buffers; | |
| 145 Camera3StreamBuffer? input_buffer; | |
| 146 uint32 partial_result; | |
| 147 }; | |
| 148 | |
| 149 struct Camera3ErrorMsg { | |
| 150 uint32 frame_number; | |
| 151 uint64 error_stream_id; | |
| 152 int32 error_code; | |
| 153 }; | |
| 154 | |
| 155 struct Camera3ShutterMsg { | |
| 156 uint32 frame_number; | |
| 157 uint64 timestamp; | |
| 158 }; | |
| 159 | |
| 160 union Camera3NotifyMsgMessage { | |
| 161 Camera3ErrorMsg error; | |
| 162 Camera3ShutterMsg shutter; | |
| 163 array<uint8> generic; | |
| 164 }; | |
| 165 | |
| 166 struct Camera3NotifyMsg { | |
| 167 Camera3MsgType type; | |
| 168 Camera3NotifyMsgMessage message; | |
| 169 }; | |
| 170 | |
| 171 interface Camera3CallbackOps { | |
| 172 ProcessCaptureResult@0(Camera3CaptureResult result); | |
| 173 | |
| 174 Notify@1(Camera3NotifyMsg msg); | |
| 175 }; | |
| 176 | |
| 177 struct CameraInfo { | |
| 178 CameraFacing facing; | |
| 179 int32 orientation; | |
| 180 uint32 device_version; | |
| 181 CameraMetadata static_camera_characteristics; | |
| 182 // resource cost is not valid in CAMERA_MODULE_API_VERSION_2_3 or lower. | |
| 183 // conflicting_devices is not valid in CAMERA_MODULE_API_VERSION_2_3 or lower. | |
| 184 // conflicting_devices_length is not valid in CAMERA_MODULE_API_VERSION_2_3 or lower. | |
| 185 }; | |
| 186 | |
| 187 interface CameraModule { | |
| 188 OpenDevice@0(int32 camera_id) => (int32 result, Camera3DeviceOps? device_ops); | |
| 189 | |
| 190 GetNumberOfCameras@1() => (int32 result); | |
| 191 | |
| 192 GetCameraInfo@2(int32 camera_id) => (int32 result, CameraInfo? camera_info); | |
| 193 | |
| 194 SetCallbacks@3(CameraModuleCallbacks callbacks) => (int32 result); | |
| 195 }; | |
| 196 | |
| 197 enum CameraDeviceStatus { | |
| 198 CAMERA_DEVICE_STATUS_NOT_PRESENT = 0, | |
| 199 CAMERA_DEVICE_STATUS_PRESENT = 1, | |
| 200 CAMERA_DEVICE_STATUS_ENUMERATING = 2, | |
| 201 }; | |
| 202 | |
| 203 interface CameraModuleCallbacks { | |
| 204 CameraDeviceStatusChange@0(int32 camera_id, CameraDeviceStatus new_status); | |
| 205 }; | |
| OLD | NEW |