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 STREAM_OPERATOR_SERVICE_H 17 #define STREAM_OPERATOR_SERVICE_H 18 19 #include <set> 20 #include "surface.h" 21 #include "offline_stream_operator_service.h" 22 #include "v1_0/icamera_device.h" 23 #include "v1_0/istream_operator.h" 24 #include "v1_0/ioffline_stream_operator.h" 25 #include "v1_0/types.h" 26 #include "v1_0/istream_operator_vdi.h" 27 28 namespace OHOS::Camera { 29 using namespace OHOS::HDI::Camera::V1_0; 30 using namespace OHOS::VDI::Camera::V1_0; 31 32 class StreamOperatorService : public IStreamOperator { 33 public: 34 int32_t IsStreamsSupported(OperationMode mode, const std::vector<uint8_t> &modeSetting, 35 const std::vector<StreamInfo> &infos, StreamSupportType &type) override; 36 int32_t CreateStreams(const std::vector<StreamInfo> &streamInfos) override; 37 int32_t ReleaseStreams(const std::vector<int32_t> &streamIds) override; 38 int32_t CommitStreams(OperationMode mode, const std::vector<uint8_t> &modeSetting) override; 39 int32_t GetStreamAttributes(std::vector<StreamAttribute> &attributes) override; 40 int32_t AttachBufferQueue(int32_t streamId, const sptr<BufferProducerSequenceable> &bufferProducer) override; 41 int32_t DetachBufferQueue(int32_t streamId) override; 42 int32_t Capture(int32_t captureId, const CaptureInfo &info, bool isStreaming) override; 43 int32_t CancelCapture(int32_t captureId) override; 44 int32_t ChangeToOfflineStream(const std::vector<int32_t> &streamIds, 45 const sptr<IStreamOperatorCallback> &callbackObj, sptr<IOfflineStreamOperator> &offlineOperator) override; 46 47 public: 48 StreamOperatorService() = delete; 49 explicit StreamOperatorService(OHOS::sptr<IStreamOperatorVdi> streamOperatorVdi); 50 virtual ~StreamOperatorService(); 51 StreamOperatorService(const StreamOperatorService &other) = delete; 52 StreamOperatorService(StreamOperatorService &&other) = delete; 53 StreamOperatorService &operator=(const StreamOperatorService &other) = delete; 54 StreamOperatorService &operator=(StreamOperatorService &&other) = delete; 55 56 private: 57 OHOS::sptr<IStreamOperatorVdi> streamOperatorVdi_; 58 }; 59 } // end namespace OHOS::Camera 60 #endif // STREAM_OPERATOR_SERVICE_H 61