17777dab0Sopenharmony_ci/* 27777dab0Sopenharmony_ci * Copyright (C) 2023 Huawei Device Co., Ltd. 37777dab0Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 47777dab0Sopenharmony_ci * you may not use this file except in compliance with the License. 57777dab0Sopenharmony_ci * You may obtain a copy of the License at 67777dab0Sopenharmony_ci * 77777dab0Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 87777dab0Sopenharmony_ci * 97777dab0Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 107777dab0Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 117777dab0Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 127777dab0Sopenharmony_ci * See the License for the specific language governing permissions and 137777dab0Sopenharmony_ci * limitations under the License. 147777dab0Sopenharmony_ci */ 157777dab0Sopenharmony_ci 167777dab0Sopenharmony_ci/** 177777dab0Sopenharmony_ci * @addtogroup OH_Camera 187777dab0Sopenharmony_ci * @{ 197777dab0Sopenharmony_ci * 207777dab0Sopenharmony_ci * @brief Provide the definition of the C interface for the camera module. 217777dab0Sopenharmony_ci * 227777dab0Sopenharmony_ci * @syscap SystemCapability.Multimedia.Camera.Core 237777dab0Sopenharmony_ci * 247777dab0Sopenharmony_ci * @since 11 257777dab0Sopenharmony_ci * @version 1.0 267777dab0Sopenharmony_ci */ 277777dab0Sopenharmony_ci 287777dab0Sopenharmony_ci/** 297777dab0Sopenharmony_ci * @file preview_output.h 307777dab0Sopenharmony_ci * 317777dab0Sopenharmony_ci * @brief Declare the preview output concepts. 327777dab0Sopenharmony_ci * 337777dab0Sopenharmony_ci * @library libohcamera.so 347777dab0Sopenharmony_ci * @kit CameraKit 357777dab0Sopenharmony_ci * @syscap SystemCapability.Multimedia.Camera.Core 367777dab0Sopenharmony_ci * @since 11 377777dab0Sopenharmony_ci * @version 1.0 387777dab0Sopenharmony_ci */ 397777dab0Sopenharmony_ci 407777dab0Sopenharmony_ci#ifndef NATIVE_INCLUDE_CAMERA_PREVIEWOUTPUT_H 417777dab0Sopenharmony_ci#define NATIVE_INCLUDE_CAMERA_PREVIEWOUTPUT_H 427777dab0Sopenharmony_ci 437777dab0Sopenharmony_ci#include <stdint.h> 447777dab0Sopenharmony_ci#include <stdio.h> 457777dab0Sopenharmony_ci#include "camera.h" 467777dab0Sopenharmony_ci 477777dab0Sopenharmony_ci#ifdef __cplusplus 487777dab0Sopenharmony_ciextern "C" { 497777dab0Sopenharmony_ci#endif 507777dab0Sopenharmony_ci 517777dab0Sopenharmony_ci/** 527777dab0Sopenharmony_ci * @brief Preview output object 537777dab0Sopenharmony_ci * 547777dab0Sopenharmony_ci * A pointer can be created using {@link Camera_PreviewOutput} method. 557777dab0Sopenharmony_ci * 567777dab0Sopenharmony_ci * @since 11 577777dab0Sopenharmony_ci * @version 1.0 587777dab0Sopenharmony_ci */ 597777dab0Sopenharmony_citypedef struct Camera_PreviewOutput Camera_PreviewOutput; 607777dab0Sopenharmony_ci 617777dab0Sopenharmony_ci/** 627777dab0Sopenharmony_ci * @brief Preview output frame start callback to be called in {@link PreviewOutput_Callbacks}. 637777dab0Sopenharmony_ci * 647777dab0Sopenharmony_ci * @param previewOutput the {@link Camera_PreviewOutput} which deliver the callback. 657777dab0Sopenharmony_ci * @since 11 667777dab0Sopenharmony_ci */ 677777dab0Sopenharmony_citypedef void (*OH_PreviewOutput_OnFrameStart)(Camera_PreviewOutput* previewOutput); 687777dab0Sopenharmony_ci 697777dab0Sopenharmony_ci/** 707777dab0Sopenharmony_ci * @brief Preview output frame end callback to be called in {@link PreviewOutput_Callbacks}. 717777dab0Sopenharmony_ci * 727777dab0Sopenharmony_ci * @param previewOutput the {@link Camera_PreviewOutput} which deliver the callback. 737777dab0Sopenharmony_ci * @param frameCount the frame count which delivered by the callback. 747777dab0Sopenharmony_ci * @since 11 757777dab0Sopenharmony_ci */ 767777dab0Sopenharmony_citypedef void (*OH_PreviewOutput_OnFrameEnd)(Camera_PreviewOutput* previewOutput, int32_t frameCount); 777777dab0Sopenharmony_ci 787777dab0Sopenharmony_ci/** 797777dab0Sopenharmony_ci * @brief Preview output error callback to be called in {@link PreviewOutput_Callbacks}. 807777dab0Sopenharmony_ci * 817777dab0Sopenharmony_ci * @param previewOutput the {@link Camera_PreviewOutput} which deliver the callback. 827777dab0Sopenharmony_ci * @param errorCode the {@link Camera_ErrorCode} of the preview output. 837777dab0Sopenharmony_ci * 847777dab0Sopenharmony_ci * @see CAMERA_SERVICE_FATAL_ERROR 857777dab0Sopenharmony_ci * @since 11 867777dab0Sopenharmony_ci */ 877777dab0Sopenharmony_citypedef void (*OH_PreviewOutput_OnError)(Camera_PreviewOutput* previewOutput, Camera_ErrorCode errorCode); 887777dab0Sopenharmony_ci 897777dab0Sopenharmony_ci/** 907777dab0Sopenharmony_ci * @brief A listener for preview output. 917777dab0Sopenharmony_ci * 927777dab0Sopenharmony_ci * @see OH_PreviewOutput_RegisterCallback 937777dab0Sopenharmony_ci * @since 11 947777dab0Sopenharmony_ci * @version 1.0 957777dab0Sopenharmony_ci */ 967777dab0Sopenharmony_citypedef struct PreviewOutput_Callbacks { 977777dab0Sopenharmony_ci /** 987777dab0Sopenharmony_ci * Preview output frame start event. 997777dab0Sopenharmony_ci */ 1007777dab0Sopenharmony_ci OH_PreviewOutput_OnFrameStart onFrameStart; 1017777dab0Sopenharmony_ci 1027777dab0Sopenharmony_ci /** 1037777dab0Sopenharmony_ci * Preview output frame end event. 1047777dab0Sopenharmony_ci */ 1057777dab0Sopenharmony_ci OH_PreviewOutput_OnFrameEnd onFrameEnd; 1067777dab0Sopenharmony_ci 1077777dab0Sopenharmony_ci /** 1087777dab0Sopenharmony_ci * Preview output error event. 1097777dab0Sopenharmony_ci */ 1107777dab0Sopenharmony_ci OH_PreviewOutput_OnError onError; 1117777dab0Sopenharmony_ci} PreviewOutput_Callbacks; 1127777dab0Sopenharmony_ci 1137777dab0Sopenharmony_ci/** 1147777dab0Sopenharmony_ci * @brief Register preview output change event callback. 1157777dab0Sopenharmony_ci * 1167777dab0Sopenharmony_ci * @param previewOutput the {@link Camera_PreviewOutput} instance. 1177777dab0Sopenharmony_ci * @param callback the {@link PreviewOutput_Callbacks} to be registered. 1187777dab0Sopenharmony_ci * @return {@link #CAMERA_OK} if the method call succeeds. 1197777dab0Sopenharmony_ci * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. 1207777dab0Sopenharmony_ci * @since 11 1217777dab0Sopenharmony_ci */ 1227777dab0Sopenharmony_ciCamera_ErrorCode OH_PreviewOutput_RegisterCallback(Camera_PreviewOutput* previewOutput, 1237777dab0Sopenharmony_ci PreviewOutput_Callbacks* callback); 1247777dab0Sopenharmony_ci 1257777dab0Sopenharmony_ci/** 1267777dab0Sopenharmony_ci * @brief Unregister preview output change event callback. 1277777dab0Sopenharmony_ci * 1287777dab0Sopenharmony_ci * @param previewOutput the {@link Camera_PreviewOutput} instance. 1297777dab0Sopenharmony_ci * @param callback the {@link PreviewOutput_Callbacks} to be unregistered. 1307777dab0Sopenharmony_ci * @return {@link #CAMERA_OK} if the method call succeeds. 1317777dab0Sopenharmony_ci * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. 1327777dab0Sopenharmony_ci * @since 11 1337777dab0Sopenharmony_ci */ 1347777dab0Sopenharmony_ciCamera_ErrorCode OH_PreviewOutput_UnregisterCallback(Camera_PreviewOutput* previewOutput, 1357777dab0Sopenharmony_ci PreviewOutput_Callbacks* callback); 1367777dab0Sopenharmony_ci 1377777dab0Sopenharmony_ci/** 1387777dab0Sopenharmony_ci * @brief Start preview output. 1397777dab0Sopenharmony_ci * 1407777dab0Sopenharmony_ci * @param previewOutput the {@link Camera_PreviewOutput} instance to be started. 1417777dab0Sopenharmony_ci * @return {@link #CAMERA_OK} if the method call succeeds. 1427777dab0Sopenharmony_ci * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. 1437777dab0Sopenharmony_ci * {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config. 1447777dab0Sopenharmony_ci * {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error. 1457777dab0Sopenharmony_ci * @since 11 1467777dab0Sopenharmony_ci */ 1477777dab0Sopenharmony_ciCamera_ErrorCode OH_PreviewOutput_Start(Camera_PreviewOutput* previewOutput); 1487777dab0Sopenharmony_ci 1497777dab0Sopenharmony_ci/** 1507777dab0Sopenharmony_ci * @brief Stop preview output. 1517777dab0Sopenharmony_ci * 1527777dab0Sopenharmony_ci * @param previewOutput the {@link Camera_PreviewOutput} instance to be stoped. 1537777dab0Sopenharmony_ci * @return {@link #CAMERA_OK} if the method call succeeds. 1547777dab0Sopenharmony_ci * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. 1557777dab0Sopenharmony_ci * {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error. 1567777dab0Sopenharmony_ci * @since 11 1577777dab0Sopenharmony_ci */ 1587777dab0Sopenharmony_ciCamera_ErrorCode OH_PreviewOutput_Stop(Camera_PreviewOutput* previewOutput); 1597777dab0Sopenharmony_ci 1607777dab0Sopenharmony_ci/** 1617777dab0Sopenharmony_ci * @brief Release preview output. 1627777dab0Sopenharmony_ci * 1637777dab0Sopenharmony_ci * @param previewOutput the {@link Camera_PreviewOutput} instance to be released. 1647777dab0Sopenharmony_ci * @return {@link #CAMERA_OK} if the method call succeeds. 1657777dab0Sopenharmony_ci * {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect. 1667777dab0Sopenharmony_ci * {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error. 1677777dab0Sopenharmony_ci * @since 11 1687777dab0Sopenharmony_ci */ 1697777dab0Sopenharmony_ciCamera_ErrorCode OH_PreviewOutput_Release(Camera_PreviewOutput* previewOutput); 1707777dab0Sopenharmony_ci 1717777dab0Sopenharmony_ci/** 1727777dab0Sopenharmony_ci * @brief Get active preview output profile. 1737777dab0Sopenharmony_ci * 1747777dab0Sopenharmony_ci * @param previewOutput the {@link Camera_PreviewOutput} instance to deliver active profile. 1757777dab0Sopenharmony_ci * @param profile the active {@link Camera_Profile} to be filled if the method call succeeds. 1767777dab0Sopenharmony_ci * @return {@link #CAMERA_OK} if the method call succeeds. 1777777dab0Sopenharmony_ci * {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect. 1787777dab0Sopenharmony_ci * {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error. 1797777dab0Sopenharmony_ci * @since 12 1807777dab0Sopenharmony_ci */ 1817777dab0Sopenharmony_ciCamera_ErrorCode OH_PreviewOutput_GetActiveProfile(Camera_PreviewOutput* previewOutput, Camera_Profile** profile); 1827777dab0Sopenharmony_ci 1837777dab0Sopenharmony_ci/** 1847777dab0Sopenharmony_ci * @brief Delete preview profile instance. 1857777dab0Sopenharmony_ci * 1867777dab0Sopenharmony_ci * @param profile the {@link Camera_Profile} instance to deleted. 1877777dab0Sopenharmony_ci * @return {@link #CAMERA_OK} if the method call succeeds. 1887777dab0Sopenharmony_ci * {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect. 1897777dab0Sopenharmony_ci * @since 12 1907777dab0Sopenharmony_ci */ 1917777dab0Sopenharmony_ciCamera_ErrorCode OH_PreviewOutput_DeleteProfile(Camera_Profile* profile); 1927777dab0Sopenharmony_ci 1937777dab0Sopenharmony_ci/** 1947777dab0Sopenharmony_ci * @brief Gets the preview rotation angle. 1957777dab0Sopenharmony_ci * 1967777dab0Sopenharmony_ci * @param previewOutput the {@link Camera_PreviewOutput} instance which used to get the preview rotation angle. 1977777dab0Sopenharmony_ci * @param displayRotation the current display rotation angle. 1987777dab0Sopenharmony_ci * @param imageRotation the {@link Camera_ImageRotation} result of preview rotation angle. 1997777dab0Sopenharmony_ci * @return {@link #CAMERA_OK} if the method call succeeds. 2007777dab0Sopenharmony_ci * {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect. 2017777dab0Sopenharmony_ci * {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error. 2027777dab0Sopenharmony_ci * @since 12 2037777dab0Sopenharmony_ci */ 2047777dab0Sopenharmony_ciCamera_ErrorCode OH_PreviewOutput_GetPreviewRotation(Camera_PreviewOutput* previewOutput, int displayRotation, 2057777dab0Sopenharmony_ci Camera_ImageRotation* imageRotation); 2067777dab0Sopenharmony_ci 2077777dab0Sopenharmony_ci/** 2087777dab0Sopenharmony_ci * @brief Sets the preview rotation angle. 2097777dab0Sopenharmony_ci * 2107777dab0Sopenharmony_ci * @param previewOutput the {@link Camera_PreviewOutput} instance which used to set the preview rotation angle. 2117777dab0Sopenharmony_ci * @param previewRotation the {@link Camera_ImageRotation} of preview display rotation angle. 2127777dab0Sopenharmony_ci * @param isDisplayLocked TRUE means the display is locked. 2137777dab0Sopenharmony_ci * @return {@link #CAMERA_OK} if the method call succeeds. 2147777dab0Sopenharmony_ci * {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect. 2157777dab0Sopenharmony_ci * {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error. 2167777dab0Sopenharmony_ci * @since 12 2177777dab0Sopenharmony_ci */ 2187777dab0Sopenharmony_ciCamera_ErrorCode OH_PreviewOutput_SetPreviewRotation(Camera_PreviewOutput* previewOutput, 2197777dab0Sopenharmony_ci Camera_ImageRotation previewRotation, bool isDisplayLocked); 2207777dab0Sopenharmony_ci 2217777dab0Sopenharmony_ci/** 2227777dab0Sopenharmony_ci * @brief Get supported preview output frame rate list. 2237777dab0Sopenharmony_ci * 2247777dab0Sopenharmony_ci * @param previewOutput the {@link Camera_PreviewOutput} instance to deliver supported frame rate list. 2257777dab0Sopenharmony_ci * @param frameRateRange the supported {@link Camera_FrameRateRange} list to be filled if the method call succeeds. 2267777dab0Sopenharmony_ci * @param size the size of supported {@link Camera_FrameRateRange} list will be filled. 2277777dab0Sopenharmony_ci * @return {@link #CAMERA_OK} if the method call succeeds. 2287777dab0Sopenharmony_ci * {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect. 2297777dab0Sopenharmony_ci * {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error. 2307777dab0Sopenharmony_ci * @since 12 2317777dab0Sopenharmony_ci */ 2327777dab0Sopenharmony_ciCamera_ErrorCode OH_PreviewOutput_GetSupportedFrameRates(Camera_PreviewOutput* previewOutput, 2337777dab0Sopenharmony_ci Camera_FrameRateRange** frameRateRange, uint32_t* size); 2347777dab0Sopenharmony_ci 2357777dab0Sopenharmony_ci/** 2367777dab0Sopenharmony_ci * @brief Delete frame rate list. 2377777dab0Sopenharmony_ci * 2387777dab0Sopenharmony_ci * @param previewOutput the {@link Camera_PreviewOutput} instance to deliver supported frame rate list. 2397777dab0Sopenharmony_ci * @param frameRateRange the {@link Camera_FrameRateRange} list to be deleted. 2407777dab0Sopenharmony_ci * @return {@link #CAMERA_OK} if the method call succeeds. 2417777dab0Sopenharmony_ci * {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect. 2427777dab0Sopenharmony_ci * @since 12 2437777dab0Sopenharmony_ci */ 2447777dab0Sopenharmony_ciCamera_ErrorCode OH_PreviewOutput_DeleteFrameRates(Camera_PreviewOutput* previewOutput, 2457777dab0Sopenharmony_ci Camera_FrameRateRange* frameRateRange); 2467777dab0Sopenharmony_ci 2477777dab0Sopenharmony_ci/** 2487777dab0Sopenharmony_ci * @brief Set preview output frame rate. 2497777dab0Sopenharmony_ci * 2507777dab0Sopenharmony_ci * @param previewOutput the {@link Camera_PreviewOutput} instance to be set frame rate. 2517777dab0Sopenharmony_ci * @param minFps the minimum to be set. 2527777dab0Sopenharmony_ci * @param maxFps the maximum to be set. 2537777dab0Sopenharmony_ci * @return {@link #CAMERA_OK} if the method call succeeds. 2547777dab0Sopenharmony_ci * {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect. 2557777dab0Sopenharmony_ci * @since 12 2567777dab0Sopenharmony_ci */ 2577777dab0Sopenharmony_ciCamera_ErrorCode OH_PreviewOutput_SetFrameRate(Camera_PreviewOutput* previewOutput, 2587777dab0Sopenharmony_ci int32_t minFps, int32_t maxFps); 2597777dab0Sopenharmony_ci 2607777dab0Sopenharmony_ci/** 2617777dab0Sopenharmony_ci * @brief Get active preview output frame rate. 2627777dab0Sopenharmony_ci * 2637777dab0Sopenharmony_ci * @param previewOutput the {@link Camera_PreviewOutput} instance to deliver the active frame rate. 2647777dab0Sopenharmony_ci * @param frameRateRange the active {@link Camera_FrameRateRange} to be filled if the method call succeeds. 2657777dab0Sopenharmony_ci * @return {@link #CAMERA_OK} if the method call succeeds. 2667777dab0Sopenharmony_ci * {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect. 2677777dab0Sopenharmony_ci * {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error. 2687777dab0Sopenharmony_ci * @since 12 2697777dab0Sopenharmony_ci */ 2707777dab0Sopenharmony_ciCamera_ErrorCode OH_PreviewOutput_GetActiveFrameRate(Camera_PreviewOutput* previewOutput, 2717777dab0Sopenharmony_ci Camera_FrameRateRange* frameRateRange); 2727777dab0Sopenharmony_ci 2737777dab0Sopenharmony_ci#ifdef __cplusplus 2747777dab0Sopenharmony_ci} 2757777dab0Sopenharmony_ci#endif 2767777dab0Sopenharmony_ci 2777777dab0Sopenharmony_ci#endif // NATIVE_INCLUDE_CAMERA_PREVIEWOUTPUT_H 2787777dab0Sopenharmony_ci/** @} */