1 /* 2 * Copyright (c) 2023-2023 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_PREVIEW_OUTPUT_IMPL_H 17 #define OHOS_PREVIEW_OUTPUT_IMPL_H 18 19 #include <mutex> 20 #include <unordered_map> 21 22 #include "kits/native/include/camera/camera.h" 23 #include "kits/native/include/camera/preview_output.h" 24 #include "ndk_callback_map.h" 25 #include "output/preview_output.h" 26 27 namespace OHOS::CameraStandard { 28 class InnerPreviewOutputCallback; 29 } 30 31 struct Camera_PreviewOutput { 32 public: 33 explicit Camera_PreviewOutput(OHOS::sptr<OHOS::CameraStandard::PreviewOutput>& innerPreviewOutput); 34 ~Camera_PreviewOutput(); 35 36 Camera_ErrorCode RegisterCallback(PreviewOutput_Callbacks* callback); 37 38 Camera_ErrorCode UnregisterCallback(PreviewOutput_Callbacks* callback); 39 40 Camera_ErrorCode Start(); 41 42 Camera_ErrorCode Stop(); 43 44 Camera_ErrorCode Release(); 45 46 OHOS::sptr<OHOS::CameraStandard::PreviewOutput> GetInnerPreviewOutput(); 47 48 Camera_ErrorCode GetActiveProfile(Camera_Profile** profile); 49 50 Camera_ErrorCode GetSupportedFrameRates(Camera_FrameRateRange** frameRateRange, uint32_t* size); 51 52 Camera_ErrorCode DeleteFrameRates(Camera_FrameRateRange* frameRateRange); 53 54 Camera_ErrorCode SetFrameRate(int32_t minFps, int32_t maxFps); 55 56 Camera_ErrorCode GetActiveFrameRate(Camera_FrameRateRange* frameRateRange); 57 58 Camera_ErrorCode GetPreviewRotation(int32_t imageRotation, Camera_ImageRotation* cameraImageRotation); 59 60 Camera_ErrorCode SetPreviewRotation(int32_t imageRotation, bool isDisplayLocked); 61 62 private: 63 OHOS::sptr<OHOS::CameraStandard::PreviewOutput> innerPreviewOutput_; 64 65 NDKCallbackMap<PreviewOutput_Callbacks*, OHOS::CameraStandard::InnerPreviewOutputCallback> callbackMap_; 66 }; 67 #endif // OHOS_PREVIEW_OUTPUT_IMPL_H 68