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() = 0; 41 virtual int32_t StopScreenCapture() = 0; 42 virtual int32_t AcquireAudioBuffer(std::shared_ptr<AudioBuffer> &audioBuffer, AudioCaptureSourceType type) = 0; 43 virtual int32_t AcquireVideoBuffer(sptr<OHOS::SurfaceBuffer> &surfacebuffer, int32_t &fence, 44 int64_t ×tamp, OHOS::Rect &damage) = 0; 45 virtual int32_t ReleaseAudioBuffer(AudioCaptureSourceType type) = 0; 46 virtual int32_t ReleaseVideoBuffer() = 0; 47 virtual int32_t SetMicrophoneEnabled(bool isMicrophone) = 0; 48 virtual int32_t SetScreenCaptureCallback(const std::shared_ptr<ScreenCaptureCallBack> &callback) = 0; 49 virtual void Release() = 0; 50 }; 51 } // namespace Media 52 } // namespace OHOS 53 #endif // I_SCREEN_CAPTURE_SERVICE_H