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 DestroyStub() override; 33 int OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; 34 35 private: 36 ScreenCaptureControllerStub(); 37 int32_t Init(); 38 int32_t ReportAVScreenCaptureUserChoice(MessageParcel &data, MessageParcel &reply); 39 int32_t DestroyStub(MessageParcel &data, MessageParcel &reply); 40 41 std::mutex mutex_; 42 std::shared_ptr<IScreenCaptureController> screenCaptureControllerServer_ = nullptr; 43 using screenCaptureControllerStubFuncs = 44 int32_t(ScreenCaptureControllerStub::*)(MessageParcel &data, MessageParcel &reply); 45 std::map<uint32_t, screenCaptureControllerStubFuncs> screenCaptureControllerStubFuncs_; 46 }; 47 } // namespace Media 48 } // namespace OHOS 49 #endif // SCREEN_CAPTURE_CONTROLLER_STUB_H