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 video_output.h
307777dab0Sopenharmony_ci *
317777dab0Sopenharmony_ci * @brief Declare the video 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_VIDEOOUTPUT_H
417777dab0Sopenharmony_ci#define NATIVE_INCLUDE_CAMERA_VIDEOOUTPUT_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 Video output object
537777dab0Sopenharmony_ci *
547777dab0Sopenharmony_ci * A pointer can be created using {@link Camera_VideoOutput} method.
557777dab0Sopenharmony_ci *
567777dab0Sopenharmony_ci * @since 11
577777dab0Sopenharmony_ci * @version 1.0
587777dab0Sopenharmony_ci */
597777dab0Sopenharmony_citypedef struct Camera_VideoOutput Camera_VideoOutput;
607777dab0Sopenharmony_ci
617777dab0Sopenharmony_ci/**
627777dab0Sopenharmony_ci * @brief Video output frame start callback to be called in {@link VideoOutput_Callbacks}.
637777dab0Sopenharmony_ci *
647777dab0Sopenharmony_ci * @param videoOutput the {@link Camera_VideoOutput} which deliver the callback.
657777dab0Sopenharmony_ci * @since 11
667777dab0Sopenharmony_ci */
677777dab0Sopenharmony_citypedef void (*OH_VideoOutput_OnFrameStart)(Camera_VideoOutput* videoOutput);
687777dab0Sopenharmony_ci
697777dab0Sopenharmony_ci/**
707777dab0Sopenharmony_ci * @brief Video output frame end callback to be called in {@link VideoOutput_Callbacks}.
717777dab0Sopenharmony_ci *
727777dab0Sopenharmony_ci * @param videoOutput the {@link Camera_VideoOutput} 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_VideoOutput_OnFrameEnd)(Camera_VideoOutput* videoOutput, int32_t frameCount);
777777dab0Sopenharmony_ci
787777dab0Sopenharmony_ci/**
797777dab0Sopenharmony_ci * @brief Video output error callback to be called in {@link VideoOutput_Callbacks}.
807777dab0Sopenharmony_ci *
817777dab0Sopenharmony_ci * @param videoOutput the {@link Camera_VideoOutput} which deliver the callback.
827777dab0Sopenharmony_ci * @param errorCode the {@link Camera_ErrorCode} of the video output.
837777dab0Sopenharmony_ci *
847777dab0Sopenharmony_ci * @see CAMERA_SERVICE_FATAL_ERROR
857777dab0Sopenharmony_ci * @since 11
867777dab0Sopenharmony_ci */
877777dab0Sopenharmony_citypedef void (*OH_VideoOutput_OnError)(Camera_VideoOutput* videoOutput, Camera_ErrorCode errorCode);
887777dab0Sopenharmony_ci
897777dab0Sopenharmony_ci/**
907777dab0Sopenharmony_ci * @brief A listener for video output.
917777dab0Sopenharmony_ci *
927777dab0Sopenharmony_ci * @see OH_VideoOutput_RegisterCallback
937777dab0Sopenharmony_ci * @since 11
947777dab0Sopenharmony_ci * @version 1.0
957777dab0Sopenharmony_ci */
967777dab0Sopenharmony_citypedef struct VideoOutput_Callbacks {
977777dab0Sopenharmony_ci    /**
987777dab0Sopenharmony_ci     * Video output frame start event.
997777dab0Sopenharmony_ci     */
1007777dab0Sopenharmony_ci    OH_VideoOutput_OnFrameStart onFrameStart;
1017777dab0Sopenharmony_ci
1027777dab0Sopenharmony_ci    /**
1037777dab0Sopenharmony_ci     * Video output frame end event.
1047777dab0Sopenharmony_ci     */
1057777dab0Sopenharmony_ci    OH_VideoOutput_OnFrameEnd onFrameEnd;
1067777dab0Sopenharmony_ci
1077777dab0Sopenharmony_ci    /**
1087777dab0Sopenharmony_ci     * Video output error event.
1097777dab0Sopenharmony_ci     */
1107777dab0Sopenharmony_ci    OH_VideoOutput_OnError onError;
1117777dab0Sopenharmony_ci} VideoOutput_Callbacks;
1127777dab0Sopenharmony_ci
1137777dab0Sopenharmony_ci/**
1147777dab0Sopenharmony_ci * @brief Register video output change event callback.
1157777dab0Sopenharmony_ci *
1167777dab0Sopenharmony_ci * @param videoOutput the {@link Camera_VideoOutput} instance.
1177777dab0Sopenharmony_ci * @param callback the {@link VideoOutput_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_VideoOutput_RegisterCallback(Camera_VideoOutput* videoOutput, VideoOutput_Callbacks* callback);
1237777dab0Sopenharmony_ci
1247777dab0Sopenharmony_ci/**
1257777dab0Sopenharmony_ci * @brief Unregister video output change event callback.
1267777dab0Sopenharmony_ci *
1277777dab0Sopenharmony_ci * @param videoOutput the {@link Camera_VideoOutput} instance.
1287777dab0Sopenharmony_ci * @param callback the {@link VideoOutput_Callbacks} to be unregistered.
1297777dab0Sopenharmony_ci * @return {@link #CAMERA_OK} if the method call succeeds.
1307777dab0Sopenharmony_ci *         {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
1317777dab0Sopenharmony_ci * @since 11
1327777dab0Sopenharmony_ci */
1337777dab0Sopenharmony_ciCamera_ErrorCode OH_VideoOutput_UnregisterCallback(Camera_VideoOutput* videoOutput, VideoOutput_Callbacks* callback);
1347777dab0Sopenharmony_ci
1357777dab0Sopenharmony_ci/**
1367777dab0Sopenharmony_ci * @brief Start video output.
1377777dab0Sopenharmony_ci *
1387777dab0Sopenharmony_ci * @param videoOutput the {@link Camera_VideoOutput} instance to be started.
1397777dab0Sopenharmony_ci * @return {@link #CAMERA_OK} if the method call succeeds.
1407777dab0Sopenharmony_ci *         {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
1417777dab0Sopenharmony_ci *         {@link #CAMERA_SESSION_NOT_CONFIG} if the capture session not config.
1427777dab0Sopenharmony_ci *         {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error.
1437777dab0Sopenharmony_ci * @since 11
1447777dab0Sopenharmony_ci */
1457777dab0Sopenharmony_ciCamera_ErrorCode OH_VideoOutput_Start(Camera_VideoOutput* videoOutput);
1467777dab0Sopenharmony_ci
1477777dab0Sopenharmony_ci/**
1487777dab0Sopenharmony_ci * @brief Stop video output.
1497777dab0Sopenharmony_ci *
1507777dab0Sopenharmony_ci * @param videoOutput the {@link Camera_VideoOutput} instance to be stoped.
1517777dab0Sopenharmony_ci * @return {@link #CAMERA_OK} if the method call succeeds.
1527777dab0Sopenharmony_ci *         {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
1537777dab0Sopenharmony_ci *         {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error.
1547777dab0Sopenharmony_ci * @since 11
1557777dab0Sopenharmony_ci */
1567777dab0Sopenharmony_ciCamera_ErrorCode OH_VideoOutput_Stop(Camera_VideoOutput* videoOutput);
1577777dab0Sopenharmony_ci
1587777dab0Sopenharmony_ci/**
1597777dab0Sopenharmony_ci * @brief Release video output.
1607777dab0Sopenharmony_ci *
1617777dab0Sopenharmony_ci * @param videoOutput the {@link Camera_VideoOutput} instance to be released.
1627777dab0Sopenharmony_ci * @return {@link #CAMERA_OK} if the method call succeeds.
1637777dab0Sopenharmony_ci *         {@link #INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
1647777dab0Sopenharmony_ci *         {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error.
1657777dab0Sopenharmony_ci * @since 11
1667777dab0Sopenharmony_ci */
1677777dab0Sopenharmony_ciCamera_ErrorCode OH_VideoOutput_Release(Camera_VideoOutput* videoOutput);
1687777dab0Sopenharmony_ci
1697777dab0Sopenharmony_ci/**
1707777dab0Sopenharmony_ci * @brief Get active video output profile.
1717777dab0Sopenharmony_ci *
1727777dab0Sopenharmony_ci * @param videoOutput the {@link Camera_VideoOutput} instance to deliver active video profile.
1737777dab0Sopenharmony_ci * @param profile the active {@link Camera_VideoProfile} to be filled if the method call succeeds.
1747777dab0Sopenharmony_ci * @return {@link #CAMERA_OK} if the method call succeeds.
1757777dab0Sopenharmony_ci *         {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
1767777dab0Sopenharmony_ci *         {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error.
1777777dab0Sopenharmony_ci * @since 12
1787777dab0Sopenharmony_ci */
1797777dab0Sopenharmony_ciCamera_ErrorCode OH_VideoOutput_GetActiveProfile(Camera_VideoOutput* videoOutput, Camera_VideoProfile** profile);
1807777dab0Sopenharmony_ci
1817777dab0Sopenharmony_ci/**
1827777dab0Sopenharmony_ci * @brief Delete video profile instance.
1837777dab0Sopenharmony_ci *
1847777dab0Sopenharmony_ci * @param profile the {@link Camera_VideoProfile} instance to deleted.
1857777dab0Sopenharmony_ci * @return {@link #CAMERA_OK} if the method call succeeds.
1867777dab0Sopenharmony_ci *         {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
1877777dab0Sopenharmony_ci * @since 12
1887777dab0Sopenharmony_ci */
1897777dab0Sopenharmony_ciCamera_ErrorCode OH_VideoOutput_DeleteProfile(Camera_VideoProfile* profile);
1907777dab0Sopenharmony_ci
1917777dab0Sopenharmony_ci/**
1927777dab0Sopenharmony_ci * @brief Gets the video rotation angle.
1937777dab0Sopenharmony_ci *
1947777dab0Sopenharmony_ci * @param videoOutput the {@link Camera_VideoOutput} instance which used to get the video rotation angle.
1957777dab0Sopenharmony_ci * @param deviceDegree the current device rotation degree.
1967777dab0Sopenharmony_ci * @param imageRotation the {@link Camera_ImageRotation} result of video rotation angle.
1977777dab0Sopenharmony_ci * @return {@link #CAMERA_OK} if the method call succeeds.
1987777dab0Sopenharmony_ci *         {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
1997777dab0Sopenharmony_ci *         {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error.
2007777dab0Sopenharmony_ci * @since 12
2017777dab0Sopenharmony_ci */
2027777dab0Sopenharmony_ciCamera_ErrorCode  OH_VideoOutput_GetVideoRotation(Camera_VideoOutput* videoOutput, int deviceDegree,
2037777dab0Sopenharmony_ci    Camera_ImageRotation* imageRotation);
2047777dab0Sopenharmony_ci
2057777dab0Sopenharmony_ci/**
2067777dab0Sopenharmony_ci * @brief Get supported video output frame rate list.
2077777dab0Sopenharmony_ci *
2087777dab0Sopenharmony_ci * @param videoOutput the {@link Camera_VideoOutput} instance to deliver supported frame rate list.
2097777dab0Sopenharmony_ci * @param frameRateRange the supported {@link Camera_FrameRateRange} list to be filled if the method call succeeds.
2107777dab0Sopenharmony_ci * @param size the size of supported {@link Camera_FrameRateRange} list will be filled.
2117777dab0Sopenharmony_ci * @return {@link #CAMERA_OK} if the method call succeeds.
2127777dab0Sopenharmony_ci *         {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
2137777dab0Sopenharmony_ci *         {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error.
2147777dab0Sopenharmony_ci * @since 12
2157777dab0Sopenharmony_ci */
2167777dab0Sopenharmony_ciCamera_ErrorCode OH_VideoOutput_GetSupportedFrameRates(Camera_VideoOutput* videoOutput,
2177777dab0Sopenharmony_ci    Camera_FrameRateRange** frameRateRange, uint32_t* size);
2187777dab0Sopenharmony_ci
2197777dab0Sopenharmony_ci/**
2207777dab0Sopenharmony_ci * @brief Delete frame rate list.
2217777dab0Sopenharmony_ci *
2227777dab0Sopenharmony_ci * @param videoOutput the {@link Camera_VideoOutput} instance to deliver supported frame rate list.
2237777dab0Sopenharmony_ci * @param frameRateRange the {@link Camera_FrameRateRange} list to be deleted.
2247777dab0Sopenharmony_ci * @return {@link #CAMERA_OK} if the method call succeeds.
2257777dab0Sopenharmony_ci *         {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
2267777dab0Sopenharmony_ci * @since 12
2277777dab0Sopenharmony_ci */
2287777dab0Sopenharmony_ciCamera_ErrorCode OH_VideoOutput_DeleteFrameRates(Camera_VideoOutput* videoOutput,
2297777dab0Sopenharmony_ci    Camera_FrameRateRange* frameRateRange);
2307777dab0Sopenharmony_ci
2317777dab0Sopenharmony_ci/**
2327777dab0Sopenharmony_ci * @brief Set video output frame rate.
2337777dab0Sopenharmony_ci *
2347777dab0Sopenharmony_ci * @param videoOutput the {@link Camera_VideoOutput} instance to be set frame rate.
2357777dab0Sopenharmony_ci * @param minFps the minimum to be set.
2367777dab0Sopenharmony_ci * @param maxFps the maximum to be set.
2377777dab0Sopenharmony_ci * @return {@link #CAMERA_OK} if the method call succeeds.
2387777dab0Sopenharmony_ci *         {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
2397777dab0Sopenharmony_ci * @since 12
2407777dab0Sopenharmony_ci */
2417777dab0Sopenharmony_ciCamera_ErrorCode OH_VideoOutput_SetFrameRate(Camera_VideoOutput* videoOutput,
2427777dab0Sopenharmony_ci    int32_t minFps, int32_t maxFps);
2437777dab0Sopenharmony_ci
2447777dab0Sopenharmony_ci/**
2457777dab0Sopenharmony_ci * @brief Get active video output frame rate.
2467777dab0Sopenharmony_ci *
2477777dab0Sopenharmony_ci * @param videoOutput the {@link Camera_VideoOutput} instance to deliver the active frame rate.
2487777dab0Sopenharmony_ci * @param frameRateRange the active {@link Camera_FrameRateRange} to be filled if the method call succeeds.
2497777dab0Sopenharmony_ci * @return {@link #CAMERA_OK} if the method call succeeds.
2507777dab0Sopenharmony_ci *         {@link #CAMERA_INVALID_ARGUMENT} if parameter missing or parameter type incorrect.
2517777dab0Sopenharmony_ci *         {@link #CAMERA_SERVICE_FATAL_ERROR} if camera service fatal error.
2527777dab0Sopenharmony_ci * @since 12
2537777dab0Sopenharmony_ci */
2547777dab0Sopenharmony_ciCamera_ErrorCode OH_VideoOutput_GetActiveFrameRate(Camera_VideoOutput* videoOutput,
2557777dab0Sopenharmony_ci    Camera_FrameRateRange* frameRateRange);
2567777dab0Sopenharmony_ci
2577777dab0Sopenharmony_ci#ifdef __cplusplus
2587777dab0Sopenharmony_ci}
2597777dab0Sopenharmony_ci#endif
2607777dab0Sopenharmony_ci
2617777dab0Sopenharmony_ci#endif // NATIVE_INCLUDE_CAMERA_VIDEOOUTPUT_H
2627777dab0Sopenharmony_ci/** @} */