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 OHOS_I_AV_RECEIVER_ENGINE_H 17 #define OHOS_I_AV_RECEIVER_ENGINE_H 18 19 #include <memory> 20 #include <string> 21 22 #include "av_trans_errno.h" 23 #include "av_trans_message.h" 24 #include "av_trans_types.h" 25 #include "i_av_receiver_engine_callback.h" 26 27 namespace OHOS { 28 namespace DistributedHardware { 29 /** 30 * @brief AV receiver engine interface. 31 * 32 * AV receiver engine is loaded and running on the sink device. 33 * It supports the management and control the histreamer pipeline, as well as processing of video and audio data. 34 * 35 * @since 1.0 36 * @version 1.0 37 */ 38 class IAVReceiverEngine { 39 public: 40 /** 41 * @brief Destructor. 42 * @return No return value. 43 */ 44 virtual ~IAVReceiverEngine() = default; 45 46 /** 47 * @brief Initialize the av receiver engine. 48 * @return Returns DH_AVT_SUCCESS(0) if successful, otherwise returns other error code. 49 */ 50 virtual int32_t Initialize() = 0; 51 52 /** 53 * @brief Release the av receiver engine. 54 * @return Returns DH_AVT_SUCCESS(0) if successful, otherwise returns other error code. 55 */ 56 virtual int32_t Release() = 0; 57 58 /** 59 * @brief Start the pipeline and plugins in the receiver engine. 60 * @return Returns DH_AVT_SUCCESS(0) if successful, otherwise returns other error code. 61 */ 62 virtual int32_t Start() = 0; 63 64 /** 65 * @brief Stop the pipeline and plugins in the receiver engine. 66 * @return Returns DH_AVT_SUCCESS(0) if successful, otherwise returns other error code. 67 */ 68 virtual int32_t Stop() = 0; 69 70 /** 71 * @brief Set parameter to the receiver engine. 72 * @param tag parameter key. 73 * @param value parameter value. 74 * @return Returns DH_AVT_SUCCESS(0) if successful, otherwise returns other error code. 75 */ 76 virtual int32_t SetParameter(AVTransTag tag, const std::string &value) = 0; 77 78 /** 79 * @brief Send message to the receiver engine or the source device. 80 * @param message message content. 81 * @return Returns DH_AVT_SUCCESS(0) if successful, otherwise returns other error code. 82 */ 83 virtual int32_t SendMessage(const std::shared_ptr<AVTransMessage> &message) = 0; 84 85 /** 86 * @brief Create control channel for the receiver engine. 87 * @param dstDevIds ids of the target devices. 88 * @param attribution channel attributes. 89 * @return Returns DH_AVT_SUCCESS(0) if successful, otherwise returns other error code. 90 */ 91 virtual int32_t CreateControlChannel(const std::vector<std::string> &dstDevIds, 92 const ChannelAttribute &attribution) = 0; 93 94 /** 95 * @brief Register interface callback to the receiver engine. 96 * @param callback interface callback. 97 * @return Returns DH_AVT_SUCCESS(0) if successful, otherwise returns other error code. 98 */ 99 virtual int32_t RegisterReceiverCallback(const std::shared_ptr<IAVReceiverEngineCallback> &callback) = 0; 100 /** 101 * @brief Send dump signal to the receiver engine. 102 * @return Returns BOOL(0) 103 */ 104 virtual bool StartDumpMediaData() = 0; 105 /** 106 * @brief Send dump stop signal to the receiver engine. 107 * @return Returns BOOL(0) 108 */ 109 virtual bool StopDumpMediaData() = 0; 110 /** 111 * @brief Send redump signal to the receiver engine. 112 * @return Returns BOOL(0) 113 */ 114 virtual bool ReStartDumpMediaData() = 0; 115 }; 116 } // DistributedHardware 117 } // OHOS 118 #endif // OHOS_I_AV_RECEIVER_ENGINE_H