• 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 RemoveSurface(std::string deviceId, uint64_t surfaceId) = 0;
42 
43     virtual int32_t SetListener(const std::shared_ptr<IWfdEventListener> &listener) = 0;
44 
45     virtual int32_t SetSceneType(std::string deviceId, uint64_t surfaceId, SceneType sceneType) = 0;
46     virtual int32_t SetMediaFormat(std::string deviceId, CodecAttr videoAttr, CodecAttr audioAttr) = 0;
47 };
48 
49 class __attribute__((visibility("default"))) WfdSinkFactory {
50 public:
51     static std::shared_ptr<WfdSink> CreateSink(int32_t type, const std::string key);
52 
53 private:
54     WfdSinkFactory() = default;
55     ~WfdSinkFactory() = default;
56     static std::shared_ptr<WfdSink> wfdSinkImpl_;
57 };
58 
59 } // namespace Sharing
60 } // namespace OHOS
61 
62 #endif // OHOS_SHARING_WFD_H
63