1 /* 2 * Copyright (c) 2021 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 HDI_STREAM_OPERATOR_CLIENT_PROXY_H 17 #define HDI_STREAM_OPERATOR_CLIENT_PROXY_H 18 19 #include <iremote_proxy.h> 20 #include "istream_operator.h" 21 22 namespace OHOS::Camera { 23 class StreamOperatorProxy : public IRemoteProxy<IStreamOperator> { 24 public: StreamOperatorProxy(const sptr<IRemoteObject> & impl)25 explicit StreamOperatorProxy(const sptr<IRemoteObject>& impl) : IRemoteProxy<IStreamOperator>(impl) {} 26 virtual ~StreamOperatorProxy() = default; 27 28 virtual CamRetCode IsStreamsSupported( 29 OperationMode mode, 30 const std::shared_ptr<CameraStandard::CameraMetadata> &modeSetting, 31 const std::shared_ptr<StreamInfo> &info, 32 StreamSupportType &type) override; 33 virtual CamRetCode IsStreamsSupported( 34 OperationMode mode, 35 const std::shared_ptr<CameraStandard::CameraMetadata> &modeSetting, 36 const std::vector<std::shared_ptr<StreamInfo>>& pInfo, 37 StreamSupportType &pType) override; 38 virtual CamRetCode CreateStreams( 39 const std::vector<std::shared_ptr<StreamInfo>> &streamInfos) override; 40 virtual CamRetCode ReleaseStreams(const std::vector<int> &streamIds) override; 41 virtual CamRetCode CommitStreams(OperationMode mode, 42 const std::shared_ptr<CameraStandard::CameraMetadata> &modeSetting) override; 43 virtual CamRetCode GetStreamAttributes( 44 std::vector<std::shared_ptr<StreamAttribute>> &attributes) override; 45 virtual CamRetCode AttachBufferQueue(int streamId, 46 const OHOS::sptr<OHOS::IBufferProducer> &producer) override; 47 virtual CamRetCode DetachBufferQueue(int streamId) override; 48 virtual CamRetCode Capture(int captureId, 49 const std::shared_ptr<CaptureInfo> &pInfo, bool isStreaming) override; 50 virtual CamRetCode CancelCapture(int captureId) override; 51 virtual CamRetCode ChangeToOfflineStream(const std::vector<int> &streamIds, 52 OHOS::sptr<IStreamOperatorCallback> &callback, 53 OHOS::sptr<IOfflineStreamOperator> &offlineOperator) override; 54 55 private: 56 static constexpr int CMD_STREAM_OPERATOR_IS_STREAMS_SUPPORTED = 0; 57 static constexpr int CMD_STREAM_OPERATOR_CREATE_STREAMS = 1; 58 static constexpr int CMD_STREAM_OPERATOR_RELEASE_STREAMS = 2; 59 static constexpr int CMD_STREAM_OPERATOR_COMMIT_STREAMS = 3; 60 static constexpr int CMD_STREAM_OPERATOR_GET_STREAM_ATTRIBUTES = 4; 61 static constexpr int CMD_STREAM_OPERATOR_ATTACH_BUFFER_QUEUE = 5; 62 static constexpr int CMD_STREAM_OPERATOR_DETACH_BUFFER_QUEUE = 6; 63 static constexpr int CMD_STREAM_OPERATOR_CAPTURE = 7; 64 static constexpr int CMD_STREAM_OPERATOR_CANCEL_CAPTURE = 8; 65 static constexpr int CMD_STREAM_OPERATOR_CHANGE_TO_OFFLINE_STREAM = 9; 66 67 static inline BrokerDelegator<StreamOperatorProxy> delegator_; 68 }; 69 } 70 #endif // HDI_STREAM_OPERATOR_CLIENT_PROXY_H 71