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_MODE_MANAGER_H 17 #define OHOS_CAMERA_MODE_MANAGER_H 18 19 #include <refbase.h> 20 #include <iostream> 21 #include <vector> 22 #include "input/camera_input.h" 23 #include "input/camera_info.h" 24 #include "input/camera_device.h" 25 #include "input/camera_manager.h" 26 #include "hcamera_service_proxy.h" 27 #include "icamera_device_service.h" 28 #include "session/capture_session.h" 29 #include "session/portrait_session.h" 30 #include "output/camera_output_capability.h" 31 #include "output/metadata_output.h" 32 #include "output/photo_output.h" 33 #include "output/video_output.h" 34 #include "output/preview_output.h" 35 #include "hcamera_listener_stub.h" 36 #include "input/camera_death_recipient.h" 37 #include "hcamera_service_callback_stub.h" 38 #include "camera_stream_info_parse.h" 39 40 namespace OHOS { 41 namespace CameraStandard { 42 enum CameraMode { 43 PORTRAIT = 1 44 }; 45 46 class ModeManager : public RefBase { 47 public: 48 ~ModeManager(); 49 /** 50 * @brief Get mode manager instance. 51 * 52 * @return Returns pointer to mode manager instance. 53 */ 54 static sptr<ModeManager> &GetInstance(); 55 56 /** 57 * @brief Get support modes. 58 * 59 * @return Returns array the mode of current CameraDevice. 60 */ 61 std::vector<CameraMode> GetSupportedModes(sptr<CameraDevice>& camera); 62 63 /** 64 * @brief Create capture session. 65 * 66 * @return Returns pointer to capture session. 67 */ 68 sptr<CaptureSession> CreateCaptureSession(CameraMode mode); 69 70 /** 71 * @brief Get extend output capaility of the mode of the given camera. 72 * 73 * @param Camera device for which extend capability need to be fetched. 74 * @return Returns vector the ability of the mode of cameraDevice of available camera. 75 */ 76 sptr<CameraOutputCapability> GetSupportedOutputCapability(sptr<CameraDevice>& camera, CameraMode mode); 77 78 protected: ModeManager(sptr<ICameraService> serviceProxy)79 explicit ModeManager(sptr<ICameraService> serviceProxy) : serviceProxy_(serviceProxy) {} 80 81 private: 82 ModeManager(); 83 void Init(); 84 static sptr<ModeManager> modeManager_; 85 sptr<ICameraService> serviceProxy_; 86 }; 87 } // namespace CameraStandard 88 } // namespace OHOS 89 #endif // OHOS_CAMERA_MODE_MANAGER_H 90