1 /*
2  * Copyright (c) 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 #include "dcamera_sink_output_result_callback.h"
17 
18 #include "distributed_hardware_log.h"
19 
20 namespace OHOS {
21 namespace DistributedHardware {
DCameraSinkOutputResultCallback(std::shared_ptr<DCameraSinkOutput> & output)22 DCameraSinkOutputResultCallback::DCameraSinkOutputResultCallback(
23     std::shared_ptr<DCameraSinkOutput>& output) : output_(output)
24 {
25 }
26 
OnPhotoResult(std::shared_ptr<DataBuffer> & buffer)27 void DCameraSinkOutputResultCallback::OnPhotoResult(std::shared_ptr<DataBuffer>& buffer)
28 {
29     std::shared_ptr<DCameraSinkOutput> output = output_.lock();
30     if (output == nullptr) {
31         DHLOGE("DCameraSinkOutputResultCallback::OnPhotoResult output is null");
32         return;
33     }
34     output->OnPhotoResult(buffer);
35 }
36 
OnVideoResult(std::shared_ptr<DataBuffer> & buffer)37 void DCameraSinkOutputResultCallback::OnVideoResult(std::shared_ptr<DataBuffer>& buffer)
38 {
39     std::shared_ptr<DCameraSinkOutput> output = output_.lock();
40     if (output == nullptr) {
41         DHLOGE("DCameraSinkOutputResultCallback::OnVideoResult output is null");
42         return;
43     }
44     output->OnVideoResult(buffer);
45 }
46 } // namespace DistributedHardware
47 } // namespace OHOS