Skip to content

Commit 54af8f6

Browse files
authored
feat(nscodec): introduce ironrdp-nscodec crate + opt-in server integration (#1332)
Adds an opt-in implementation of the legacy RDP NSCodec encoder as a standalone crate, and wires it into `ironrdp-server` behind a feature flag so servers can serve NSCodec-only clients (notably macOS Microsoft Remote Desktop / Windows App) without default-build behavior changes.
1 parent cf51bdd commit 54af8f6

10 files changed

Lines changed: 466 additions & 0 deletions

File tree

Cargo.lock

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/ironrdp-nscodec/Cargo.toml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
[package]
2+
name = "ironrdp-nscodec"
3+
version = "0.1.0"
4+
readme = "README.md"
5+
description = "NSCodec ([MS-RDPNSC]) implementation for IronRDP"
6+
publish = false # TODO: publish
7+
edition.workspace = true
8+
license.workspace = true
9+
homepage.workspace = true
10+
repository.workspace = true
11+
authors.workspace = true
12+
keywords.workspace = true
13+
categories.workspace = true
14+
15+
[lib]
16+
doctest = false
17+
# test = false # FIXME: turn off and keep tests in testsuite crates
18+
19+
[features]
20+
# Encoder is opt-in. Default-disabled because consumers (notably
21+
# `ironrdp-server`) hide NSCodec behind their own feature gate too, so it
22+
# should never be pulled in incidentally.
23+
default = []
24+
encoder = ["dep:ironrdp-graphics"]
25+
26+
[dependencies]
27+
ironrdp-graphics = { path = "../ironrdp-graphics", version = "0.8", optional = true } # public when `encoder` is on
28+
29+
[lints]
30+
workspace = true
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../LICENSE-APACHE

crates/ironrdp-nscodec/LICENSE-MIT

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../LICENSE-MIT

crates/ironrdp-nscodec/README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# ironrdp-nscodec
2+
3+
NSCodec ([MS-RDPNSC]) implementation for IronRDP.
4+
5+
NSCodec is a legacy bitmap codec used in the RDP "Surface Bits" command path. It
6+
predates RemoteFX but remains the only legacy codec advertised by the macOS
7+
Microsoft Remote Desktop / Windows App client's bitmap codec list, so servers
8+
wanting non-raw bitmap delivery to that client need it.
9+
10+
## Feature Flags
11+
12+
- **`encoder`** -- Opt-in; pulls in the server-side encoder
13+
(`ironrdp_nscodec::encoder::encode`) and `ironrdp-graphics` for the
14+
`PixelFormat` input enum.
15+
16+
With no features (`default-features = false`), the crate compiles to an empty
17+
shell — enable `encoder` to get the actual code.
18+
19+
## Status
20+
21+
Encoder side only. Implements the codec defined in MS-RDPNSC §3.1.5:
22+
23+
1. RGB → YCoCg color-space conversion (lossy on chroma when CLL > 0).
24+
2. Per-plane RLE compression (custom MS-RDPNSC byte-level RLE).
25+
3. 20-byte frame header + concatenated Y, Co, Cg, A planes.
26+
27+
Chroma subsampling (`ChromaSubsamplingLevel = 1`, 4:2:0) is not yet
28+
implemented; the encoder always emits `ChromaSubsamplingLevel = 0`.
29+
30+
[MS-RDPNSC]: https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-rdpnsc/68df0993-2c44-4d57-8aef-cdab1c1c43a8

0 commit comments

Comments
 (0)