Compare commits

...

3 Commits

Author SHA1 Message Date
reito
3c6ee52eea Merge branch 'main' into main-osr-nv12 2026-02-25 00:38:00 +08:00
reito
1c2cfc28db feat: add nv12 osr output format. 2026-02-14 11:04:47 +08:00
reito
6718f2b5e3 feat: add nv12 osr output format. 2026-02-14 11:04:46 +08:00
3 changed files with 5 additions and 0 deletions

View File

@@ -94,6 +94,7 @@
The actual output pixel format and color space of the texture should refer to [`OffscreenSharedTexture`](../structures/offscreen-shared-texture.md) object in the `paint` event.
* `argb` - The requested output texture format is 8-bit unorm RGBA, with SRGB SDR color space.
* `rgbaf16` - The requested output texture format is 16-bit float RGBA, with scRGB HDR color space.
* `nv12` - The requested output texture format is 12bpp with Y plane followed by a 2x2 interleaved UV plane, with REC709 color space.
* `deviceScaleFactor` number (optional) _Experimental_ - The device scale factor of the offscreen rendering output. If not set, will use `1` as default.
* `contextIsolation` boolean (optional) - Whether to run Electron APIs and
the specified `preload` script in a separate JavaScript context. Defaults

View File

@@ -24,6 +24,8 @@ media::VideoPixelFormat GetTargetPixelFormatFromOption(
return media::PIXEL_FORMAT_ARGB;
} else if (pixel_format_option == "rgbaf16") {
return media::PIXEL_FORMAT_RGBAF16;
} else if (pixel_format_option == "nv12") {
return media::PIXEL_FORMAT_NV12;
}
// Use ARGB as default.

View File

@@ -31,6 +31,8 @@ std::string OsrVideoPixelFormatToString(media::VideoPixelFormat format) {
return "rgba";
case media::PIXEL_FORMAT_RGBAF16:
return "rgbaf16";
case media::PIXEL_FORMAT_NV12:
return "nv12";
default:
NOTREACHED();
}