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_SCREEN_CAPTURE_SERVICE_H 17 #define I_SCREEN_CAPTURE_SERVICE_H 18 19 #include <string> 20 #include "avcodec_common.h" 21 #include "avcodec_info.h" 22 #include "buffer/avsharedmemory.h" 23 #include "refbase.h" 24 #include "surface.h" 25 #include "screen_capture.h" 26 27 namespace OHOS { 28 namespace Media { 29 class IScreenCaptureService { 30 public: 31 virtual ~IScreenCaptureService() = default; 32 virtual int32_t SetCaptureMode(CaptureMode captureMode) = 0; 33 virtual int32_t SetDataType(DataType dataType) = 0; 34 virtual int32_t SetRecorderInfo(RecorderInfo recorderInfo) = 0; 35 virtual int32_t SetOutputFile(int32_t fd) = 0; 36 virtual int32_t InitAudioEncInfo(AudioEncInfo audioEncInfo) = 0; 37 virtual int32_t InitAudioCap(AudioCaptureInfo audioInfo) = 0; 38 virtual int32_t InitVideoEncInfo(VideoEncInfo videoEncInfo) = 0; 39 virtual int32_t InitVideoCap(VideoCaptureInfo videoInfo) = 0; 40 virtual int32_t StartScreenCapture(bool isPrivacyAuthorityEnabled = false) = 0; 41 virtual int32_t StartScreenCaptureWithSurface(sptr<Surface> surface, bool isPrivacyAuthorityEnabled = false) = 0; 42 virtual int32_t StopScreenCapture() = 0; 43 virtual int32_t AcquireAudioBuffer(std::shared_ptr<AudioBuffer> &audioBuffer, AudioCaptureSourceType type) = 0; 44 virtual int32_t AcquireVideoBuffer(sptr<OHOS::SurfaceBuffer> &surfacebuffer, int32_t &fence, 45 int64_t ×tamp, OHOS::Rect &damage) = 0; 46 virtual int32_t ReleaseAudioBuffer(AudioCaptureSourceType type) = 0; 47 virtual int32_t ReleaseVideoBuffer() = 0; 48 virtual int32_t SetMicrophoneEnabled(bool isMicrophone) = 0; 49 virtual int32_t SetCanvasRotation(bool canvasRotation) = 0; 50 virtual int32_t ResizeCanvas(int32_t width, int32_t height) = 0; 51 virtual int32_t SkipPrivacyMode(std::vector<uint64_t> &windowIDsVec) = 0; 52 virtual int32_t SetMaxVideoFrameRate(int32_t frameRate) = 0; 53 virtual int32_t SetScreenCaptureCallback(const std::shared_ptr<ScreenCaptureCallBack> &callback) = 0; 54 virtual void Release() = 0; 55 virtual int32_t ExcludeContent(ScreenCaptureContentFilter &contentFilter) = 0; 56 }; 57 } // namespace Media 58 } // namespace OHOS 59 #endif // I_SCREEN_CAPTURE_SERVICE_H