• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 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  * Description: rtsp controller
15  * Author: zhangge
16  * Create: 2022-07-13
17  */
18 #ifndef LIBCASTENGINE_I_RTSP_CONTROLLER_H
19 #define LIBCASTENGINE_I_RTSP_CONTROLLER_H
20 
21 #include <memory>
22 #include <string>
23 #include <set>
24 
25 #include "cast_service_common.h"
26 #include "channel.h"
27 #include "channel_listener.h"
28 #include "rtsp_param_info.h"
29 #include "rtsp_basetype.h"
30 #include "rtsp_listener.h"
31 
32 namespace OHOS {
33 namespace CastEngine {
34 namespace CastEngineService {
35 namespace CastSessionRtsp {
36 class IRtspController {
37 public:
38     IRtspController() = default;
39     virtual ~IRtspController() = default;
40 
41     static std::shared_ptr<IRtspController> GetInstance(std::shared_ptr<IRtspListener> listener,
42         ProtocolType protocolType, EndType endType);
43 
44     virtual void AddChannel(std::shared_ptr<Channel> channel, const CastInnerRemoteDevice &device) = 0;
45     virtual void RemoveChannel(std::shared_ptr<Channel> channel) = 0;
46     virtual std::shared_ptr<IChannelListener> GetChannelListener() = 0;
47 
48     virtual bool Start(const ParamInfo &sourceParam, const uint8_t *sessionKey, uint32_t sessionKeyLength) = 0;
49     virtual bool Action(ActionType actionType) = 0;
50 
51     virtual bool SendEventChange(int moduleId, int event, const std::string &param) = 0;
52     virtual void SetupPort(int serverPort, int remotectlPort, int cpPort) = 0;
53     virtual void SendCastRenderReadyOption(int isReady) = 0;
54     virtual void DetectKeepAliveFeature() const = 0;
55     virtual void ModuleCustomParamsNegotiationDone() = 0;
56 
57     virtual void SetNegotiatedMediaCapability(const std::string &negotiationMediaParams) = 0;
58     virtual void SetNegotiatedPlayerControllerCapability(const std::string &negotiationParams) = 0;
59     virtual const std::set<int> &GetNegotiatedFeatureSet() = 0;
60 };
61 } // namespace CastSessionRtsp
62 } // namespace CastEngineService
63 } // namespace CastEngine
64 } // namespace OHOS
65 
66 #endif // LIBCASTENGINE_I_RTSP_CONTROLLER_H
67