• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2023 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 I_STANDARD_SCREEN_CAPTURE_SERVICE_H
17 #define I_STANDARD_SCREEN_CAPTURE_SERVICE_H
18 
19 #include <memory>
20 #include <atomic>
21 #include "securec.h"
22 #include "ipc_types.h"
23 #include "iremote_broker.h"
24 #include "iremote_proxy.h"
25 #include "iremote_stub.h"
26 #include "i_screen_capture_service.h"
27 
28 namespace OHOS {
29 namespace Media {
30 class IStandardScreenCaptureService : public IRemoteBroker {
31 public:
32     virtual ~IStandardScreenCaptureService() = default;
33     virtual void Release() = 0;
34     virtual int32_t DestroyStub() = 0;
35     virtual int32_t SetCaptureMode(CaptureMode captureMode) = 0;
36     virtual int32_t SetDataType(DataType dataType) = 0;
37     virtual int32_t SetRecorderInfo(RecorderInfo recorderInfo) = 0;
38     virtual int32_t SetOutputFile(int32_t fd) = 0;
39     virtual int32_t InitAudioEncInfo(AudioEncInfo audioEncInfo) = 0;
40     virtual int32_t InitAudioCap(AudioCaptureInfo audioInfo) = 0;
41     virtual int32_t InitVideoEncInfo(VideoEncInfo videoEncInfo) = 0;
42     virtual int32_t InitVideoCap(VideoCaptureInfo videoInfo) = 0;
43     virtual int32_t StartScreenCapture(bool isPrivacyAuthorityEnabled = false) = 0;
44     virtual int32_t StartScreenCaptureWithSurface(sptr<Surface> surface, bool isPrivacyAuthorityEnabled = false) = 0;
45     virtual int32_t StopScreenCapture() = 0;
46     virtual int32_t SetMicrophoneEnabled(bool isMicrophone) = 0;
47     virtual int32_t SetCanvasRotation(bool canvasRotation) = 0;
48     virtual int32_t ResizeCanvas(int32_t width, int32_t height) = 0;
49     virtual int32_t SkipPrivacyMode(std::vector<uint64_t> &windowIDsVec) = 0;
50     virtual int32_t SetListenerObject(const sptr<IRemoteObject> &object) = 0;
51     virtual int32_t AcquireAudioBuffer(std::shared_ptr<AudioBuffer> &audioBuffer, AudioCaptureSourceType type) = 0;
52     virtual int32_t AcquireVideoBuffer(sptr<OHOS::SurfaceBuffer> &surfaceBuffer, int32_t &fence,
53                                        int64_t &timestamp, OHOS::Rect &damage) = 0;
54     virtual int32_t ReleaseAudioBuffer(AudioCaptureSourceType type) = 0;
55     virtual int32_t ReleaseVideoBuffer() = 0;
56     virtual int32_t ExcludeContent(ScreenCaptureContentFilter &contentFilter) = 0;
57 
58     /**
59      * IPC code ID
60      */
61     enum ScreenCaptureServiceMsg {
62         SET_LISTENER_OBJ = 0,
63         RELEASE = 1,
64         DESTROY = 2,
65         SET_CAPTURE_MODE = 3,
66         SET_DATA_TYPE = 4,
67         SET_RECORDER_INFO = 5,
68         SET_OUTPUT_FILE = 6,
69         INIT_AUDIO_ENC_INFO = 7,
70         INIT_AUDIO_CAP = 8,
71         INIT_VIDEO_ENC_INFO = 9,
72         INIT_VIDEO_CAP = 10,
73         ACQUIRE_AUDIO_BUF = 11,
74         ACQUIRE_VIDEO_BUF = 12,
75         RELEASE_AUDIO_BUF = 13,
76         RELEASE_VIDEO_BUF = 14,
77         SET_MIC_ENABLE = 15,
78         START_SCREEN_CAPTURE = 16,
79         START_SCREEN_CAPTURE_WITH_SURFACE = 17,
80         STOP_SCREEN_CAPTURE = 18,
81         SET_SCREEN_ROTATION = 19,
82         EXCLUDE_CONTENT = 20,
83         RESIZE_CANVAS = 21,
84         SKIP_PRIVACY = 22,
85     };
86 
87     DECLARE_INTERFACE_DESCRIPTOR(u"IStandardScreenCaptureService");
88 };
89 } // namespace Media
90 } // namespace OHOS
91 #endif // I_STANDARD_SCREEN_CAPTURE_SERVICE_H