• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 Shenzhen Kaihong Digital Industry Development 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_SHARING_WFD_SINK_H
17 #define OHOS_SHARING_WFD_SINK_H
18 
19 #include "impl/scene/wfd/wfd_def.h"
20 #include "wfd.h"
21 
22 namespace OHOS {
23 namespace Sharing {
24 
25 class WfdSink {
26 public:
27     virtual ~WfdSink() = default;
28 
29     virtual int32_t Stop() = 0;
30     virtual int32_t Start() = 0;
31     virtual int32_t Play(std::string deviceId) = 0;
32     virtual int32_t Pause(std::string deviceId) = 0;
33     virtual int32_t Close(std::string deviceId) = 0;
34 
35     virtual int32_t Mute(std::string deviceId) = 0;
36     virtual int32_t UnMute(std::string deviceId) = 0;
37 
38     virtual int32_t GetSinkConfig(SinkConfig &sinkConfig) = 0;
39 
40     virtual int32_t AppendSurface(std::string deviceId, uint64_t surfaceId) = 0;
41     virtual int32_t AppendSurface(std::string deviceId, sptr<IBufferProducer> producer) = 0;
42     virtual int32_t RemoveSurface(std::string deviceId, uint64_t surfaceId) = 0;
43 
44     virtual int32_t SetListener(const std::shared_ptr<IWfdEventListener> &listener) = 0;
45 
46     virtual int32_t SetSceneType(std::string deviceId, uint64_t surfaceId, SceneType sceneType) = 0;
47     virtual int32_t SetMediaFormat(std::string deviceId, CodecAttr videoAttr, CodecAttr audioAttr) = 0;
48     virtual int32_t GetBoundDevicesList(std::vector<BoundDeviceInfo> &devices) = 0;
49     virtual int32_t DeleteBoundDevice(std::string &deviceAddress) = 0;
50 };
51 
52 class __attribute__((visibility("default"))) WfdSinkFactory {
53 public:
54     static std::shared_ptr<WfdSink> CreateSink(int32_t type, const std::string key);
55 
56 private:
57     WfdSinkFactory() = default;
58     ~WfdSinkFactory() = default;
59     static std::shared_ptr<WfdSink> wfdSinkImpl_;
60 };
61 
62 } // namespace Sharing
63 } // namespace OHOS
64 
65 #endif // OHOS_SHARING_WFD_H
66