1 /* 2 * Copyright (c) 2020-2021 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 /** 17 * @addtogroup MultiMedia_FrameStateCallback 18 * @{ 19 * 20 * @brief Provides callbacks for frame state changes, in which you can implement operations to response to the changes. 21 * 22 * @since 1.0 23 * @version 1.0 24 */ 25 26 /** 27 * @file camera_kit.h 28 * 29 * @brief Declares functions in the <b>FrameStateCallback</b> class. 30 * 31 * 32 * @since 1.0 33 * @version 1.0 34 */ 35 36 #ifndef OHOS_FRAME_STATE_CALLBACK_H 37 #define OHOS_FRAME_STATE_CALLBACK_H 38 39 namespace OHOS { 40 namespace Media { 41 class Camera; 42 class FrameConfig; 43 class FrameResult {}; 44 /** 45 * @brief Provides functions to listen for frame states and response to the state changes. 46 * 47 * 48 * @since 1.0 49 * @version 1.0 50 */ 51 class FrameStateCallback { 52 public: 53 /** 54 * @brief A constructor used to create a <b>FrameStateCallback</b> instance. 55 * 56 */ 57 FrameStateCallback() = default; 58 59 /** 60 * @brief A destructor used to delete the <b>FrameStateCallback</b> instance. 61 * 62 */ 63 ~FrameStateCallback() = default; 64 65 /** 66 * @brief Called when the frame capture is finished. 67 * 68 * @param camera Indicates the camera. 69 * @param frameConfig Indicates the frame configuration. 70 * @param frameResult Indicates the capture results. 71 */ OnFrameFinished(Camera & camera,FrameConfig & frameConfig,FrameResult & frameResult)72 virtual void OnFrameFinished(Camera &camera, FrameConfig &frameConfig, FrameResult &frameResult) {} 73 74 /** 75 * @brief Called when the frame capture fails. 76 * 77 * @param camera Indicates the camera. 78 * @param frameConfig Indicates the frame configuration. 79 * @param errorCode Indicates the error code. 80 * @param frameResult Indicates the capture results. 81 */ OnFrameError(Camera & camera,FrameConfig & frameConfig,int32_t errorCode,FrameResult & frameResult)82 virtual void OnFrameError(Camera &camera, FrameConfig &frameConfig, int32_t errorCode, FrameResult &frameResult) {} 83 }; 84 } // namespace Media 85 } // namespace OHOS 86 #endif // OHOS_FRAME_STATE_CALLBACK_H 87