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 #include "dcamera_video_callback.h"
17 
18 #include "distributed_camera_constants.h"
19 #include "distributed_hardware_log.h"
20 
21 namespace OHOS {
22 namespace DistributedHardware {
DCameraVideoCallback(const std::shared_ptr<StateCallback> & callback)23 DCameraVideoCallback::DCameraVideoCallback(const std::shared_ptr<StateCallback>& callback) : callback_(callback)
24 {
25 }
26 
OnFrameStarted() const27 void DCameraVideoCallback::OnFrameStarted() const
28 {
29     DHLOGI("enter");
30 }
31 
OnFrameEnded(const int32_t frameCount) const32 void DCameraVideoCallback::OnFrameEnded(const int32_t frameCount) const
33 {
34     DHLOGI("enter, frameCount: %{public}d", frameCount);
35 }
36 
OnError(const int32_t errorCode) const37 void DCameraVideoCallback::OnError(const int32_t errorCode) const
38 {
39     DHLOGE("enter, errorCode: %{public}d", errorCode);
40     if (callback_ == nullptr) {
41         DHLOGE("DCameraVideoCallback StateCallback is null");
42         return;
43     }
44 
45     std::shared_ptr<DCameraEvent> event = std::make_shared<DCameraEvent>();
46     event->eventType_ = DCAMERA_MESSAGE;
47     event->eventResult_ = DCAMERA_EVENT_DEVICE_ERROR;
48     callback_->OnStateChanged(event);
49 }
50 
OnDeferredVideoEnhancementInfo(const CameraStandard::CaptureEndedInfoExt info) const51 void DCameraVideoCallback::OnDeferredVideoEnhancementInfo(const CameraStandard::CaptureEndedInfoExt info) const
52 {
53     DHLOGI("enter");
54 }
55 } // namespace DistributedHardware
56 } // namespace OHOS