• 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 #ifndef SCREEN_CAPTURE_CONTROLLER_STUB_H
17 #define SCREEN_CAPTURE_CONTROLLER_STUB_H
18 
19 #include <map>
20 #include "i_standard_screen_capture_controller.h"
21 #include "screen_capture_controller_server.h"
22 #include "media_death_recipient.h"
23 
24 namespace OHOS {
25 namespace Media {
26 class ScreenCaptureControllerStub : public IRemoteStub<IStandardScreenCaptureController>, public NoCopyable {
27 public:
28     static sptr<ScreenCaptureControllerStub> Create();
29     virtual ~ScreenCaptureControllerStub();
30 
31     int32_t ReportAVScreenCaptureUserChoice(int32_t sessionId, std::string choice) override;
32     int32_t GetAVScreenCaptureConfigurableParameters(int32_t sessionId, std::string &resultStr) override;
33     int32_t DestroyStub() override;
34     int OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override;
35 
36 private:
37     ScreenCaptureControllerStub();
38     int32_t Init();
39     int32_t ReportAVScreenCaptureUserChoice(MessageParcel &data, MessageParcel &reply);
40     int32_t GetAVScreenCaptureConfigurableParameters(MessageParcel &data, MessageParcel &reply);
41     int32_t DestroyStub(MessageParcel &data, MessageParcel &reply);
42 
43     std::mutex mutex_;
44     std::shared_ptr<IScreenCaptureController> screenCaptureControllerServer_ = nullptr;
45     using screenCaptureControllerStubFuncs =
46         int32_t(ScreenCaptureControllerStub::*)(MessageParcel &data, MessageParcel &reply);
47     std::map<uint32_t, screenCaptureControllerStubFuncs> screenCaptureControllerStubFuncs_;
48 };
49 } // namespace Media
50 } // namespace OHOS
51 #endif // SCREEN_CAPTURE_CONTROLLER_STUB_H