• Home
Name Date Size #Lines LOC

..--

figures/07-Sep-2024-

frameworks/innerkitsimpl/native/wfd/07-Sep-2024-1,075821

interfaces/innerkits/native/wfd/07-Sep-2024-351230

patches/07-Sep-2024-2019

sa_profile/07-Sep-2024-4744

services/07-Sep-2024-40,76530,665

tests/07-Sep-2024-22,52518,731

.clang-formatD07-Sep-20243.5 KiB123123

BUILD.gnD07-Sep-20241 KiB2421

LICENSED07-Sep-202411.1 KiB202169

OAT.xmlD07-Sep-20244.8 KiB8025

README.en.mdD07-Sep-20246.9 KiB8574

README_zh.mdD07-Sep-20245.9 KiB8274

bundle.jsonD07-Sep-20242.5 KiB9695

config.gniD07-Sep-2024750 1916

hisysevent.yamlD07-Sep-20242.8 KiB6219

README.en.md

1# castengine_wifi_display<a name="ZH-CN_TOPIC_0000001147574647"></a>
2- [Introduction](#e05dce83)
3- [Logical architecture](#x5H5N)
4- [Module responsibilities](#b4Dwq)
5- [directory structure](#767fa455)
6- [Usage](#S3D8i)
7- [Related Repositories](#55ac5bcd)
8
9## Introduction <a name="e05dce83"></a>
10The alias of the "castengine_wifi_display" component is "Sharing", which means "media sharing". This component has the capabilities of streaming media protocol access, media preview, and media redistribution. It is managed and called by the castengine_cast_framework service, and is an important streaming media capability component in the castengine subsystem. It provides simple Native C++ interfaces to support Miracast casting. The component provides the following common functions:
11
12- WFD Source : Indicates the screen capture transmitter, which sends multiple screen data streams to different devices.
13
14- WFD Sink: Indicates the screen data receiver, which receives screen data streams from multiple devices.
15## Logical architecture <a name="x5H5N"></a>
16![](figures/sharing_wifi_display.jpg)
17## Module responsibilities <a name="b4Dwq"></a>
18| **Module Name** | **Responsibilities** |
19| --- | --- |
20| Interaction | Framework layer interaction module, responsible for interaction between processes on the device or across devices,supporting concurrent interaction with multiple processes. |
21| Scene | The business implementation part of the Interaction module, together with the Interaction instance, accomplishes external interactions and internal framework calls. |
22| ContextMgr | The service context managerment of the framework. The container associates different agents to implement receiving, distributing, and sending media streams. Each context instance can contain multiple agents. |
23| Agent | The agent object of the service in the framework, responsible for the interaction in the signaling. The Agent is divided into Sink Agent and Source Agent. Sink Agent is responsible for receiving stream (acquiring media data), and Source Agent is responsible for sending stream (outputting media data). |
24| Session | The specific implementation of the service control and works with Agent to complete the signaling interactions of the service. |
25| Configuration | Configuration management module that sets up configuration data for the framework and the service, which is loaded when the service starts. |
26| EventScheduler | Event distribution and scheduling manager, centralized distribution and processing of events reported by the module, using asynchronous thread pool processing, not to deal with time-consuming operations such as disk IO and network IO. |
27| MediachannelMgr | The framework media channel module manages media channels, and each media channel instance can realize the access, preview and sending of media data; it has the ability of coding and decoding, mixing, and transmitting of streaming media packets. |
28| Consumer | Media data input object. The media data can be obtained in any way based on the business properties, usually used for receiving streams. |
29| Producer | Media data output object. The  media data can be output in any way based on business properties, usually used for pushing streams. |
30| ServiceMgr | Service management module, management for service monitoring. Each instance is used to monitor the specified tcp or udp port, and exchange data with external processes or devices. |
31| InputBack | Inputback control module, handles cross-device control and coordinate changes. |
32| WindowMgr | Window management. Window instances are used when preview Windows are internal triggered. |
33| Protocol | Encapsulates protocols such as rtsp, rtp, wfd, dlna, and uibc for protocol interaction and interconnection. |
34| Codec | Media data encapsulation and decapsulation, encoding and decoding, hardware decoding acceleration, etc. |
35| Network | Encapsulates the network protocol, including the tcp/udp server and client. |
36
37## Directory structure <a name="767fa455"></a>
38Repositories directory structure is as follows:
39
40```
41/foundation/CastEngine/castengine_wifi_display # airing parts business code
42├── figures                               #
43├── interfaces                            # External interface
44│   ├── kits                              # Application interface
45│   └── innerkits                         # System internals interface
46├── frameworks                            # Client implementation
47│   └── innerkitsimpl                     # Native c++ implementation
48├── sa_profile                            # Component configuration
49├── services                              # Service C/S implementation
50│   ├── interaction                       # Process interaction
51│   ├── configure                         # Configuration management
52│   ├── context                           # Business container
53│   ├── agent                             # Service agent
54│   ├── mediachannel                      # Media channel
55│   ├── mediaplayer                       # Play and render
56│   ├── etc                               # Inner service configuration
57│   ├── event                             # Event center
58│   ├── impl                              # Business implementation
59│   │   └── wfd                           # WFD service implementation
60│   ├── inputback                         # Anti-control module
61│   ├── scheduler                         # Scheduling center
62│   ├── windowmgr                         # Window management
63│   ├── protocol                          # Protocol library
64│   ├── codec                             # Codec library
65│   ├── network                           # Network library
66│   ├── extend                            # Third-party library
67│   ├── common                            # Public classes
68│   └── utils                             # Tools classes
69├── sa_profile                            # Service configuration in system
70├── tests                                 # Test cases
71├── bundle.json                           # Component description file
72└── BUILD.gn                              # Compilation entry
73```
74
75
76## Usage <a name="S3D8i"></a>
77The WFD Sink allows multiple devices to cast it simultaneously. The castengine_wifi_display allows individual control of the audio for each casting session, enabling the selection of audio playback or muting in multi-casting scenarios. In general, the WFD Source can only cast to one device at a time. A device can act as a Sink or a Source, but not both simultaneously.
78
79##  Related Repositories <a name="55ac5bcd"></a>
80
81[castengine_cast_framework](https://gitee.com/openharmony/castengine_cast_framework)
82
83[castengine_cast_plus_stream](https://gitee.com/openharmony-sig/castengine_cast_plus_stream)
84
85[castengine_dlna](https://gitee.com/openharmony-sig/castengine_dlna)

README_zh.md

1# castengine_wifi_display<a name="ZH-CN_TOPIC_0000001147574647"></a>
2- [简介](#e05dce83)
3- [逻辑架构](#x5H5N)
4- [模块职责](#b4Dwq)
5- [目录结构](#767fa455)
6- [使用说明](#S3D8i)
7- [相关仓](#55ac5bcd)
8
9## 简介<a name="e05dce83"></a>
10castengine_wifi_display部件别名Sharing,媒体分享之意。拥有流媒体协议接入、媒体预览、媒体转分发能力,受投播管理服务管理和调用,是音视频投播子系统重要的流媒体能力部件。提供一套简单的Native C++的接口,主要业务是Miracast投屏,提供以下常用功能:
11
12- 主投端(WFD Source):主投端发送器,用于投屏Source端业务,可发送多路屏幕镜像流到不同设备。
13
14- 被投端(WFD Sink):被投端接收器,用于投屏Sink端业务,可接收多个设备的投屏流。
15## 逻辑架构<a name="x5H5N"></a>
16![](figures/sharing_wifi_display.jpg)
17## 模块职责<a name="b4Dwq"></a>
18| **模块名称** | **职责** |
19| --- | --- |
20| Interaction | 框架层交互模块,负责与外部进程进行交互,基于IPC与RPC机制用于实现设备内和设备间的跨进程通信,支持与多个进程并发交互。 |
21| Scene | 交互模块的业务实现部分,和Interaction实例共同完成对外交互和对内框架调用。 |
22| ContextMgr | 框架层业务容器模块,负责将不同的业务Agent关联在一起,用于实现收流,转发,发流等业务;每个业务容器实例可包含多个Agent。 |
23| Agent | 业务在框架层的代理对象,负责信令层的交互。Agent分为Sink端Agent和Src端Agent。其中,Sink Agent负责收流(获取媒体数据)业务,Src Agent负责发流(输出媒体数据)业务。 |
24| Session | 业务控制层的具体实现,和Agent对象共同完成业务的信令交互。 |
25| Configuration | 配置管理模块,设置框架和业务的配置数据,服务启动时加载。 |
26| EventScheduler | 事件分发调度管理器,集中分发处理模块上报事件,采用异步线程池方式处理,不处理磁盘IO和网络IO等耗时操作。 |
27| MediachannelMgr | 框架层媒体通道模块,管理媒体通道,每个媒体通道实例可实现媒体数据的接入、预览和发送;具备编解码能力、混流能力、流媒体数据包透传能力; |
28| Consumer | 获取媒体数据对象,可根据业务属性通过任何方式获取媒体数据,通常用于收流。 |
29| Producer | 输出媒体数据对象,可根据业务属性通过任何方式输出媒体数据,通常用于推流。 |
30| ServiceMgr | 框架层服务管理模块,服务监听的管理模块,每个service实例用于对指定的端口进行tcp或者udp监听,可与外部进程或设备进行数据交互。 |
31| InputBack | 反控模块,跨设备反控及坐标变化等处理。 |
32| WindowMgr | 框架层窗口管理模块,窗口实例用于自触发预览窗口时使用。 |
33| Protocol | 实现rtsp、rtp、wfd、dlna、uibc等协议封装,用于对外协议交互与对接。 |
34| Codec | 媒体数据的封装与解封装,编码与解码,硬解加速等。 |
35| Network | 网络协议封装,包括tcp/udp的服务端、客户端等。 |
36
37## 目录结构<a name="767fa455"></a>
38仓目录结构如下:
39```
40/foundation/CastEngine/castengine_wifi_display  # 投播部件业务代码
41├── figures                               #
42├── interfaces                            # 外部接口层
43│   ├── kits                              # 应用接口
44│   └── innerkits                         # 系统内部件接口
45├── frameworks                            # 部件无独立进程的实现
46│   └── innerkitsimpl                     # native c++实现
47├── sa_profile                            # 部件配置
48├── services                              # 服务C/S实现
49│   ├── interaction                       # 进程交互
50│   ├── configure                         # 配置管理
51│   ├── context                           # 业务容器
52│   ├── agent                             # 业务代理
53│   ├── mediachannel                      # 媒体通道
54│   ├── mediaplayer                       # 播放渲染
55│   ├── etc                               # 部件进程配置
56│   ├── event                             # 事件中心
57│   ├── impl                              # 业务实现
58│   │   └── wfd                           # WFD业务实现
59│   ├── inputback                         # 反控模块
60│   ├── scheduler                         # 调度中心
61│   ├── windowmgr                         # 窗口管理
62│   ├── protocol                          # 协议库
63│   ├── codec                             # 编解码库
64│   ├── network                           # 网络库
65│   ├── extend                            # 引入库
66│   ├── common                            # 公共类
67│   └── utils                             # 工具类
68├── sa_profile                            # 服务配置
69├── tests                                 # 测试代码
70├── bundle.json                           # 部件描述文件
71└── BUILD.gn                              # 编译入口
72```
73## 目录结构<a name="S3D8i"></a>
74WFD Sink作为被投端允许多个设备同时投屏。投播框架允许单独操控每路投屏的音频,因此在多路投屏时可自由选择音频的播放与静音;WFD Source 可投屏到多个Sink端。设备作为Sink端时不能再作为Source端,反之亦然。
75
76## 相关仓<a name="55ac5bcd"></a>
77[castengine_cast_framework](https://gitee.com/openharmony/castengine_cast_framework)
78
79[castengine_cast_plus_stream](https://gitee.com/openharmony-sig/castengine_cast_plus_stream)
80
81[castengine_dlna](https://gitee.com/openharmony-sig/castengine_dlna)
82