1 /*
2 * Copyright (c) 2021-2022 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 #ifndef OHOS_CAMERA_CAPTURE_SESSION_H
17 #define OHOS_CAMERA_CAPTURE_SESSION_H
18
19 #include <atomic>
20 #include <cstdint>
21 #include <iostream>
22 #include <map>
23 #include <memory>
24 #include <mutex>
25 #include <set>
26 #include <sstream>
27 #include <string>
28 #include <unordered_map>
29 #include <vector>
30
31 #include "camera_error_code.h"
32 #include "camera_photo_proxy.h"
33 #include "capture_scene_const.h"
34 #include "color_space_info_parse.h"
35 #include "features/moon_capture_boost_feature.h"
36 #include "hcapture_session_callback_stub.h"
37 #include "hcamera_service_callback_stub.h"
38 #include "icamera_util.h"
39 #include "icapture_session.h"
40 #include "icapture_session_callback.h"
41 #include "input/camera_death_recipient.h"
42 #include "input/capture_input.h"
43 #include "output/camera_output_capability.h"
44 #include "output/capture_output.h"
45 #include "refbase.h"
46 #include "effect_suggestion_info_parse.h"
47 #include "capture_scene_const.h"
48 #include "ability/camera_ability.h"
49 #include "ability/camera_ability_parse_util.h"
50
51 namespace OHOS {
52 namespace CameraStandard {
53 enum FocusState {
54 FOCUS_STATE_SCAN = 0,
55 FOCUS_STATE_FOCUSED,
56 FOCUS_STATE_UNFOCUSED
57 };
58
59 enum ExposureState {
60 EXPOSURE_STATE_SCAN = 0,
61 EXPOSURE_STATE_CONVERGED
62 };
63
64 enum FilterType {
65 NONE = 0,
66 CLASSIC = 1,
67 DAWN = 2,
68 PURE = 3,
69 GREY = 4,
70 NATURAL = 5,
71 MORI = 6,
72 FAIR = 7,
73 PINK = 8,
74 };
75
76 enum PreconfigType : int32_t {
77 PRECONFIG_720P = 0,
78 PRECONFIG_1080P = 1,
79 PRECONFIG_4K = 2,
80 PRECONFIG_HIGH_QUALITY = 3
81 };
82
83 enum UsageType {
84 BOKEH = 0
85 };
86
87 struct PreconfigProfiles {
88 public:
PreconfigProfilesPreconfigProfiles89 explicit PreconfigProfiles(ColorSpace colorSpace) : colorSpace(colorSpace) {}
90 Profile previewProfile;
91 Profile photoProfile;
92 VideoProfile videoProfile;
93 ColorSpace colorSpace;
94
ToStringPreconfigProfiles95 std::string ToString()
96 {
97 std::ostringstream oss;
98 oss << "colorSpace:[" << to_string(colorSpace);
99 oss << "]\n";
100
101 oss << "previewProfile:[";
102 oss << " format:" << to_string(previewProfile.format_);
103 oss << " size:" << to_string(previewProfile.size_.width) << "x" << to_string(previewProfile.size_.height);
104 oss << " fps:" << to_string(previewProfile.fps_.minFps) << "," << to_string(previewProfile.fps_.maxFps) << ","
105 << to_string(previewProfile.fps_.fixedFps);
106 oss << "]\n";
107
108 oss << "photoProfile:[";
109 oss << " format:" << to_string(photoProfile.format_);
110 oss << " size:" << to_string(photoProfile.size_.width) << "x" << to_string(photoProfile.size_.height);
111 oss << " dynamic:" << to_string(photoProfile.sizeFollowSensorMax_) << "," << to_string(photoProfile.sizeRatio_);
112 oss << "]\n";
113
114 oss << "videoProfile:[";
115 oss << " format:" << to_string(videoProfile.format_);
116 oss << " size:" << to_string(videoProfile.size_.width) << "x" << to_string(videoProfile.size_.height);
117 oss << " frameRates:";
118 for (auto& fps : videoProfile.framerates_) {
119 oss << to_string(fps) << " ";
120 }
121 oss << "]\n";
122 return oss.str();
123 }
124 };
125
126 enum EffectSuggestionType {
127 EFFECT_SUGGESTION_NONE = 0,
128 EFFECT_SUGGESTION_PORTRAIT,
129 EFFECT_SUGGESTION_FOOD,
130 EFFECT_SUGGESTION_SKY,
131 EFFECT_SUGGESTION_SUNRISE_SUNSET,
132 EFFECT_SUGGESTION_STAGE
133 };
134
135 typedef enum {
136 AWB_MODE_AUTO = 0,
137 AWB_MODE_CLOUDY_DAYLIGHT,
138 AWB_MODE_INCANDESCENT,
139 AWB_MODE_FLUORESCENT,
140 AWB_MODE_DAYLIGHT,
141 AWB_MODE_OFF,
142 AWB_MODE_LOCKED,
143 AWB_MODE_WARM_FLUORESCENT,
144 AWB_MODE_TWILIGHT,
145 AWB_MODE_SHADE,
146 } WhiteBalanceMode;
147
148 enum LightPaintingType {
149 CAR = 0,
150 STAR,
151 WATER,
152 LIGHT
153 };
154
155 typedef struct {
156 float x;
157 float y;
158 } Point;
159
160 enum class FwkTripodStatus {
161 INVALID = 0,
162 ACTIVE,
163 ENTER,
164 EXITING
165 };
166
167 typedef struct {
168 float zoomRatio;
169 int32_t equivalentFocalLength;
170 } ZoomPointInfo;
171
172 template<class T>
173 struct RefBaseCompare {
174 public:
operatorRefBaseCompare175 bool operator()(const wptr<T>& firstPtr, const wptr<T>& secondPtr) const
176 {
177 return firstPtr.GetRefPtr() < secondPtr.GetRefPtr();
178 }
179 };
180
181 class SessionCallback {
182 public:
183 SessionCallback() = default;
184 virtual ~SessionCallback() = default;
185 /**
186 * @brief Called when error occured during capture session callback.
187 *
188 * @param errorCode Indicates a {@link ErrorCode} which will give information for capture session callback error.
189 */
190 virtual void OnError(int32_t errorCode) = 0;
191 };
192
193 class ExposureCallback {
194 public:
195 enum ExposureState {
196 SCAN = 0,
197 CONVERGED,
198 };
199 ExposureCallback() = default;
200 virtual ~ExposureCallback() = default;
201 virtual void OnExposureState(ExposureState state) = 0;
202 };
203
204 class FocusCallback {
205 public:
206 enum FocusState {
207 SCAN = 0,
208 FOCUSED,
209 UNFOCUSED
210 };
211 FocusCallback() = default;
212 virtual ~FocusCallback() = default;
213 virtual void OnFocusState(FocusState state) = 0;
214 FocusState currentState;
215 };
216
217 class MacroStatusCallback {
218 public:
219 enum MacroStatus { IDLE = 0, ACTIVE, UNKNOWN };
220 MacroStatusCallback() = default;
221 virtual ~MacroStatusCallback() = default;
222 virtual void OnMacroStatusChanged(MacroStatus status) = 0;
223 MacroStatus currentStatus = UNKNOWN;
224 };
225
226 class MoonCaptureBoostStatusCallback {
227 public:
228 enum MoonCaptureBoostStatus { IDLE = 0, ACTIVE, UNKNOWN };
229 MoonCaptureBoostStatusCallback() = default;
230 virtual ~MoonCaptureBoostStatusCallback() = default;
231 virtual void OnMoonCaptureBoostStatusChanged(MoonCaptureBoostStatus status) = 0;
232 MoonCaptureBoostStatus currentStatus = UNKNOWN;
233 };
234
235 class FeatureDetectionStatusCallback {
236 public:
237 enum FeatureDetectionStatus { IDLE = 0, ACTIVE, UNKNOWN };
238
239 FeatureDetectionStatusCallback() = default;
240 virtual ~FeatureDetectionStatusCallback() = default;
241 virtual void OnFeatureDetectionStatusChanged(SceneFeature feature, FeatureDetectionStatus status) = 0;
242 virtual bool IsFeatureSubscribed(SceneFeature feature) = 0;
243
UpdateStatus(SceneFeature feature,FeatureDetectionStatus status)244 inline bool UpdateStatus(SceneFeature feature, FeatureDetectionStatus status)
245 {
246 std::lock_guard<std::mutex> lock(featureStatusMapMutex_);
247 auto it = featureStatusMap_.find(feature);
248 if (it == featureStatusMap_.end()) {
249 featureStatusMap_[feature] = status;
250 return true;
251 } else if (it->second != status) {
252 it->second = status;
253 return true;
254 }
255 return false;
256 }
257
SetFeatureStatus(int8_t featureStatus)258 inline void SetFeatureStatus(int8_t featureStatus)
259 {
260 featureStatus_ = featureStatus;
261 }
262
GetFeatureStatus()263 inline int8_t GetFeatureStatus() const
264 {
265 return featureStatus_;
266 }
267 private:
268 std::atomic<int8_t> featureStatus_ = -1;
269 std::mutex featureStatusMapMutex_;
270 std::unordered_map<SceneFeature, FeatureDetectionStatus> featureStatusMap_;
271 };
272
273 class CaptureSessionCallback : public HCaptureSessionCallbackStub {
274 public:
275 CaptureSession* captureSession_ = nullptr;
CaptureSessionCallback()276 CaptureSessionCallback() : captureSession_(nullptr) {}
277
CaptureSessionCallback(CaptureSession * captureSession)278 explicit CaptureSessionCallback(CaptureSession* captureSession) : captureSession_(captureSession) {}
279
~CaptureSessionCallback()280 ~CaptureSessionCallback()
281 {
282 captureSession_ = nullptr;
283 }
284
285 int32_t OnError(int32_t errorCode) override;
286 };
287
288 class SmoothZoomCallback {
289 public:
290 SmoothZoomCallback() = default;
291 virtual ~SmoothZoomCallback() = default;
292 virtual void OnSmoothZoom(int32_t duration) = 0;
293 };
294
295 class AbilityCallback {
296 public:
297 AbilityCallback() = default;
298 virtual ~AbilityCallback() = default;
299 virtual void OnAbilityChange() = 0;
300 };
301
302 struct ARStatusInfo {
303 std::vector<int32_t> laserData;
304 float lensFocusDistance;
305 int32_t sensorSensitivity;
306 uint32_t exposureDurationValue;
307 int64_t timestamp;
308 };
309
310 class ARCallback {
311 public:
312 ARCallback() = default;
313 virtual ~ARCallback() = default;
314 virtual void OnResult(const ARStatusInfo &arStatusInfo) const = 0;
315 };
316
317 class EffectSuggestionCallback {
318 public:
319 EffectSuggestionCallback() = default;
320 virtual ~EffectSuggestionCallback() = default;
321 virtual void OnEffectSuggestionChange(EffectSuggestionType effectSuggestionType) = 0;
322 bool isFirstReport = true;
323 EffectSuggestionType currentType = EffectSuggestionType::EFFECT_SUGGESTION_NONE;
324 };
325
326 struct LcdFlashStatusInfo {
327 bool isLcdFlashNeeded;
328 int32_t lcdCompensation;
329 };
330
331 class LcdFlashStatusCallback {
332 public:
333 LcdFlashStatusCallback() = default;
334 virtual ~LcdFlashStatusCallback() = default;
335 virtual void OnLcdFlashStatusChanged(LcdFlashStatusInfo lcdFlashStatusInfo) = 0;
SetLcdFlashStatusInfo(const LcdFlashStatusInfo lcdFlashStatusInfo)336 void SetLcdFlashStatusInfo(const LcdFlashStatusInfo lcdFlashStatusInfo)
337 {
338 std::lock_guard<std::mutex> lock(mutex_);
339 lcdFlashStatusInfo_ = lcdFlashStatusInfo;
340 }
GetLcdFlashStatusInfo()341 LcdFlashStatusInfo GetLcdFlashStatusInfo()
342 {
343 std::lock_guard<std::mutex> lock(mutex_);
344 return lcdFlashStatusInfo_;
345 }
346
347 private:
348 LcdFlashStatusInfo lcdFlashStatusInfo_ = { .isLcdFlashNeeded = true, .lcdCompensation = -1 };
349 std::mutex mutex_;
350 };
351
352 class AutoDeviceSwitchCallback {
353 public:
354 AutoDeviceSwitchCallback() = default;
355 virtual ~AutoDeviceSwitchCallback() = default;
356 virtual void OnAutoDeviceSwitchStatusChange(bool isDeviceSwitched, bool isDeviceCapabilityChanged) const = 0 ;
357 };
358
359 class FoldCallback : public HFoldServiceCallbackStub {
360 public:
FoldCallback(wptr<CaptureSession> captureSession)361 explicit FoldCallback(wptr<CaptureSession> captureSession) : captureSession_(captureSession) {}
362 int32_t OnFoldStatusChanged(const FoldStatus status) override;
363
364 private:
365 wptr<CaptureSession> captureSession_ = nullptr;
366 };
367
368 struct EffectSuggestionStatus {
369 EffectSuggestionType type;
370 bool status;
371 };
372
FloatIsEqual(float x,float y)373 inline bool FloatIsEqual(float x, float y)
374 {
375 const float EPSILON = 0.000001;
376 return std::fabs(x - y) < EPSILON;
377 }
378
ConfusingNumber(float data)379 inline float ConfusingNumber(float data)
380 {
381 const float factor = 20;
382 return data * factor;
383 }
384
385 class CaptureSession : public RefBase {
386 public:
387 class CaptureSessionMetadataResultProcessor : public MetadataResultProcessor {
388 public:
CaptureSessionMetadataResultProcessor(wptr<CaptureSession> session)389 explicit CaptureSessionMetadataResultProcessor(wptr<CaptureSession> session) : session_(session) {}
390 void ProcessCallbacks(
391 const uint64_t timestamp, const std::shared_ptr<OHOS::Camera::CameraMetadata>& result) override;
392
393 private:
394 wptr<CaptureSession> session_;
395 };
396
397 explicit CaptureSession(sptr<ICaptureSession>& captureSession);
398 virtual ~CaptureSession();
399
400 /**
401 * @brief Begin the capture session config.
402 */
403 int32_t BeginConfig();
404
405 /**
406 * @brief Commit the capture session config.
407 */
408 virtual int32_t CommitConfig();
409
410 /**
411 * @brief Determine if the given Input can be added to session.
412 *
413 * @param CaptureInput to be added to session.
414 */
415 virtual bool CanAddInput(sptr<CaptureInput>& input);
416
417 /**
418 * @brief Add CaptureInput for the capture session.
419 *
420 * @param CaptureInput to be added to session.
421 */
422 int32_t AddInput(sptr<CaptureInput>& input);
423
424 /**
425 * @brief Determine if the given Ouput can be added to session.
426 *
427 * @param CaptureOutput to be added to session.
428 */
429 virtual bool CanAddOutput(sptr<CaptureOutput>& output);
430
431 /**
432 * @brief Add CaptureOutput for the capture session.
433 *
434 * @param CaptureOutput to be added to session.
435 */
436 virtual int32_t AddOutput(sptr<CaptureOutput> &output);
437
438 /**
439 * @brief Remove CaptureInput for the capture session.
440 *
441 * @param CaptureInput to be removed from session.
442 */
443 int32_t RemoveInput(sptr<CaptureInput>& input);
444
445 /**
446 * @brief Remove CaptureOutput for the capture session.
447 *
448 * @param CaptureOutput to be removed from session.
449 */
450 int32_t RemoveOutput(sptr<CaptureOutput>& output);
451
452 /**
453 * @brief Starts session and preview.
454 */
455 int32_t Start();
456
457 /**
458 * @brief Stop session and preview..
459 */
460 int32_t Stop();
461
462 /**
463 * @brief Set the session callback for the capture session.
464 *
465 * @param SessionCallback pointer to be triggered.
466 */
467 void SetCallback(std::shared_ptr<SessionCallback> callback);
468
469 /**
470 * @brief Get the application callback information.
471 *
472 * @return Returns the pointer to SessionCallback set by application.
473 */
474 std::shared_ptr<SessionCallback> GetApplicationCallback();
475
476 /**
477 * @brief Get the ExposureCallback.
478 *
479 * @return Returns the pointer to ExposureCallback.
480 */
481 std::shared_ptr<ExposureCallback> GetExposureCallback();
482
483 /**
484 * @brief Get the FocusCallback.
485 *
486 * @return Returns the pointer to FocusCallback.
487 */
488 std::shared_ptr<FocusCallback> GetFocusCallback();
489
490 /**
491 * @brief Get the MacroStatusCallback.
492 *
493 * @return Returns the pointer to MacroStatusCallback.
494 */
495 std::shared_ptr<MacroStatusCallback> GetMacroStatusCallback();
496
497 /**
498 * @brief Get the MoonCaptureBoostStatusCallback.
499 *
500 * @return Returns the pointer to MoonCaptureBoostStatusCallback.
501 */
502 std::shared_ptr<MoonCaptureBoostStatusCallback> GetMoonCaptureBoostStatusCallback();
503
504 /**
505 * @brief Get the FeatureDetectionStatusCallback.
506 *
507 * @return Returns the pointer to FeatureDetectionStatusCallback.
508 */
509 std::shared_ptr<FeatureDetectionStatusCallback> GetFeatureDetectionStatusCallback();
510
511 /**
512 * @brief Get the SmoothZoomCallback.
513 *
514 * @return Returns the pointer to SmoothZoomCallback.
515 */
516 std::shared_ptr<SmoothZoomCallback> GetSmoothZoomCallback();
517
518 /**
519 * @brief Releases CaptureSession instance.
520 * @return Returns errCode.
521 */
522 int32_t Release();
523
524 /**
525 * @brief create new device control setting.
526 */
527 void LockForControl();
528
529 /**
530 * @brief submit device control setting.
531 *
532 * @return Returns CAMERA_OK is success.
533 */
534 int32_t UnlockForControl();
535
536 /**
537 * @brief Get the supported video sabilization modes.
538 *
539 * @return Returns vector of CameraVideoStabilizationMode supported stabilization modes.
540 */
541 std::vector<VideoStabilizationMode> GetSupportedStabilizationMode();
542
543 /**
544 * @brief Get the supported video sabilization modes.
545 * @param vector of CameraVideoStabilizationMode supported stabilization modes.
546 * @return Returns errCode.
547 */
548 int32_t GetSupportedStabilizationMode(std::vector<VideoStabilizationMode>& modes);
549
550 /**
551 * @brief Query whether given stabilization mode supported.
552 *
553 * @param VideoStabilizationMode stabilization mode to query.
554 * @return True is supported false otherwise.
555 */
556 bool IsVideoStabilizationModeSupported(VideoStabilizationMode stabilizationMode);
557
558 /**
559 * @brief Query whether given stabilization mode supported.
560 *
561 * @param VideoStabilizationMode stabilization mode to query.
562 * @param bool True is supported false otherwise.
563 * @return errCode.
564 */
565 int32_t IsVideoStabilizationModeSupported(VideoStabilizationMode stabilizationMode, bool& isSupported);
566
567 /**
568 * @brief Get the current Video Stabilizaion mode.
569 *
570 * @return Returns current Video Stabilizaion mode.
571 */
572 VideoStabilizationMode GetActiveVideoStabilizationMode();
573
574 /**
575 * @brief Get the current Video Stabilizaion mode.
576 * @param current Video Stabilizaion mode.
577 * @return errCode
578 */
579 int32_t GetActiveVideoStabilizationMode(VideoStabilizationMode& mode);
580
581 /**
582 * @brief Set the Video Stabilizaion mode.
583 * @param VideoStabilizationMode stabilization mode to set.
584 * @return errCode
585 */
586 int32_t SetVideoStabilizationMode(VideoStabilizationMode stabilizationMode);
587
588 /**
589 * @brief Get the supported exposure modes.
590 *
591 * @return Returns vector of ExposureMode supported exposure modes.
592 */
593 std::vector<ExposureMode> GetSupportedExposureModes();
594
595 /**
596 * @brief Get the supported exposure modes.
597 * @param vector of ExposureMode supported exposure modes.
598 * @return errCode.
599 */
600 int32_t GetSupportedExposureModes(std::vector<ExposureMode>& exposureModes);
601
602 /**
603 * @brief Query whether given exposure mode supported.
604 *
605 * @param ExposureMode exposure mode to query.
606 * @return True is supported false otherwise.
607 */
608 bool IsExposureModeSupported(ExposureMode exposureMode);
609
610 /**
611 * @brief Query whether given exposure mode supported.
612 *
613 * @param ExposureMode exposure mode to query.
614 * @param bool True is supported false otherwise.
615 * @return errCode.
616 */
617 int32_t IsExposureModeSupported(ExposureMode exposureMode, bool& isSupported);
618
619 /**
620 * @brief Set exposure mode.
621 * @param ExposureMode exposure mode to be set.
622 * @return errCode
623 */
624 int32_t SetExposureMode(ExposureMode exposureMode);
625
626 /**
627 * @brief Get the current exposure mode.
628 *
629 * @return Returns current exposure mode.
630 */
631 ExposureMode GetExposureMode();
632
633 /**
634 * @brief Get the current exposure mode.
635 * @param ExposureMode current exposure mode.
636 * @return errCode.
637 */
638 int32_t GetExposureMode(ExposureMode& exposureMode);
639
640 /**
641 * @brief Set the centre point of exposure area.
642 * @param Point which specifies the area to expose.
643 * @return errCode
644 */
645 int32_t SetMeteringPoint(Point exposurePoint);
646
647 /**
648 * @brief Get centre point of exposure area.
649 *
650 * @return Returns current exposure point.
651 */
652 Point GetMeteringPoint();
653
654 /**
655 * @brief Get centre point of exposure area.
656 * @param Point current exposure point.
657 * @return errCode
658 */
659 int32_t GetMeteringPoint(Point& exposurePoint);
660
661 /**
662 * @brief Get exposure compensation range.
663 *
664 * @return Returns supported exposure compensation range.
665 */
666 std::vector<float> GetExposureBiasRange();
667
668 /**
669 * @brief Get exposure compensation range.
670 * @param vector of exposure bias range.
671 * @return errCode.
672 */
673 int32_t GetExposureBiasRange(std::vector<float>& exposureBiasRange);
674
675 /**
676 * @brief Set exposure compensation value.
677 * @param exposure compensation value to be set.
678 * @return errCode.
679 */
680 int32_t SetExposureBias(float exposureBias);
681
682 /**
683 * @brief Get exposure compensation value.
684 *
685 * @return Returns current exposure compensation value.
686 */
687 float GetExposureValue();
688
689 /**
690 * @brief Get exposure compensation value.
691 * @param exposure current exposure compensation value .
692 * @return Returns errCode.
693 */
694 int32_t GetExposureValue(float& exposure);
695
696 /**
697 * @brief Set the exposure callback.
698 * which will be called when there is exposure state change.
699 *
700 * @param The ExposureCallback pointer.
701 */
702 void SetExposureCallback(std::shared_ptr<ExposureCallback> exposureCallback);
703
704 /**
705 * @brief This function is called when there is exposure state change
706 * and process the exposure state callback.
707 *
708 * @param result metadata got from callback from service layer.
709 */
710 void ProcessAutoExposureUpdates(const std::shared_ptr<OHOS::Camera::CameraMetadata>& result);
711
712 /**
713 * @brief Get the supported Focus modes.
714 *
715 * @return Returns vector of FocusMode supported exposure modes.
716 */
717 std::vector<FocusMode> GetSupportedFocusModes();
718
719 /**
720 * @brief Get the supported Focus modes.
721 * @param vector of FocusMode supported.
722 * @return Returns errCode.
723 */
724 int32_t GetSupportedFocusModes(std::vector<FocusMode>& modes);
725
726 /**
727 * @brief Query whether given focus mode supported.
728 *
729 * @param camera_focus_mode_enum_t focus mode to query.
730 * @return True is supported false otherwise.
731 */
732 bool IsFocusModeSupported(FocusMode focusMode);
733
734 /**
735 * @brief Query whether given focus mode supported.
736 *
737 * @param camera_focus_mode_enum_t focus mode to query.
738 * @param bool True is supported false otherwise.
739 * @return Returns errCode.
740 */
741 int32_t IsFocusModeSupported(FocusMode focusMode, bool& isSupported);
742
743 /**
744 * @brief Set Focus mode.
745 *
746 * @param FocusMode focus mode to be set.
747 * @return Returns errCode.
748 */
749 int32_t SetFocusMode(FocusMode focusMode);
750
751 /**
752 * @brief Get the current focus mode.
753 *
754 * @return Returns current focus mode.
755 */
756 FocusMode GetFocusMode();
757
758 /**
759 * @brief Get the current focus mode.
760 * @param FocusMode current focus mode.
761 * @return Returns errCode.
762 */
763 int32_t GetFocusMode(FocusMode& focusMode);
764
765 /**
766 * @brief Set the focus callback.
767 * which will be called when there is focus state change.
768 *
769 * @param The ExposureCallback pointer.
770 */
771 void SetFocusCallback(std::shared_ptr<FocusCallback> focusCallback);
772
773 /**
774 * @brief This function is called when there is focus state change
775 * and process the focus state callback.
776 *
777 * @param result metadata got from callback from service layer.
778 */
779 void ProcessAutoFocusUpdates(const std::shared_ptr<OHOS::Camera::CameraMetadata>& result);
780
781 /**
782 * @brief Set the Focus area.
783 *
784 * @param Point which specifies the area to focus.
785 * @return Returns errCode.
786 */
787 int32_t SetFocusPoint(Point focusPoint);
788
789 /**
790 * @brief Get centre point of focus area.
791 *
792 * @return Returns current focus point.
793 */
794 Point GetFocusPoint();
795
796 /**
797 * @brief Get centre point of focus area.
798 * @param Point current focus point.
799 * @return Returns errCode.
800 */
801 int32_t GetFocusPoint(Point& focusPoint);
802
803 /**
804 * @brief Get focal length.
805 *
806 * @return Returns focal length value.
807 */
808 float GetFocalLength();
809
810 /**
811 * @brief Get focal length.
812 * @param focalLength current focal length compensation value .
813 * @return Returns errCode.
814 */
815 int32_t GetFocalLength(float& focalLength);
816
817 /**
818 * @brief Get the vector of focus range types.
819 * @param types vector of focus range types.
820 * @return Returns errCode.
821 */
822 int32_t GetSupportedFocusRangeTypes(std::vector<FocusRangeType>& types);
823
824 /**
825 * @brief Query whether given focus range type supported.
826 * @param focusRangeType focus range type to query.
827 * @param isSupported True is supported false otherwise.
828 * @return Returns errCode.
829 */
830 int32_t IsFocusRangeTypeSupported(FocusRangeType focusRangeType, bool& isSupported);
831
832 /**
833 * @brief Get focus range type.
834 * @param focusRangeType focus range type.
835 * @return Returns errCode.
836 */
837 int32_t GetFocusRange(FocusRangeType& focusRangeType);
838
839 /**
840 * @brief Set focus range type.
841 * @param focusRangeType focus range type to be set.
842 * @return Returns errCode.
843 */
844 int32_t SetFocusRange(FocusRangeType focusRangeType);
845
846 /**
847 * @brief Get the vector of focus driven types.
848 * @param types vector of focus driven types.
849 * @return Returns errCode.
850 */
851 int32_t GetSupportedFocusDrivenTypes(std::vector<FocusDrivenType>& types);
852
853 /**
854 * @brief Query whether given focus driven type supported.
855 * @param focusDrivenType focus driven type to query.
856 * @param isSupported True is supported false otherwise.
857 * @return Returns errCode.
858 */
859 int32_t IsFocusDrivenTypeSupported(FocusDrivenType focusDrivenType, bool& isSupported);
860
861 /**
862 * @brief Get focus driven type.
863 * @param focusDrivenType focus driven type.
864 * @return Returns errCode.
865 */
866 int32_t GetFocusDriven(FocusDrivenType& focusDrivenType);
867
868 /**
869 * @brief Set focus driven type.
870 * @param focusDrivenType focus driven type to be set.
871 * @return Returns errCode.
872 */
873 int32_t SetFocusDriven(FocusDrivenType focusDrivenType);
874
875 /**
876 * @brief Get the vector of color reservation types.
877 * @param types vector of color reservation types.
878 * @return Returns errCode.
879 */
880 int32_t GetSupportedColorReservationTypes(std::vector<ColorReservationType>& types);
881
882 /**
883 * @brief Get color reservation type.
884 * @param colorReservationType color reservation type.
885 * @return Returns errCode.
886 */
887 int32_t GetColorReservation(ColorReservationType& colorReservationType);
888
889 /**
890 * @brief Set color reservation type.
891 * @param colorReservationType color reservation type to be set.
892 * @return Returns errCode.
893 */
894 int32_t SetColorReservation(ColorReservationType colorReservationType);
895
896 /**
897 * @brief Set the smooth zoom callback.
898 * which will be called when there is smooth zoom change.
899 *
900 * @param The SmoothZoomCallback pointer.
901 */
902 void SetSmoothZoomCallback(std::shared_ptr<SmoothZoomCallback> smoothZoomCallback);
903
904 /**
905 * @brief Get the supported Focus modes.
906 *
907 * @return Returns vector of camera_focus_mode_enum_t supported exposure modes.
908 */
909 std::vector<FlashMode> GetSupportedFlashModes();
910
911 /**
912 * @brief Get the supported Focus modes.
913 * @param vector of camera_focus_mode_enum_t supported exposure modes.
914 * @return Returns errCode.
915 */
916 virtual int32_t GetSupportedFlashModes(std::vector<FlashMode>& flashModes);
917
918 /**
919 * @brief Check whether camera has flash.
920 */
921 bool HasFlash();
922
923 /**
924 * @brief Check whether camera has flash.
925 * @param bool True is has flash false otherwise.
926 * @return Returns errCode.
927 */
928 int32_t HasFlash(bool& hasFlash);
929
930 /**
931 * @brief Query whether given flash mode supported.
932 *
933 * @param camera_flash_mode_enum_t flash mode to query.
934 * @return True if supported false otherwise.
935 */
936 bool IsFlashModeSupported(FlashMode flashMode);
937
938 /**
939 * @brief Query whether given flash mode supported.
940 *
941 * @param camera_flash_mode_enum_t flash mode to query.
942 * @param bool True if supported false otherwise.
943 * @return errCode.
944 */
945 int32_t IsFlashModeSupported(FlashMode flashMode, bool& isSupported);
946
947 /**
948 * @brief Get the current flash mode.
949 *
950 * @return Returns current flash mode.
951 */
952 FlashMode GetFlashMode();
953
954 /**
955 * @brief Get the current flash mode.
956 * @param current flash mode.
957 * @return Returns errCode.
958 */
959 virtual int32_t GetFlashMode(FlashMode& flashMode);
960
961 /**
962 * @brief Set flash mode.
963 *
964 * @param camera_flash_mode_enum_t flash mode to be set.
965 * @return Returns errCode.
966 */
967 virtual int32_t SetFlashMode(FlashMode flashMode);
968
969 /**
970 * @brief Get the supported Zoom Ratio range.
971 *
972 * @return Returns vector<float> of supported Zoom ratio range.
973 */
974 std::vector<float> GetZoomRatioRange();
975
976 /**
977 * @brief Get the supported Zoom Ratio range.
978 *
979 * @param vector<float> of supported Zoom ratio range.
980 * @return Returns errCode.
981 */
982 int32_t GetZoomRatioRange(std::vector<float>& zoomRatioRange);
983
984 /**
985 * @brief Get the current Zoom Ratio.
986 *
987 * @return Returns current Zoom Ratio.
988 */
989 float GetZoomRatio();
990
991 /**
992 * @brief Get the current Zoom Ratio.
993 * @param zoomRatio current Zoom Ratio.
994 * @return Returns errCode.
995 */
996 int32_t GetZoomRatio(float& zoomRatio);
997
998 /**
999 * @brief Set Zoom ratio.
1000 *
1001 * @param Zoom ratio to be set.
1002 * @return Returns errCode.
1003 */
1004 int32_t SetZoomRatio(float zoomRatio);
1005
1006 /**
1007 * @brief Prepare Zoom change.
1008 *
1009 * @return Returns errCode.
1010 */
1011 int32_t PrepareZoom();
1012
1013 /**
1014 * @brief UnPrepare Zoom hange.
1015 *
1016 * @return Returns errCode.
1017 */
1018 int32_t UnPrepareZoom();
1019
1020 /**
1021 * @brief Set Smooth Zoom.
1022 *
1023 * @param Target smooth zoom ratio.
1024 * @param Smooth zoom type.
1025 * @return Returns errCode.
1026 */
1027 int32_t SetSmoothZoom(float targetZoomRatio, uint32_t smoothZoomType);
1028
1029 /**
1030 * @brief Get the supported Zoom point info.
1031 *
1032 * @param vector<ZoomPointInfo> of supported ZoomPointInfo.
1033 * @return Returns errCode.
1034 */
1035 int32_t GetZoomPointInfos(std::vector<ZoomPointInfo>& zoomPointInfoList);
1036
1037 /**
1038 * @brief Set Metadata Object types.
1039 *
1040 * @param set of camera_face_detect_mode_t types.
1041 */
1042 void SetCaptureMetadataObjectTypes(std::set<camera_face_detect_mode_t> metadataObjectTypes);
1043
1044 /**
1045 * @brief Get the supported filters.
1046 *
1047 * @return Returns the array of filter.
1048 */
1049 std::vector<FilterType> GetSupportedFilters();
1050
1051 /**
1052 * @brief Verify ability for supported meta.
1053 *
1054 * @return Returns errorcode.
1055 */
1056 int32_t VerifyAbility(uint32_t ability);
1057
1058 /**
1059 * @brief Get the current filter.
1060 *
1061 * @return Returns the array of filter.
1062 */
1063 FilterType GetFilter();
1064
1065 /**
1066 * @brief Set the filter.
1067 */
1068 void SetFilter(FilterType filter);
1069
1070 /**
1071 * @brief Get the supported beauty type.
1072 *
1073 * @return Returns the array of beautytype.
1074 */
1075 std::vector<BeautyType> GetSupportedBeautyTypes();
1076
1077 /**
1078 * @brief Get the supported beauty range.
1079 *
1080 * @return Returns the array of beauty range.
1081 */
1082 std::vector<int32_t> GetSupportedBeautyRange(BeautyType type);
1083
1084 /**
1085 * @brief Set the beauty.
1086 */
1087 void SetBeauty(BeautyType type, int value);
1088
1089 /**
1090 * @brief according type to get the strength.
1091 */
1092 int32_t GetBeauty(BeautyType type);
1093
1094 /**
1095 * @brief Gets supported portrait theme type.
1096 * @param vector of PortraitThemeType supported portraitTheme type.
1097 * @return Returns errCode.
1098 */
1099 int32_t GetSupportedPortraitThemeTypes(std::vector<PortraitThemeType>& types);
1100
1101 /**
1102 * @brief Checks whether portrait theme is supported.
1103 * @param isSupported True if supported false otherwise.
1104 * @return Returns errCode.
1105 */
1106 int32_t IsPortraitThemeSupported(bool &isSupported);
1107
1108 /**
1109 * @brief Checks whether portrait theme is supported.
1110 *
1111 * @return True if supported false otherwise.
1112 */
1113 bool IsPortraitThemeSupported();
1114
1115 /**
1116 * @brief Sets a portrait theme type for a camera device.
1117 * @param type PortraitTheme type to be sety.
1118 * @return Returns errCode.
1119 */
1120 int32_t SetPortraitThemeType(PortraitThemeType type);
1121
1122 /**
1123 * @brief Gets supported rotations.
1124 * @param vector of supported rotations.
1125 * @return Returns errCode.
1126 */
1127 int32_t GetSupportedVideoRotations(std::vector<int32_t>& supportedRotation);
1128
1129 /**
1130 * @brief Checks whether rotation is supported.
1131 * @param isSupported True if supported false otherwise.
1132 * @return Returns errCode.
1133 */
1134 int32_t IsVideoRotationSupported(bool &isSupported);
1135
1136 /**
1137 * @brief Checks whether rotation is supported.
1138 *
1139 * @return True if supported false otherwise.
1140 */
1141 bool IsVideoRotationSupported();
1142
1143 /**
1144 * @brief Sets a rotation type for a camera device.
1145 * @param rotation Potation to be sety.
1146 * @return Returns errCode.
1147 */
1148 int32_t SetVideoRotation(int32_t rotation);
1149
1150 /**
1151 * @brief Get the supported color spaces.
1152 *
1153 * @return Returns supported color spaces.
1154 */
1155 std::vector<ColorSpace> GetSupportedColorSpaces();
1156
1157 /**
1158 * @brief Get current color space.
1159 *
1160 * @return Returns current color space.
1161 */
1162 int32_t GetActiveColorSpace(ColorSpace& colorSpace);
1163
1164 /**
1165 * @brief Set the color space.
1166 */
1167 int32_t SetColorSpace(ColorSpace colorSpace);
1168
1169 /**
1170 * @brief Get the supported color effect.
1171 *
1172 * @return Returns supported color effects.
1173 */
1174 std::vector<ColorEffect> GetSupportedColorEffects();
1175
1176 /**
1177 * @brief Get the current color effect.
1178 *
1179 * @return Returns current color effect.
1180 */
1181 ColorEffect GetColorEffect();
1182
1183 /**
1184 * @brief Set the color effect.
1185 */
1186 void SetColorEffect(ColorEffect colorEffect);
1187
1188 // Focus Distance
1189 /**
1190 * @brief Get the current FocusDistance.
1191 * @param distance current Focus Distance.
1192 * @return Returns errCode.
1193 */
1194 int32_t GetFocusDistance(float& distance);
1195
1196 /**
1197 * @brief Set Focus istance.
1198 *
1199 * @param distance to be set.
1200 * @return Returns errCode.
1201 */
1202 int32_t SetFocusDistance(float distance);
1203
1204 /**
1205 * @brief Get the current FocusDistance.
1206 * @param distance current Focus Distance.
1207 * @return Returns errCode.
1208 */
1209 float GetMinimumFocusDistance();
1210
1211 /**
1212 * @brief Check current status is support macro or not.
1213 */
1214 bool IsMacroSupported();
1215
1216 /**
1217 * @brief Enable macro lens.
1218 */
1219 int32_t EnableMacro(bool isEnable);
1220
1221 /**
1222 * @brief Check current status is support depth fusion or not.
1223 */
1224 bool IsDepthFusionSupported();
1225
1226 /**
1227 * @brief Get the depth fusion supported Zoom Ratio range,
1228 *
1229 * @return Returns vector<float> of depth fusion supported Zoom ratio range.
1230 */
1231 std::vector<float> GetDepthFusionThreshold();
1232
1233 /**
1234 * @brief Get the depth fusion supported Zoom ratio range.
1235 *
1236 * @param vector<float> of depth fusion supported Zoom ratio range.
1237 * @return Returns errCode.
1238 */
1239 int32_t GetDepthFusionThreshold(std::vector<float>& depthFusionThreshold);
1240
1241 /**
1242 * @brief Check curernt status is enabled depth fusion.
1243 */
1244 bool IsDepthFusionEnabled();
1245
1246 /**
1247 * @brief Enable depth fusion.
1248 */
1249 int32_t EnableDepthFusion(bool isEnable);
1250
1251 /**
1252 * @brief Check current status is support motion photo.
1253 */
1254 bool IsMovingPhotoSupported();
1255
1256 /**
1257 * @brief Enable motion photo.
1258 */
1259 int32_t EnableMovingPhoto(bool isEnable);
1260
1261 /**
1262 * @brief Enable moving photo mirror.
1263 */
1264 int32_t EnableMovingPhotoMirror(bool isMirror, bool isConfig);
1265
1266 /**
1267 * @brief Check current status is support moon capture boost or not.
1268 */
1269 bool IsMoonCaptureBoostSupported();
1270
1271 /**
1272 * @brief Enable or disable moon capture boost ability.
1273 */
1274 int32_t EnableMoonCaptureBoost(bool isEnable);
1275
1276 /**
1277 * @brief Check current status is support target feature or not.
1278 */
1279 bool IsFeatureSupported(SceneFeature feature);
1280
1281 /**
1282 * @brief Enable or disable target feature ability.
1283 */
1284 int32_t EnableFeature(SceneFeature feature, bool isEnable);
1285
1286 /**
1287 * @brief Set the macro status callback.
1288 * which will be called when there is macro state change.
1289 *
1290 * @param The MacroStatusCallback pointer.
1291 */
1292 void SetMacroStatusCallback(std::shared_ptr<MacroStatusCallback> callback);
1293
1294 /**
1295 * @brief Set the moon detect status callback.
1296 * which will be called when there is moon detect state change.
1297 *
1298 * @param The MoonCaptureBoostStatusCallback pointer.
1299 */
1300 void SetMoonCaptureBoostStatusCallback(std::shared_ptr<MoonCaptureBoostStatusCallback> callback);
1301
1302 /**
1303 * @brief Set the feature detection status callback.
1304 * which will be called when there is feature detection state change.
1305 *
1306 * @param The FeatureDetectionStatusCallback pointer.
1307 */
1308 void SetFeatureDetectionStatusCallback(std::shared_ptr<FeatureDetectionStatusCallback> callback);
1309
1310 void SetEffectSuggestionCallback(std::shared_ptr<EffectSuggestionCallback> effectSuggestionCallback);
1311
1312 /**
1313 * @brief This function is called when there is macro status change
1314 * and process the macro status callback.
1315 *
1316 * @param result Metadata got from callback from service layer.
1317 */
1318 void ProcessMacroStatusChange(const std::shared_ptr<OHOS::Camera::CameraMetadata>& result);
1319
1320 /**
1321 * @brief This function is called when there is moon detect status change
1322 * and process the moon detect status callback.
1323 *
1324 * @param result Metadata got from callback from service layer.
1325 */
1326 void ProcessMoonCaptureBoostStatusChange(const std::shared_ptr<OHOS::Camera::CameraMetadata>& result);
1327
1328 /**
1329 * @brief This function is called when there is low light detect status change
1330 * and process the low light detect status callback.
1331 *
1332 * @param result Metadata got from callback from service layer.
1333 */
1334 void ProcessLowLightBoostStatusChange(const std::shared_ptr<OHOS::Camera::CameraMetadata>& result);
1335
1336 /**
1337 * @brief Check current status is support moon capture boost or not.
1338 */
1339 bool IsLowLightBoostSupported();
1340
1341 /**
1342 * @brief Enable or disable moon capture boost ability.
1343 */
1344 int32_t EnableLowLightBoost(bool isEnable);
1345
1346 /**
1347 * @brief Enable or disable moon capture boost ability.
1348 */
1349 int32_t EnableLowLightDetection(bool isEnable);
1350
1351 /**
1352 * @brief Verify that the output configuration is legitimate.
1353 *
1354 * @param outputProfile The target profile.
1355 * @param outputType The type of output profile.
1356 *
1357 * @return True if the profile is supported, false otherwise.
1358 */
1359 bool ValidateOutputProfile(Profile& outputProfile, CaptureOutputType outputType);
1360
1361 /**
1362 * @brief Check the preconfig type is supported or not.
1363 *
1364 * @param preconfigType The target preconfig type.
1365 * @param preconfigRatio The target ratio enum
1366 *
1367 * @return True if the preconfig type is supported, false otherwise.
1368 */
1369 virtual bool CanPreconfig(PreconfigType preconfigType, ProfileSizeRatio preconfigRatio);
1370
1371 /**
1372 * @brief Set the preconfig type.
1373 *
1374 * @param preconfigType The target preconfig type.
1375 * @param preconfigRatio The target ratio enum
1376 *
1377 * @return Camera error code.
1378 */
1379 virtual int32_t Preconfig(PreconfigType preconfigType, ProfileSizeRatio preconfigRatio);
1380
1381 /**
1382 * @brief Get whether or not commit config.
1383 *
1384 * @return Returns whether or not commit config.
1385 */
1386 bool IsSessionCommited();
1387 bool SetBeautyValue(BeautyType beautyType, int32_t value);
1388 /**
1389 * @brief Get whether or not commit config.
1390 *
1391 * @return Returns whether or not commit config.
1392 */
1393 bool IsSessionConfiged();
1394
1395 /**
1396 * @brief Get whether or not start session.
1397 *
1398 * @return Returns whether or not start session.
1399 */
1400 bool IsSessionStarted();
1401
1402 /**
1403 * @brief Set FrameRate Range.
1404 *
1405 * @return Returns whether or not commit config.
1406 */
1407 int32_t SetFrameRateRange(const std::vector<int32_t>& frameRateRange);
1408
1409 /**
1410 * @brief Set camera sensor sensitivity.
1411 * @param sensitivity sensitivity value to be set.
1412 * @return errCode.
1413 */
1414 int32_t SetSensorSensitivity(uint32_t sensitivity);
1415
1416 /**
1417 * @brief Get camera sensor sensitivity.
1418 * @param sensitivity current sensitivity value.
1419 * @return Returns errCode.
1420 */
1421 int32_t GetSensorSensitivityRange(std::vector<int32_t> &sensitivityRange);
1422
1423 /**
1424 * @brief Get exposure time range.
1425 * @param vector of exposure time range.
1426 * @return errCode.
1427 */
1428 int32_t GetSensorExposureTimeRange(std::vector<uint32_t> &sensorExposureTimeRange);
1429
1430 /**
1431 * @brief Set exposure time value.
1432 * @param exposure compensation value to be set.
1433 * @return errCode.
1434 */
1435 int32_t SetSensorExposureTime(uint32_t sensorExposureTime);
1436
1437 /**
1438 * @brief Get exposure time value.
1439 * @param exposure current exposure time value .
1440 * @return Returns errCode.
1441 */
1442 int32_t GetSensorExposureTime(uint32_t &sensorExposureTime);
1443
1444 /**
1445 * @brief Get sensor module type
1446 * @param moduleType sensor module type.
1447 * @return Returns errCode.
1448 */
1449 int32_t GetModuleType(uint32_t &moduleType);
1450
1451 /**
1452 * @brief Set ar mode.
1453 * @param isEnable switch to control ar mode.
1454 * @return errCode
1455 */
1456 int32_t SetARMode(bool isEnable);
1457
1458 /**
1459 * @brief Set the ar callback.
1460 * which will be called when there is ar info update.
1461 *
1462 * @param arCallback ARCallback pointer.
1463 */
1464 void SetARCallback(std::shared_ptr<ARCallback> arCallback);
1465
1466 /**
1467 * @brief Get the ARCallback.
1468 *
1469 * @return Returns the pointer to ARCallback.
1470 */
1471 std::shared_ptr<ARCallback> GetARCallback();
1472
1473 /**
1474 * @brief Get Session Functions.
1475 *
1476 * @param previewProfiles to be searched.
1477 * @param photoProfiles to be searched.
1478 * @param videoProfiles to be searched.
1479 */
1480 std::vector<sptr<CameraAbility>> GetSessionFunctions(std::vector<Profile>& previewProfiles,
1481 std::vector<Profile>& photoProfiles,
1482 std::vector<VideoProfile>& videoProfiles,
1483 bool isForApp = true);
1484
1485 /**
1486 * @brief Get Session Conflict Functions.
1487 *
1488 */
1489 std::vector<sptr<CameraAbility>> GetSessionConflictFunctions();
1490
1491 /**
1492 * @brief Get CameraOutput Capabilities.
1493 *
1494 */
1495 std::vector<sptr<CameraOutputCapability>> GetCameraOutputCapabilities(sptr<CameraDevice> &camera);
1496
1497 /**
1498 * @brief CreateCameraAbilityContainer.
1499 *
1500 */
1501 void CreateCameraAbilityContainer();
1502
1503 /**
1504 * @brief Get whether effectSuggestion Supported.
1505 *
1506 * @return True if supported false otherwise.
1507 */
1508 bool IsEffectSuggestionSupported();
1509
1510 /**
1511 * @brief Enable EffectSuggestion.
1512 * @param isEnable switch to control Effect Suggestion.
1513 * @return errCode
1514 */
1515 int32_t EnableEffectSuggestion(bool isEnable);
1516
1517 /**
1518 * @brief Get supported EffectSuggestionInfo.
1519 * @return EffectSuggestionInfo parsed from tag
1520 */
1521 EffectSuggestionInfo GetSupportedEffectSuggestionInfo();
1522
1523 /**
1524 * @brief Get supported effectSuggestionType.
1525 * @return EffectSuggestionTypeList which current mode supported.
1526 */
1527 std::vector<EffectSuggestionType> GetSupportedEffectSuggestionType();
1528
1529 /**
1530 * @brief Batch set effect suggestion status.
1531 * @param effectSuggestionStatusList effect suggestion status list to be set.
1532 * @return errCode
1533 */
1534 int32_t SetEffectSuggestionStatus(std::vector<EffectSuggestionStatus> effectSuggestionStatusList);
1535
1536 /**
1537 * @brief Set ar mode.
1538 * @param effectSuggestionType switch to control effect suggestion.
1539 * @param isEnable switch to control effect suggestion status.
1540 * @return errCode
1541 */
1542 int32_t UpdateEffectSuggestion(EffectSuggestionType effectSuggestionType, bool isEnable);
1543
1544 /**
1545 * @brief This function is called when there is effect suggestion type change
1546 * and process the effect suggestion callback.
1547 *
1548 * @param result metadata got from callback from service layer.
1549 */
1550 void ProcessEffectSuggestionTypeUpdates(const std::shared_ptr<OHOS::Camera::CameraMetadata> &result);
1551
1552 /**
1553 * @brief Get the supported portrait effects.
1554 *
1555 * @return Returns the array of portraiteffect.
1556 */
1557 std::vector<PortraitEffect> GetSupportedPortraitEffects();
1558
1559 /**
1560 * @brief Get the supported virtual apertures.
1561 * @param apertures returns the array of virtual aperture.
1562 * @return Error code.
1563 */
1564 int32_t GetSupportedVirtualApertures(std::vector<float>& apertures);
1565
1566 /**
1567 * @brief Get the virtual aperture.
1568 * @param aperture returns the current virtual aperture.
1569 * @return Error code.
1570 */
1571 int32_t GetVirtualAperture(float& aperture);
1572
1573 /**
1574 * @brief Set the virtual aperture.
1575 * @param virtualAperture set virtual aperture value.
1576 * @return Error code.
1577 */
1578 int32_t SetVirtualAperture(const float virtualAperture);
1579
1580 /**
1581 * @brief Get the supported physical apertures.
1582 * @param apertures returns the array of physical aperture.
1583 * @return Error code.
1584 */
1585 int32_t GetSupportedPhysicalApertures(std::vector<std::vector<float>>& apertures);
1586
1587 /**
1588 * @brief Get the physical aperture.
1589 * @param aperture returns current physical aperture.
1590 * @return Error code.
1591 */
1592 int32_t GetPhysicalAperture(float& aperture);
1593
1594 /**
1595 * @brief Set the physical aperture.
1596 * @param physicalAperture set physical aperture value.
1597 * @return Error code.
1598 */
1599 int32_t SetPhysicalAperture(float physicalAperture);
1600
1601 /**
1602 * @brief Set quality prioritization.
1603 *
1604 * @param QualityPrioritization quality prioritization to be set.
1605 * @return Return errCode.
1606 */
1607 int32_t SetQualityPrioritization(QualityPrioritization qualityPrioritization);
1608
1609 void SetMode(SceneMode modeName);
1610 SceneMode GetMode();
1611 SceneFeaturesMode GetFeaturesMode();
1612 std::vector<SceneFeaturesMode> GetSubFeatureMods();
1613 bool IsSetEnableMacro();
1614 sptr<CaptureOutput> GetMetaOutput();
1615 void ProcessSnapshotDurationUpdates(const uint64_t timestamp,
1616 const std::shared_ptr<OHOS::Camera::CameraMetadata> &result);
1617
1618 virtual std::shared_ptr<OHOS::Camera::CameraMetadata> GetMetadata();
1619
1620 void GetMetadataFromService(sptr<CameraDevice> device);
1621
1622 void ExecuteAbilityChangeCallback();
1623 void SetAbilityCallback(std::shared_ptr<AbilityCallback> abilityCallback);
1624 void ProcessAREngineUpdates(const uint64_t timestamp,
1625 const std::shared_ptr<OHOS::Camera::CameraMetadata> &result);
1626
1627 void EnableDeferredType(DeferredDeliveryImageType deferredType, bool isEnableByUser);
1628 void EnableAutoDeferredVideoEnhancement(bool isEnableByUser);
1629 void SetUserId();
1630 bool IsMovingPhotoEnabled();
1631 bool IsImageDeferred();
1632 bool IsVideoDeferred();
1633
1634 int32_t EnableAutoHighQualityPhoto(bool enabled);
1635 int32_t EnableAutoCloudImageEnhancement(bool enabled);
1636
1637 virtual bool CanSetFrameRateRange(int32_t minFps, int32_t maxFps, CaptureOutput* curOutput);
1638 bool CanSetFrameRateRangeForOutput(int32_t minFps, int32_t maxFps, CaptureOutput* curOutput);
1639 int32_t AddSecureOutput(sptr<CaptureOutput> &output);
1640
1641 int32_t EnableAutoAigcPhoto(bool enabled);
1642
1643 void EnableOfflinePhoto();
1644
1645 // White Balance
1646 /**
1647 * @brief Get Metering mode.
1648 * @param vector of Metering Mode.
1649 * @return errCode.
1650 */
1651 int32_t GetSupportedWhiteBalanceModes(std::vector<WhiteBalanceMode>& modes);
1652
1653 /**
1654 * @brief Query whether given white-balance mode supported.
1655 *
1656 * @param camera_focus_mode_enum_t white-balance mode to query.
1657 * @param bool True if supported false otherwise.
1658 * @return errCode.
1659 */
1660 int32_t IsWhiteBalanceModeSupported(WhiteBalanceMode mode, bool &isSupported);
1661
1662 /**
1663 * @brief Set WhiteBalanceMode.
1664 * @param mode WhiteBalanceMode to be set.
1665 * @return errCode.
1666 */
1667 int32_t SetWhiteBalanceMode(WhiteBalanceMode mode);
1668
1669 /**
1670 * @brief Get WhiteBalanceMode.
1671 * @param mode current WhiteBalanceMode .
1672 * @return Returns errCode.
1673 */
1674 int32_t GetWhiteBalanceMode(WhiteBalanceMode& mode);
1675
1676 /**
1677 * @brief Get ManualWhiteBalance Range.
1678 * @param whiteBalanceRange supported Manual WhiteBalance range .
1679 * @return Returns errCode.
1680 */
1681 int32_t GetManualWhiteBalanceRange(std::vector<int32_t> &whiteBalanceRange);
1682
1683 /**
1684 * @brief Is Manual WhiteBalance Supported.
1685 * @param isSupported is Support Manual White Balance .
1686 * @return Returns errCode.
1687 */
1688 int32_t IsManualWhiteBalanceSupported(bool &isSupported);
1689
1690 /**
1691 * @brief Set Manual WhiteBalance.
1692 * @param wbValue WhiteBalance value to be set.
1693 * @return Returns errCode.
1694 */
1695 int32_t SetManualWhiteBalance(int32_t wbValue);
1696
1697 /**
1698 * @brief Get ManualWhiteBalance.
1699 * @param wbValue WhiteBalance value to be get.
1700 * @return Returns errCode.
1701 */
1702 int32_t GetManualWhiteBalance(int32_t &wbValue);
1703
GetMetadataResultProcessor()1704 inline std::shared_ptr<MetadataResultProcessor> GetMetadataResultProcessor()
1705 {
1706 return metadataResultProcessor_;
1707 }
1708
GetInputDevice()1709 inline sptr<CaptureInput> GetInputDevice()
1710 {
1711 std::lock_guard<std::mutex> lock(inputDeviceMutex_);
1712 return innerInputDevice_;
1713 }
1714
GetCaptureSession()1715 inline sptr<ICaptureSession> GetCaptureSession()
1716 {
1717 std::lock_guard<std::mutex> lock(captureSessionMutex_);
1718 return innerCaptureSession_;
1719 }
1720
1721 int32_t SetPreviewRotation(std::string &deviceClass);
1722
1723 /**
1724 * @brief Checks if the LCD flash feature is supported.
1725 *
1726 * This function determines whether the current system or device supports the LCD flash feature.
1727 * It returns `true` if the feature is supported; otherwise, it returns `false`.
1728 *
1729 * @return `true` if the LCD flash feature is supported; `false` otherwise.
1730 */
1731 bool IsLcdFlashSupported();
1732
1733 /**
1734 * @brief Enables or disables the LCD flash feature.
1735 *
1736 * This function enables or disables the LCD flash feature based on the provided `isEnable` flag.
1737 *
1738 * @param isEnable A boolean flag indicating whether to enable (`true`) or disable (`false`) the LCD flash feature.
1739 *
1740 * @return Returns an `int32_t` value indicating the result of the operation.
1741 * Typically, a return value of 0 indicates success, while a non-zero value indicates an error.
1742 */
1743 int32_t EnableLcdFlash(bool isEnable);
1744
1745 /**
1746 * @brief Enables or disables LCD flash detection.
1747 *
1748 * This function enables or disables the detection of the LCD flash feature based on the provided `isEnable` flag.
1749 *
1750 * @param isEnable A boolean flag indicating whether to enable (`true`) or disable (`false`) LCD flash detection.
1751 *
1752 * @return Returns an `int32_t` value indicating the outcome of the operation.
1753 * A return value of 0 typically signifies success, while a non-zero value indicates an error.
1754 */
1755 int32_t EnableLcdFlashDetection(bool isEnable);
1756
1757 void ProcessLcdFlashStatusUpdates(const std::shared_ptr<OHOS::Camera::CameraMetadata> &result);
1758
1759 /**
1760 * @brief Sets the callback for LCD flash status updates.
1761 *
1762 * This function assigns a callback to be invoked whenever there is a change in the LCD flash status.
1763 * The callback is passed as a shared pointer, allowing for shared ownership and automatic memory management.
1764 *
1765 * @param lcdFlashStatusCallback A shared pointer to an LcdFlashStatusCallback object. This callback will
1766 * be called to handle updates related to the LCD flash status. If the callback is already set,
1767 * it will be overwritten with the new one.
1768 */
1769 void SetLcdFlashStatusCallback(std::shared_ptr<LcdFlashStatusCallback> lcdFlashStatusCallback);
1770
1771 /**
1772 * @brief Retrieves the current LCD flash status callback.
1773 *
1774 * This function returns a shared pointer to the `LcdFlashStatusCallback` object that is used for receiving
1775 * notifications or callbacks related to the LCD flash status.
1776 *
1777 * @return A `std::shared_ptr<LcdFlashStatusCallback>` pointing to the current LCD flash status callback.
1778 * If no callback is set, it may return a `nullptr`.
1779 */
1780 std::shared_ptr<LcdFlashStatusCallback> GetLcdFlashStatusCallback();
1781 void EnableFaceDetection(bool enable);
1782 /**
1783 * @brief Checks if tripod detection is supported.
1784 *
1785 * This function determines whether the current system or device supports tripod detection functionality.
1786 * It returns `true` if the feature is supported, otherwise `false`.
1787 *
1788 * @return `true` if tripod detection is supported; `false` otherwise.
1789 */
1790 bool IsTripodDetectionSupported();
1791
1792 /**
1793 * @brief Enables or disables tripod stabilization.
1794 *
1795 * This function enables or disables the tripod stabilization feature based on the provided `enabled` flag.
1796 *
1797 * @param enabled A boolean flag that indicates whether to enable or disable tripod stabilization.
1798 *
1799 * @return Returns an `int32_t` value indicating the success or failure of the operation.
1800 * Typically, a return value of 0 indicates success, while a non-zero value indicates an error.
1801 */
1802 int32_t EnableTripodStabilization(bool enabled);
1803
1804 /**
1805 * @brief Enables or disables tripod detection.
1806 *
1807 * This function enables or disables the tripod detection feature based on the provided `enabled` flag.
1808 *
1809 * @param enabled A boolean flag that specifies whether to enable or disable tripod detection.
1810 *
1811 * @return Returns an `int32_t` value indicating the outcome of the operation.
1812 * A return value of 0 typically indicates success, while a non-zero value indicates an error.
1813 */
1814 int32_t EnableTripodDetection(bool enabled);
1815
1816 void ProcessTripodStatusChange(const std::shared_ptr<OHOS::Camera::CameraMetadata>& result);
1817
1818 int32_t EnableRawDelivery(bool enabled);
1819 /**
1820 * @brief Set usage for the capture session.
1821 * @param usage - The capture session usage.
1822 * @param enabled - Enable usage for session if TRUE.
1823 */
1824 void SetUsage(UsageType usageType, bool enabled);
1825
1826 /**
1827 * @brief Checks if the automatic switchover device is supported.
1828 *
1829 * @return true if supported; false otherwise.
1830 */
1831 bool IsAutoDeviceSwitchSupported();
1832
1833 /**
1834 * @brief Enables or disables the automatic switchover device.
1835 *
1836 * @param isEnable True to enable, false to disable.
1837 * @return 0 on success, or a negative error code on failure.
1838 */
1839 int32_t EnableAutoDeviceSwitch(bool isEnable);
1840
1841 /**
1842 * @brief Switches the current device to a different one.
1843 *
1844 * @return true if the switch was successful; false if it failed or is not supported.
1845 */
1846 bool SwitchDevice();
1847
1848 /**
1849 * @brief Enables or disables the automatic switchover device.
1850 *
1851 * @param isEnable True to enable, false to disable.
1852 */
1853 void SetIsAutoSwitchDeviceStatus(bool isEnable);
1854
1855 /**
1856 * @brief Checks if the automatic switchover device is enabled.
1857 *
1858 * @return True if enabled, false otherwise.
1859 */
1860 bool GetIsAutoSwitchDeviceStatus();
1861
1862 /**
1863 * @brief Sets the callback for automatic device switching.
1864 *
1865 * @param autoDeviceSwitchCallback A shared pointer to the callback.
1866 */
1867 void SetAutoDeviceSwitchCallback(shared_ptr<AutoDeviceSwitchCallback> autoDeviceSwitchCallback);
1868
1869 /**
1870 * @brief Gets the current automatic device switch callback.
1871 *
1872 * @return A shared pointer to the callback, or nullptr if not set.
1873 */
1874 shared_ptr<AutoDeviceSwitchCallback> GetAutoDeviceSwitchCallback();
1875
SetDeviceCapabilityChangeStatus(bool isDeviceCapabilityChanged)1876 inline void SetDeviceCapabilityChangeStatus(bool isDeviceCapabilityChanged)
1877 {
1878 isDeviceCapabilityChanged_ = isDeviceCapabilityChanged;
1879 }
1880
GetDeviceCapabilityChangeStatus()1881 inline bool GetDeviceCapabilityChangeStatus()
1882 {
1883 return isDeviceCapabilityChanged_;
1884 }
1885
1886 /**
1887 * @brief Adds a function to the mapping with the specified control tag.
1888 *
1889 * This function is used to register a callback that will be executed
1890 * when the automatic switchover device is enabled. The control target
1891 * must be set prior to switching the device. After the device is switched,
1892 * the target needs to be reset to HAL.
1893 *
1894 * @note This functionality is applicable only for SceneMode::CAPTURE
1895 * and SceneMode::VIDEO modes.
1896 *
1897 * @param ctrlTag The control tag associated with the function.
1898 * @param func The function to be added to the map, which will be called
1899 * when the corresponding control tag is triggered.
1900 */
1901 void AddFunctionToMap(std::string ctrlTag, std::function<void()> func);
1902 void ExecuteAllFunctionsInMap();
1903 protected:
1904
1905 static const std::unordered_map<camera_awb_mode_t, WhiteBalanceMode> metaWhiteBalanceModeMap_;
1906 static const std::unordered_map<WhiteBalanceMode, camera_awb_mode_t> fwkWhiteBalanceModeMap_;
1907
1908 static const std::unordered_map<LightPaintingType, CameraLightPaintingType> fwkLightPaintingTypeMap_;
1909 static const std::unordered_map<CameraLightPaintingType, LightPaintingType> metaLightPaintingTypeMap_;
1910 static const std::unordered_map<TripodStatus, FwkTripodStatus> metaTripodStatusMap_;
1911
1912 std::shared_ptr<OHOS::Camera::CameraMetadata> changedMetadata_;
1913 Profile photoProfile_;
1914 Profile previewProfile_;
1915 std::map<BeautyType, std::vector<int32_t>> beautyTypeAndRanges_;
1916 std::map<BeautyType, int32_t> beautyTypeAndLevels_;
1917 std::shared_ptr<MetadataResultProcessor> metadataResultProcessor_ = nullptr;
1918 bool isImageDeferred_ = false;
1919 std::atomic<bool> isRawImageDelivery_ { false };
1920 bool isVideoDeferred_ = false;
1921 std::atomic<bool> isMovingPhotoEnabled_ { false };
1922
1923 std::shared_ptr<AbilityCallback> abilityCallback_;
1924 std::atomic<uint32_t> exposureDurationValue_ = 0;
1925
1926 float apertureValue_ = 0.0;
1927
ClearPreconfigProfiles()1928 inline void ClearPreconfigProfiles()
1929 {
1930 std::lock_guard<std::mutex> lock(preconfigProfilesMutex_);
1931 preconfigProfiles_ = nullptr;
1932 }
1933
SetPreconfigProfiles(std::shared_ptr<PreconfigProfiles> preconfigProfiles)1934 inline void SetPreconfigProfiles(std::shared_ptr<PreconfigProfiles> preconfigProfiles)
1935 {
1936 std::lock_guard<std::mutex> lock(preconfigProfilesMutex_);
1937 preconfigProfiles_ = preconfigProfiles;
1938 }
1939
GetPreconfigProfiles()1940 inline std::shared_ptr<PreconfigProfiles> GetPreconfigProfiles()
1941 {
1942 std::lock_guard<std::mutex> lock(preconfigProfilesMutex_);
1943 return preconfigProfiles_;
1944 }
1945
SetInputDevice(sptr<CaptureInput> inputDevice)1946 inline void SetInputDevice(sptr<CaptureInput> inputDevice)
1947 {
1948 std::lock_guard<std::mutex> lock(inputDeviceMutex_);
1949 innerInputDevice_ = inputDevice;
1950 }
1951
GetCameraAbilityContainer()1952 inline sptr<CameraAbilityContainer> GetCameraAbilityContainer()
1953 {
1954 std::lock_guard<std::mutex> lock(abilityContainerMutex_);
1955 return cameraAbilityContainer_;
1956 }
1957
SetCaptureSession(sptr<ICaptureSession> captureSession)1958 inline void SetCaptureSession(sptr<ICaptureSession> captureSession)
1959 {
1960 std::lock_guard<std::mutex> lock(captureSessionMutex_);
1961 innerCaptureSession_ = captureSession;
1962 }
1963
1964 virtual std::shared_ptr<PreconfigProfiles> GeneratePreconfigProfiles(
1965 PreconfigType preconfigType, ProfileSizeRatio preconfigRatio);
1966
1967 private:
1968 std::mutex switchDeviceMutex_;
1969 std::mutex functionMapMutex_;
1970 std::mutex changeMetaMutex_;
1971 std::mutex sessionCallbackMutex_;
1972 std::mutex captureSessionMutex_;
1973 sptr<ICaptureSession> innerCaptureSession_ = nullptr;
1974 std::shared_ptr<SessionCallback> appCallback_;
1975 sptr<ICaptureSessionCallback> captureSessionCallback_;
1976 std::shared_ptr<ExposureCallback> exposureCallback_;
1977 std::shared_ptr<FocusCallback> focusCallback_;
1978 std::shared_ptr<MacroStatusCallback> macroStatusCallback_;
1979 std::shared_ptr<MoonCaptureBoostStatusCallback> moonCaptureBoostStatusCallback_;
1980 std::shared_ptr<FeatureDetectionStatusCallback> featureDetectionStatusCallback_;
1981 std::shared_ptr<SmoothZoomCallback> smoothZoomCallback_;
1982 std::shared_ptr<ARCallback> arCallback_;
1983 std::shared_ptr<EffectSuggestionCallback> effectSuggestionCallback_;
1984 std::shared_ptr<LcdFlashStatusCallback> lcdFlashStatusCallback_;
1985 std::shared_ptr<AutoDeviceSwitchCallback> autoDeviceSwitchCallback_;
1986 sptr<IFoldServiceCallback> foldStatusCallback_ = nullptr;
1987 std::vector<int32_t> skinSmoothBeautyRange_;
1988 std::vector<int32_t> faceSlendorBeautyRange_;
1989 std::vector<int32_t> skinToneBeautyRange_;
1990 std::mutex captureOutputSetsMutex_;
1991 std::set<wptr<CaptureOutput>, RefBaseCompare<CaptureOutput>> captureOutputSets_;
1992
1993 std::mutex inputDeviceMutex_;
1994 std::mutex chooseDeviceMutex_;
1995 sptr<CaptureInput> innerInputDevice_ = nullptr;
1996 volatile bool isSetMacroEnable_ = false;
1997 volatile bool isDepthFusionEnable_ = false;
1998 volatile bool isSetMoonCaptureBoostEnable_ = false;
1999 volatile bool isSetTripodDetectionEnable_ = false;
2000 volatile bool isSetSecureOutput_ = false;
2001 std::atomic<bool> isSetLowLightBoostEnable_ = false;
2002 static const std::unordered_map<camera_focus_state_t, FocusCallback::FocusState> metaFocusStateMap_;
2003 static const std::unordered_map<camera_exposure_state_t, ExposureCallback::ExposureState> metaExposureStateMap_;
2004
2005 static const std::unordered_map<camera_filter_type_t, FilterType> metaFilterTypeMap_;
2006 static const std::unordered_map<FilterType, camera_filter_type_t> fwkFilterTypeMap_;
2007 static const std::unordered_map<BeautyType, camera_device_metadata_tag_t> fwkBeautyControlMap_;
2008 static const std::unordered_map<camera_device_metadata_tag_t, BeautyType> metaBeautyControlMap_;
2009 static const std::unordered_map<CameraEffectSuggestionType, EffectSuggestionType> metaEffectSuggestionTypeMap_;
2010 static const std::unordered_map<EffectSuggestionType, CameraEffectSuggestionType> fwkEffectSuggestionTypeMap_;
2011 sptr<CaptureOutput> metaOutput_ = nullptr;
2012 sptr<CaptureOutput> photoOutput_;
2013 std::atomic<int32_t> prevDuration_ = 0;
2014 sptr<CameraDeathRecipient> deathRecipient_ = nullptr;
2015 bool isColorSpaceSetted_ = false;
2016 atomic<bool> isDeferTypeSetted_ = false;
2017 atomic<bool> isAutoSwitchDevice_ = false;
2018 atomic<bool> isDeviceCapabilityChanged_ = false;
2019 atomic<bool> canAddFuncToMap_ = true;
2020
2021 // Only for the SceneMode::CAPTURE and SceneMode::VIDEO mode
2022 map<std::string, std::function<void()>> functionMap;
2023
2024 std::mutex preconfigProfilesMutex_;
2025 std::shared_ptr<PreconfigProfiles> preconfigProfiles_ = nullptr;
2026
2027 // private tag
2028 uint32_t HAL_CUSTOM_AR_MODE = 0;
2029 uint32_t HAL_CUSTOM_LASER_DATA = 0;
2030 uint32_t HAL_CUSTOM_SENSOR_MODULE_TYPE = 0;
2031 uint32_t HAL_CUSTOM_LENS_FOCUS_DISTANCE = 0;
2032 uint32_t HAL_CUSTOM_SENSOR_SENSITIVITY = 0;
2033
2034 std::mutex abilityContainerMutex_;
2035 sptr<CameraAbilityContainer> cameraAbilityContainer_ = nullptr;
2036 atomic<bool> supportSpecSearch_ = false;
2037 void CheckSpecSearch();
2038 bool CheckLightStatus();
2039 void PopulateProfileLists(std::vector<Profile>& photoProfileList,
2040 std::vector<Profile>& previewProfileList,
2041 std::vector<VideoProfile>& videoProfileList);
2042 void PopulateSpecIdMaps(sptr<CameraDevice> device, int32_t modeName,
2043 std::map<int32_t, std::vector<Profile>>& specIdPreviewMap,
2044 std::map<int32_t, std::vector<Profile>>& specIdPhotoMap,
2045 std::map<int32_t, std::vector<VideoProfile>>& specIdVideoMap);
2046 // Make sure you know what you are doing, you'd better to use {GetMode()} function instead of this variable.
2047 SceneMode currentMode_ = SceneMode::NORMAL;
2048 SceneMode guessMode_ = SceneMode::NORMAL;
2049 std::mutex moonCaptureBoostFeatureMutex_;
2050 std::shared_ptr<MoonCaptureBoostFeature> moonCaptureBoostFeature_ = nullptr;
2051 float focusDistance_ = 0.0;
2052 std::shared_ptr<MoonCaptureBoostFeature> GetMoonCaptureBoostFeature();
2053 void SetGuessMode(SceneMode mode);
2054 int32_t UpdateSetting(std::shared_ptr<OHOS::Camera::CameraMetadata> changedMetadata);
2055 Point CoordinateTransform(Point point);
2056 int32_t CalculateExposureValue(float exposureValue);
2057 Point VerifyFocusCorrectness(Point point);
2058 int32_t ConfigureOutput(sptr<CaptureOutput>& output);
2059 int32_t ConfigurePreviewOutput(sptr<CaptureOutput>& output);
2060 int32_t ConfigurePhotoOutput(sptr<CaptureOutput>& output);
2061 int32_t ConfigureVideoOutput(sptr<CaptureOutput>& output);
2062 std::shared_ptr<Profile> GetMaxSizePhotoProfile(ProfileSizeRatio sizeRatio);
2063 std::shared_ptr<Profile> GetPreconfigPreviewProfile();
2064 std::shared_ptr<Profile> GetPreconfigPhotoProfile();
2065 std::shared_ptr<VideoProfile> GetPreconfigVideoProfile();
2066 void CameraServerDied(pid_t pid);
2067 void InsertOutputIntoSet(sptr<CaptureOutput>& output);
2068 void RemoveOutputFromSet(sptr<CaptureOutput>& output);
2069 void OnSettingUpdated(std::shared_ptr<OHOS::Camera::CameraMetadata> changedMetadata);
2070 void OnResultReceived(std::shared_ptr<OHOS::Camera::CameraMetadata> changedMetadata);
2071 ColorSpaceInfo GetSupportedColorSpaceInfo();
2072 void UpdateDeviceDeferredability();
2073 void ProcessProfilesAbilityId(const SceneMode supportModes);
2074 void ProcessFocusDistanceUpdates(const std::shared_ptr<OHOS::Camera::CameraMetadata>& result);
2075 void FindTagId();
2076 bool CheckFrameRateRangeWithCurrentFps(int32_t curMinFps, int32_t curMaxFps, int32_t minFps, int32_t maxFps);
2077 void SessionRemoveDeathRecipient();
2078 int32_t AdaptOutputVideoHighFrameRate(sptr<CaptureOutput>& output, sptr<ICaptureSession>& captureSession);
2079 CameraPosition GetUsedAsPosition();
2080 sptr<CameraDevice> FindFrontCamera();
2081 void StartVideoOutput();
2082 bool StopVideoOutput();
2083 void CreateAndSetFoldServiceCallback();
2084 int32_t IsColorReservationTypeSupported(ColorReservationType colorReservationType, bool& isSupported);
2085 };
2086 } // namespace CameraStandard
2087 } // namespace OHOS
2088 #endif // OHOS_CAMERA_CAPTURE_SESSION_H
2089