1/* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * @file Types.h 18 * 19 * @brief Declares data types 20 * used by the Hardware Driver Interfaces (HDIs) of this module. 21 * 22 * @since 3.2 23 * @version 1.3 24 */ 25 26package ohos.hdi.camera.v1_3; 27 28import ohos.hdi.camera.v1_2.Types; 29import ohos.hdi.camera.v1_0.Types; 30 31sequenceable ohos.hdi.camera.v1_0.BufferHandleSequenceable; 32sequenceable ohos.hdi.camera.v1_0.MapDataSequenceable; 33 34/** 35 * @brief Enumerates stream operation modes. 36 * @since 3.2 37 * @version 1.3 38 */ 39enum OperationMode : ohos.hdi.camera.v1_2.OperationMode_V1_2 { 40 41 /** 42 * Professional mode, which dedicated to professional photo scene 43 * Abandoned, use the new operationMode below 44 * 45 * @since 4.1 46 * @version 1.1 47 */ 48 PROFESSIONAL_V1_3 = PROFESSIONAL, 49 50 /** 51 * Professional mode, which dedicated to capture code 52 * 53 * @since 5.0 54 * @version 1.0 55 */ 56 PROFESSIONAL_PHOTO = 11, 57 58 /** 59 * Professional mode, which dedicated to video code 60 * 61 * @since 5.0 62 * @version 1.0 63 */ 64 PROFESSIONAL_VIDEO = 12, 65 66 /** 67 * Slow motion mode, which dedicated to video recording slow motion 68 * 69 * @since 5.0 70 * @version 1.0 71 */ 72 HIGH_FRAME_RATE = 13, 73 74 /** 75 * High resolution photo mode, which dedicated to capture recording high pixel 76 * 77 * @since 5.0 78 * @version 1.0 79 */ 80 HIGH_RESOLUTION_PHOTO = 14, 81 82 /** 83 * Secure mode, which dedicated to secure mode 84 * @since 5.0 85 * @version 1.0 86 */ 87 SECURE = 15, 88 89 /** 90 * quick shot photo mode, which dedicated to quick shot photo mode 91 * @since 5.0 92 * @version 1.0 93 */ 94 QUICK_SHOT_PHOTO = 16, 95 96 /** 97 * Light painting mode, which dedicated to light painting mode 98 * @since 5.0 99 * @version 1.0 100 */ 101 LIGHT_PAINTING = 17, 102 103 /** 104 * Panorama photo mode, which dedicated to panorama photo mode 105 * @since 5.0 106 * @version 1.0 107 */ 108 PANORAMA_PHOTO = 18, 109 110 /** 111 * Timelapse photo mode, which dedicated to timelapse photo mode 112 * @since 5.0 113 * @version 1.0 114 */ 115 TIMELAPSE_PHOTO = 19, 116 117 /** 118 * Aperture video mode, which dedicated to aperture video mode 119 * @since 5.0 120 * @version 1.0 121 */ 122 APERTURE_VIDEO = 20, 123 124 /** 125 * fluorescence photo mode, which dedicated to fluorescence photo mode 126 * @since 5.0 127 * @version 1.0 128 */ 129 FLUORESCENCE_PHOTO = 21, 130 131 /** 132 * sun block mode, which dedicated to uv sunscreen detection mode 133 * @since 5.0 134 * @version 1.0 135 */ 136 SUN_BLOCK = 22, 137}; 138 139/** 140 * @brief Enumerates types of the extended stream information. 141 * @since 4.0 142 * @version 1.2 143 */ 144enum ExtendedStreamInfoType : ohos.hdi.camera.v1_2.ExtendedStreamInfoType_V1_2 { 145 146 /** 147 * Extended stream information of raw. 148 * @since 5.0 149 * @version 1.0 150 */ 151 EXTENDED_STREAM_INFO_RAW = 2, 152 153 /** 154 * Extended stream information of depth. 155 * @since 5.0 156 * @version 1.0 157 */ 158 EXTENDED_STREAM_INFO_DEPTH = 3, 159 160 /** 161 * Extended stream information of meta. 162 * @since 5.0 163 * @version 1.0 164 */ 165 EXTENDED_STREAM_INFO_META = 4, 166 167 /** 168 * Extended stream information of secure. 169 * @since 5.0 170 * @version 1.0 171 */ 172 EXTENDED_STREAM_INFO_SECURE = 5, 173 174 /** 175 * Extended stream information of maker. 176 * @since 5.0 177 * @version 1.0 178 */ 179 EXTENDED_STREAM_INFO_MAKER_INFO = 6, 180 181 /** 182 * Extended stream information of exif. 183 * @since 5.0 184 * @version 1.0 185 */ 186 EXTENDED_STREAM_INFO_EXIF = 7, 187 188 /** 189 * Extended stream information of gainmap. 190 * @since 5.0 191 * @version 1.0 192 */ 193 EXTENDED_STREAM_INFO_GAINMAP = 8, 194 195 /** 196 * Extended stream information of unrefocus. 197 * @since 5.0 198 * @version 1.0 199 */ 200 EXTENDED_STREAM_INFO_UNREFOCUS = 9, 201 202 /** 203 * Extended stream information of linear. 204 * @since 5.0 205 * @version 1.0 206 */ 207 EXTENDED_STREAM_INFO_LINEAR = 10, 208 209 /** 210 * Extended stream information of fragment. 211 * @since 5.0 212 * @version 1.0 213 */ 214 EXTENDED_STREAM_INFO_FRAGMENT =11, 215 216 /** 217 * Extended stream information of uv sunscreen detection 218 * @since 5.0 219 * @version 1.0 220 */ 221 EXTENDED_STREAM_INFO_UV = 12, 222}; 223 224/** 225 * @brief Enumerates stream types. 226 * @since 5.0 227 * @version 1.0 228 */ 229enum StreamType { 230 231 /** 232 * Preview streams, indicating that stream data is used for preview 233 */ 234 STREAM_TYPE_PREVIEW = 0, 235 236 /** 237 * Video streams, indicating that stream data is used to encode and generate videos 238 */ 239 STREAM_TYPE_VIDEO = 1, 240 241 /** 242 * Photographing streams, indicating that stream data is used to encode and generate images 243 */ 244 STREAM_TYPE_STILL_CAPTURE = 2, 245 246 /** 247 * Stream data that is used to store thumbnails 248 */ 249 STREAM_TYPE_POST_VIEW = 3, 250 251 /** 252 * Stream data that is used for image analysis 253 */ 254 STREAM_TYPE_ANALYZE = 4, 255 256 /** 257 * Custom type 258 */ 259 STREAM_TYPE_CUSTOM = 5, 260 261 /** 262 * Depth type 263 */ 264 STREAM_TYPE_DEPTH = 6, 265}; 266 267/** 268 * @brief Enumerates types of the execution modes. 269 * @since 4.1 270 * @version 1.1 271 */ 272enum ExecutionMode : ohos.hdi.camera.v1_2.ExecutionMode { 273 /** 274 * Default mode. 275 */ 276 DEFAULT = 3, 277}; 278 279/** 280 * @brief Enumerates camera device error types, which are used by {@link OnError}. 281 * @since 3.2 282 * @version 1.1 283 */ 284enum ErrorType : ohos.hdi.camera.v1_0.ErrorType { 285 /** 286 * sensor data error. 287 * @since 5.0 288 * @version 1.0 289 */ 290 SENSOR_DATA_ERROR = 5, 291}; 292 293/** 294 * @brief Defines the CameraDeviceResourceCost, which is used by {@link ICameraDevice::GetResourceCost}. 295 */ 296struct CameraDeviceResourceCost { 297 /** 298 * @brief Total resource cost of using current camera device, scope is [0, 100]. 299 */ 300 unsigned int resourceCost_; 301 302 /** 303 * @brief Cameradevices ID that can not open while current camera device is on. 304 */ 305 String[] conflictingDevices_; 306}; 307 308/** 309 * @brief Enumerates camera media stream type. 310 * @since 5.0 311 * @version 1.0 312 */ 313enum MediaStreamType { 314 /** 315 * video media stream 316 * @since 5.0 317 * @version 1.0 318 */ 319 MEDIA_STREAM_TYPE_VIDEO = 0, 320 /** 321 * metadata media stream 322 * @since 5.0 323 * @version 1.0 324 */ 325 MEDIA_STREAM_TYPE_METADATA = 1, 326 /** 327 * maker media stream 328 * @since 5.0 329 * @version 1.0 330 */ 331 MEDIA_STREAM_TYPE_MAKER = 2, 332}; 333 334/** 335 * @brief Defines the SteramDescription, which is used by {@link IVideoProcessSession::Prepare}. 336 * @since 5.0 337 * @version 1.0 338 */ 339struct StreamDescription { 340 /** 341 * stream id 342 * @since 5.0 343 * @version 1.0 344 */ 345 int streamId; 346 /** 347 * media stream type 348 * @since 5.0 349 * @version 1.0 350 */ 351 enum MediaStreamType type; 352 /** 353 * pixel format 354 * @since 5.0 355 * @version 1.0 356 */ 357 int pixelFormat; 358 /** 359 * image width 360 * @since 5.0 361 * @version 1.0 362 */ 363 int width; 364 /** 365 * image height 366 * @since 5.0 367 * @version 1.0 368 */ 369 int height; 370 /** 371 * image color space 372 * @since 5.0 373 * @version 1.0 374 */ 375 int dataspace; 376}; 377 378/** 379 * @brief Defines the CaptureEndedInfoExt, which is used by {@link IStreamOperatorCallback::OnCaptureEndedExt}. 380 * @since 5.0 381 * @version 1.0 382 */ 383struct CaptureEndedInfoExt { 384 /** 385 * stream id 386 * @since 5.0 387 * @version 1.0 388 */ 389 int streamId_; 390 /** 391 * frame count 392 * @since 5.0 393 * @version 1.0 394 */ 395 int frameCount_; 396 /** 397 * whether deffered video enhancement available 398 * @since 5.0 399 * @version 1.0 400 */ 401 boolean isDeferredVideoEnhancementAvailable_; 402 /** 403 * video id 404 * @since 5.0 405 * @version 1.0 406 */ 407 String videoId_; 408}; 409 410/** 411 * @brief Defines the ImageBufferInfo, which is used by {@link IImageProcessCallback::OnProcessDoneExt}. 412 * @since 5.0 413 * @version 1.0 414 */ 415struct ImageBufferInfoExt { 416 /** 417 * @brief The information of metadata. 418 * @since 5.0 419 * @version 1.0 420 */ 421 MapDataSequenceable metadata; 422 423 /** 424 * @brief The information of imageHandle. 425 * @since 5.0 426 * @version 1.0 427 */ 428 BufferHandleSequenceable imageHandle; 429 430 /** 431 * @brief If the gain map reported. 432 * @since 5.0 433 * @version 1.0 434 */ 435 boolean isGainMapValid; 436 437 /** 438 * @brief The gain map information. 439 * @since 5.0 440 * @version 1.0 441 */ 442 BufferHandleSequenceable gainMapHandle; 443 444 /** 445 * @brief Is depthMapHandle valid. 446 * @since 5.0 447 * @version 1.0 448 */ 449 boolean isDepthMapValid; 450 451 /** 452 * @brief Data of metadata. 453 * @since 5.0 454 * @version 1.0 455 */ 456 BufferHandleSequenceable depthMapHandle; 457 458 /** 459 * @brief If the unrefocus image of portrait mode reported. 460 * @since 5.0 461 * @version 1.0 462 */ 463 boolean isUnrefocusImageValid; 464 465 /** 466 * @brief The unrefocus image of portrait mode. 467 * @since 5.0 468 * @version 1.0 469 */ 470 BufferHandleSequenceable unrefocusImageHandle; 471 472 /** 473 * @brief If the high bit depth linear image reported. 474 * @since 5.0 475 * @version 1.0 476 */ 477 boolean isHighBitDepthLinearImageValid; 478 479 /** 480 * @brief The high bit depth linear image. 481 * @since 5.0 482 * @version 1.0 483 */ 484 BufferHandleSequenceable highBitDepthLinearImageHandle; 485 486 /** 487 * @brief If the exif information reported. 488 * @since 5.0 489 * @version 1.0 490 */ 491 boolean isExifValid; 492 493 /** 494 * @brief The exif information. 495 * @since 5.0 496 * @version 1.0 497 */ 498 BufferHandleSequenceable exifHandle; 499 500 /** 501 * @brief If the maker information reported. 502 * @since 5.0 503 * @version 1.0 504 */ 505 boolean isMakerInfoValid; 506 507 /** 508 * @brief The maker information. 509 * @since 5.0 510 * @version 1.0 511 */ 512 BufferHandleSequenceable makerInfoHandle; 513}; 514 515/** 516 * @brief Enumerates encoding types of stream data. 517 * @since 5.0 518 * @version 1.0 519 */ 520enum EncodeType : ohos.hdi.camera.v1_0.EncodeType { 521 /** 522 * HEIC 523 */ 524 ENCODE_TYPE_HEIC = 4, 525}; 526 527/** 528 * @brief Enumerates stream error types, which are used by {@link CaptureErrorInfo}. 529 * @since 3.2 530 * @version 1.1 531 */ 532enum StreamError : ohos.hdi.camera.v1_0.StreamError { 533 /** 534 * When the sensor temperature is higher than the threshold, the cameraHal will stop the sketch stream 535 * and report the high temperature error through by {@link OnCaptureError}. 536 * @since 5.0 537 * @version 1.0 538 */ 539 HIGH_TEMPERATURE_ERROR = 2, 540};