• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2024 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 "screen_capture_controller_server.h"
17 #include "media_log.h"
18 #include "media_errors.h"
19 #include "uri_helper.h"
20 #include "media_dfx.h"
21 #include "screen_capture_server.h"
22 
23 namespace {
24 constexpr OHOS::HiviewDFX::HiLogLabel LABEL = {LOG_CORE, LOG_DOMAIN_SCREENCAPTURE, "ScreenCaptureControllerServer"};
25 }
26 
27 namespace OHOS {
28 namespace Media {
29 
Create()30 std::shared_ptr<IScreenCaptureController> ScreenCaptureControllerServer::Create()
31 {
32     MEDIA_LOGI("ScreenCaptureControllerServer::Create() start");
33     std::shared_ptr<ScreenCaptureControllerServer> controllerServerTemp =
34         std::make_shared<ScreenCaptureControllerServer>();
35     CHECK_AND_RETURN_RET_LOG(controllerServerTemp != nullptr, nullptr, "Failed to new ScreenCaptureControllerServer");
36 
37     std::shared_ptr<IScreenCaptureController> controllerServer =
38         std::static_pointer_cast<OHOS::Media::IScreenCaptureController>(controllerServerTemp);
39     return controllerServer;
40 }
41 
ScreenCaptureControllerServer()42 ScreenCaptureControllerServer::ScreenCaptureControllerServer()
43 {
44     MEDIA_LOGD("0x%{public}06" PRIXPTR " Instances create", FAKE_POINTER(this));
45 }
46 
~ScreenCaptureControllerServer()47 ScreenCaptureControllerServer::~ScreenCaptureControllerServer()
48 {
49     MEDIA_LOGD("0x%{public}06" PRIXPTR " Instances destroy", FAKE_POINTER(this));
50 }
51 
ReportAVScreenCaptureUserChoice(int32_t sessionId,std::string choice)52 int32_t ScreenCaptureControllerServer::ReportAVScreenCaptureUserChoice(int32_t sessionId, std::string choice)
53 {
54     MEDIA_LOGI("ScreenCaptureControllerServer::ReportAVScreenCaptureUserChoice start");
55     int32_t ret = ScreenCaptureServer::ReportAVScreenCaptureUserChoice(sessionId, choice);
56     return ret;
57 }
58 
GetAVScreenCaptureConfigurableParameters(int32_t sessionId,std::string & resultStr)59 int32_t ScreenCaptureControllerServer::GetAVScreenCaptureConfigurableParameters(int32_t sessionId,
60     std::string &resultStr)
61 {
62     MEDIA_LOGD("ScreenCaptureControllerServer::GetAVScreenCaptureConfigurableParameters start");
63     int32_t ret = ScreenCaptureServer::GetAVScreenCaptureConfigurableParameters(sessionId, resultStr);
64     return ret;
65 }
66 } // namespace Media
67 } // namespace OHOS