# Windows Sender Demo This is a simplified demo of the Windows Host sender for DisplayFlow. It demonstrates: 1. Screen Capture using Desktop Duplication API (DXGI). 2. Hardware H.264 Encoding using Media Foundation (MF). 3. Network Transmission using UDP. ## Prerequisites - Windows 10/11 - Visual Studio 2019 or later (with C++ Desktop Development) - CMake 3.10+ ## Build 1. Open a terminal (Developer Command Prompt for VS). 2. Navigate to this directory: ```cmd cd demo\windows_sender ``` 3. Create a build directory: ```cmd mkdir build cd build ``` 4. Configure and Build: ```cmd cmake .. cmake --build . --config Release ``` ## Run Run the executable with target IP and Port (optional): ```cmd .\Release\WindowsSenderDemo.exe ``` Example: ```cmd .\Release\WindowsSenderDemo.exe 192.168.1.100 8888 ``` ## Implementation Details - **ScreenCapture**: Uses `IDXGIOutputDuplication` to capture desktop frames. - **VideoEncoder**: Uses `IMFTransform` (Media Foundation) to encode frames to H.264. - *Note*: This demo attempts to feed RGB32 textures to the encoder. If the hardware encoder only supports NV12, conversion logic is needed (not fully implemented in this minimal demo). - **NetworkSender**: Fragments the H.264 stream into UDP packets (MTU ~1400 bytes) and sends them to the target. ## Protocol The demo uses a simple custom protocol for feasibility verification: - **Packet Header** (Network Layer): `FrameID` (4B), `FragID` (2B), `TotalFrags` (2B). - **Frame Header** (Application Layer, in first fragment/reassembled): `Timestamp` (8B), `Width` (4B), `Height` (4B), `Type` (4B), `Size` (4B). - **Payload**: H.264 NAL units.