{"_id":"@bun-win32/dxva2","_rev":"4-de322cd9aa1cb42b574096373c8e0e8e","name":"@bun-win32/dxva2","dist-tags":{"latest":"2.0.1"},"versions":{"1.0.0":{"name":"@bun-win32/dxva2","version":"1.0.0","keywords":["bun","ffi","win32","windows","dxva2","bindings","typescript","dll"],"author":"Stev Peifer <stev@bell.net>","license":"MIT","_id":"@bun-win32/dxva2@1.0.0","maintainers":[{"name":"obscuritysrl","email":"stev@bell.net"}],"homepage":"https://github.com/ObscuritySRL/bun-win32#readme","bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"dist":{"shasum":"5827a79fb88c686192a206fd59ea4269e521db1b","tarball":"https://registry.npmjs.org/@bun-win32/dxva2/-/dxva2-1.0.0.tgz","fileCount":6,"integrity":"sha512-qDWOhsjIdP9BhG1TOE+MwQvuM7QNf12L6KrdhhnIllkSqWQh5ieiNOakIM0sM5O757DJKdaUNoq+twbFnpDAkQ==","signatures":[{"sig":"MEQCIGGozYSXGtr7uA1Y2YlA25NEoAOqkEGD4MQ9E+e3NJHiAiB9udW+YZF35w50XzjVaA5ZIZUI6QCF6yjX7653870P6w==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":32821},"main":"./index.ts","type":"module","module":"index.ts","shasum":"5827a79fb88c686192a206fd59ea4269e521db1b","engines":{"bun":">=1.1.0"},"exports":{".":"./index.ts"},"private":false,"scripts":{"example:lumen-pulse":"bun ./example/lumen-pulse.ts","example:monitor-inspector":"bun ./example/monitor-inspector.ts"},"_npmUser":{"name":"obscuritysrl","email":"stev@bell.net"},"_integrity":"sha512-qDWOhsjIdP9BhG1TOE+MwQvuM7QNf12L6KrdhhnIllkSqWQh5ieiNOakIM0sM5O757DJKdaUNoq+twbFnpDAkQ==","repository":{"url":"git://github.com/ObscuritySRL/bun-win32.git","type":"git","directory":"packages/dxva2"},"_npmVersion":"10.8.3","description":"Zero-dependency, zero-overhead Win32 DXVA2 bindings for Bun (FFI) on Windows.","directories":{},"sideEffects":false,"_nodeVersion":"24.3.0","dependencies":{"@bun-win32/core":"1.1.2"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest","@bun-win32/user32":"3.0.20"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/dxva2_1.0.0_1778689567510_0.46015449611795356","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@bun-win32/dxva2","version":"1.0.1","keywords":["bun","ffi","win32","windows","dxva2","bindings","typescript","dll"],"author":"Stev Peifer <stev.p@outlook.com>","license":"MIT","_id":"@bun-win32/dxva2@1.0.1","maintainers":[{"name":"obscuritysrl","email":"stev@bell.net"}],"homepage":"https://github.com/ObscuritySRL/bun-win32#readme","bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"dist":{"shasum":"30af2e6f710c8fe844bdcde5e98b600ac1957d5a","tarball":"https://registry.npmjs.org/@bun-win32/dxva2/-/dxva2-1.0.1.tgz","fileCount":6,"integrity":"sha512-yXLdXaaZuiu1jHKJ4U3cKuJiOg5xPjP8rJ7YqNSaLJoaeTgaXE5AHKzNP3YbLDNk85EBtUtH7vNImwxsNQU46A==","signatures":[{"sig":"MEYCIQDXkgigNRJo1x7nCASOrqMi+kBwI6x903E2n3eam3IDdAIhAPBFLsgAQ0wfYaAXNJm8am+mGvShKt/db6b18Gh0Mq7z","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":32826},"main":"./index.ts","type":"module","module":"index.ts","shasum":"30af2e6f710c8fe844bdcde5e98b600ac1957d5a","engines":{"bun":">=1.1.0"},"exports":{".":"./index.ts"},"private":false,"scripts":{"example:lumen-pulse":"bun ./example/lumen-pulse.ts","example:monitor-inspector":"bun ./example/monitor-inspector.ts"},"_npmUser":{"name":"obscuritysrl","email":"stev@bell.net"},"_integrity":"sha512-yXLdXaaZuiu1jHKJ4U3cKuJiOg5xPjP8rJ7YqNSaLJoaeTgaXE5AHKzNP3YbLDNk85EBtUtH7vNImwxsNQU46A==","repository":{"url":"git://github.com/ObscuritySRL/bun-win32.git","type":"git","directory":"packages/dxva2"},"_npmVersion":"10.8.3","description":"Zero-dependency, zero-overhead Win32 DXVA2 bindings for Bun (FFI) on Windows.","directories":{},"sideEffects":false,"_nodeVersion":"24.3.0","dependencies":{"@bun-win32/core":"1.1.4"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest","@bun-win32/user32":"3.0.22"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/dxva2_1.0.1_1781130829339_0.5469444148106897","host":"s3://npm-registry-packages-npm-production"}},"2.0.0":{"name":"@bun-win32/dxva2","version":"2.0.0","keywords":["bun","ffi","win32","windows","dxva2","bindings","typescript","dll"],"author":"Stev Peifer <stev.p@outlook.com>","license":"MIT","_id":"@bun-win32/dxva2@2.0.0","maintainers":[{"name":"obscuritysrl","email":"stev.p@outlook.com"}],"homepage":"https://github.com/ObscuritySRL/bun-win32#readme","bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"dist":{"shasum":"d0426ad6f0ffad8872916b5b35b4cb5a02551f48","tarball":"https://registry.npmjs.org/@bun-win32/dxva2/-/dxva2-2.0.0.tgz","fileCount":6,"integrity":"sha512-Gd0qqC8dwXp1wa0xplV6ncS114dXFRIwJ9D4rJxWxzGKDGQSs+49RKeI6+N1WPkyT9bvPNl14e5QgQ7egpspAQ==","signatures":[{"sig":"MEUCIQCDnIMi7H76Koj4DUdMuCCqzirYEGTHO18NlVRr9w7M0AIgCCW4COngoyBaZkLfU4gE5tHKzmf28lb6MSG9tn3zyTE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":34410},"main":"./index.ts","type":"module","module":"index.ts","shasum":"d0426ad6f0ffad8872916b5b35b4cb5a02551f48","engines":{"bun":">=1.1.0"},"exports":{".":"./index.ts"},"private":false,"scripts":{"example:lumen-pulse":"bun ./example/lumen-pulse.ts","example:monitor-inspector":"bun ./example/monitor-inspector.ts"},"_npmUser":{"name":"obscuritysrl","email":"stev.p@outlook.com"},"_integrity":"sha512-Gd0qqC8dwXp1wa0xplV6ncS114dXFRIwJ9D4rJxWxzGKDGQSs+49RKeI6+N1WPkyT9bvPNl14e5QgQ7egpspAQ==","repository":{"url":"git://github.com/ObscuritySRL/bun-win32.git","type":"git","directory":"packages/dxva2"},"_npmVersion":"10.8.3","description":"Zero-dependency, zero-overhead Win32 DXVA2 bindings for Bun (FFI) on Windows.","directories":{},"sideEffects":false,"_nodeVersion":"26.3.0","dependencies":{"@bun-win32/core":"2.0.0"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest","@bun-win32/user32":"4.0.0"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/dxva2_2.0.0_1782435307289_0.04914891012725109","host":"s3://npm-registry-packages-npm-production"}},"2.0.1":{"author":"Stev Peifer <stev.p@outlook.com>","bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"dependencies":{"@bun-win32/core":"2.0.1"},"description":"Zero-dependency, zero-overhead Win32 DXVA2 bindings for Bun (FFI) on Windows.","devDependencies":{"@bun-win32/user32":"4.0.1","@types/bun":"latest"},"exports":{".":"./index.ts"},"license":"MIT","module":"index.ts","name":"@bun-win32/dxva2","peerDependencies":{"typescript":"^5"},"private":false,"homepage":"https://github.com/ObscuritySRL/bun-win32#readme","repository":{"type":"git","url":"git://github.com/ObscuritySRL/bun-win32.git","directory":"packages/dxva2"},"type":"module","version":"2.0.1","main":"./index.ts","keywords":["bun","ffi","win32","windows","dxva2","bindings","typescript","dll"],"sideEffects":false,"engines":{"bun":">=1.1.0"},"scripts":{"example:lumen-pulse":"bun ./example/lumen-pulse.ts","example:monitor-inspector":"bun ./example/monitor-inspector.ts"},"_id":"@bun-win32/dxva2@2.0.1","_integrity":"sha512-IKzpwXBUCc50EJYoqTqFjXyKTFf2MgI67EyU0xiwFZkawuFRA5wt4VXFeyjJtLvFzVUHhqAknHuy7eksn5tPHQ==","_nodeVersion":"26.3.0","_npmVersion":"10.8.3","shasum":"d5ca33a5c24eeed0e407753decd1881b029e4773","dist":{"integrity":"sha512-IKzpwXBUCc50EJYoqTqFjXyKTFf2MgI67EyU0xiwFZkawuFRA5wt4VXFeyjJtLvFzVUHhqAknHuy7eksn5tPHQ==","shasum":"d5ca33a5c24eeed0e407753decd1881b029e4773","tarball":"https://registry.npmjs.org/@bun-win32/dxva2/-/dxva2-2.0.1.tgz","fileCount":6,"unpackedSize":34410,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDqR13KxaEoZAqwTeqo1tzXQtSDPONw7KVzndCw+k9fOAIhALEfQR7lLvyf2Goq+FlnX48cUtGjZ235CCzoOtDCfOok"}]},"_npmUser":{"name":"obscuritysrl","email":"stev.p@outlook.com"},"directories":{},"maintainers":[{"name":"obscuritysrl","email":"stev.p@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/dxva2_2.0.1_1782437768812_0.5976361658393508"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-13T16:26:07.216Z","modified":"2026-06-26T01:36:09.060Z","1.0.0":"2026-05-13T16:26:07.665Z","1.0.1":"2026-06-10T22:33:49.533Z","2.0.0":"2026-06-26T00:55:07.410Z","2.0.1":"2026-06-26T01:36:08.945Z"},"bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"author":"Stev Peifer <stev.p@outlook.com>","license":"MIT","homepage":"https://github.com/ObscuritySRL/bun-win32#readme","keywords":["bun","ffi","win32","windows","dxva2","bindings","typescript","dll"],"repository":{"type":"git","url":"git://github.com/ObscuritySRL/bun-win32.git","directory":"packages/dxva2"},"description":"Zero-dependency, zero-overhead Win32 DXVA2 bindings for Bun (FFI) on Windows.","maintainers":[{"name":"obscuritysrl","email":"stev.p@outlook.com"}],"readme":"# @bun-win32/dxva2\r\n\r\nZero-dependency, zero-overhead Win32 DXVA2 bindings for [Bun](https://bun.sh) on Windows.\r\n\r\n## Overview\r\n\r\n`@bun-win32/dxva2` exposes the `dxva2.dll` exports using [Bun](https://bun.sh)'s FFI. It provides a single class, `Dxva2`, which lazily binds native symbols on first use. You can optionally preload a subset or all symbols up-front via `Preload()`.\r\n\r\nThe bindings are strongly typed for a smooth DX in TypeScript.\r\n\r\n## Features\r\n\r\n- [Bun](https://bun.sh)-first ergonomics on Windows 10/11.\r\n- Direct FFI to `dxva2.dll` (DDC/CI monitor configuration — brightness, contrast, color temperature, RGB drive/gain, VCP features, physical monitor enumeration; plus DXVA2/DXVA-HD video acceleration and OPM/HDCP video output objects).\r\n- In-source docs in `structs/Dxva2.ts` with links to Microsoft Docs.\r\n- Lazy binding on first call; optional eager preload (`Dxva2.Preload()`).\r\n- No wrapper overhead; calls map 1:1 to native APIs.\r\n- Strongly-typed Win32 aliases (see `types/Dxva2.ts`).\r\n\r\n## Requirements\r\n\r\n- [Bun](https://bun.sh) runtime\r\n- Windows 10 or later\r\n\r\n## Installation\r\n\r\n```sh\r\nbun add @bun-win32/dxva2\r\n```\r\n\r\n## Quick Start\r\n\r\n```ts\r\nimport Dxva2, { PHYSICAL_MONITOR_SIZE } from '@bun-win32/dxva2';\r\nimport User32 from '@bun-win32/user32';\r\n\r\nDxva2.Preload(['GetNumberOfPhysicalMonitorsFromHMONITOR', 'GetPhysicalMonitorsFromHMONITOR', 'GetMonitorBrightness', 'SetMonitorBrightness', 'DestroyPhysicalMonitors']);\r\n\r\n// 1. Pick the monitor under the primary window (or pass any HMONITOR from EnumDisplayMonitors).\r\nconst hwnd = User32.GetForegroundWindow();\r\nconst hMonitor = User32.MonitorFromWindow(hwnd, /* MONITOR_DEFAULTTOPRIMARY */ 1);\r\n\r\n// 2. Resolve the underlying physical monitors (one HMONITOR may map to several).\r\nconst count = Buffer.alloc(4);\r\nDxva2.GetNumberOfPhysicalMonitorsFromHMONITOR(hMonitor, count.ptr);\r\nconst physicalCount = count.readUInt32LE(0);\r\n\r\nconst physicalMonitorArray = Buffer.alloc(PHYSICAL_MONITOR_SIZE * physicalCount);\r\nDxva2.GetPhysicalMonitorsFromHMONITOR(hMonitor, physicalCount, physicalMonitorArray.ptr);\r\n\r\n// 3. The first 8 bytes of each PHYSICAL_MONITOR entry is the physical monitor HANDLE.\r\nconst physicalHandle = physicalMonitorArray.readBigUInt64LE(0);\r\n\r\n// 4. Read the brightness range and current value.\r\nconst minBrightness = Buffer.alloc(4);\r\nconst curBrightness = Buffer.alloc(4);\r\nconst maxBrightness = Buffer.alloc(4);\r\nDxva2.GetMonitorBrightness(physicalHandle, minBrightness.ptr, curBrightness.ptr, maxBrightness.ptr);\r\nconsole.log(`Brightness ${curBrightness.readUInt32LE(0)} / range ${minBrightness.readUInt32LE(0)}–${maxBrightness.readUInt32LE(0)}`);\r\n\r\n// 5. Set a new brightness (clamped to the reported range).\r\nDxva2.SetMonitorBrightness(physicalHandle, 50);\r\n\r\n// 6. ALWAYS release the physical monitor handles.\r\nDxva2.DestroyPhysicalMonitors(physicalCount, physicalMonitorArray.ptr);\r\n```\r\n\r\n> [!NOTE]\r\n> AI agents: see `AI.md` for the package binding contract and source-navigation guidance. It explains how to use the package without scanning the entire implementation.\r\n\r\n## Examples\r\n\r\nRun the included examples:\r\n\r\n```sh\r\nbun run example:lumen-pulse\r\nbun run example:monitor-inspector\r\n```\r\n\r\n## Notes\r\n\r\n- Either rely on lazy binding or call `Dxva2.Preload()`.\r\n- Windows only. Bun runtime required.\r\n- The monitor configuration functions speak DDC/CI over I²C. Many displays only partially implement the VESA MCCS standard — calls may succeed but the monitor may not react, or may react in surprising ways. Always read the supported-capabilities bitmask from `GetMonitorCapabilities` before issuing a Set call, and pair every `GetPhysicalMonitors*` with a matching `DestroyPhysicalMonitors`.\r\n- One `HMONITOR` (GDI display) can resolve to multiple `PHYSICAL_MONITOR` entries when the OS aggregates a tiled or multi-input display.\r\n- Many of the DXVA2/DXVAHD/OPM exports require a `IDirect3DDevice9*` or related COM interface as input. Constructing those requires `d3d9.dll` bindings, which are out of scope for this package — the prototypes are still bound so callers that already have an interface pointer (for example from a Direct3D shim) can use them.\n- **SAL types & naming:** nullability is in the **type** — `Optional<T>` (formally optional, SAL `_*opt_`) and `Nullable<T>` (plain `[in]`/`[out]` the docs say can be NULL), the null sentinel derived from `T` (`null` for pointers `LP*`/`P*`, `0n` for handles/by-value addresses); direction is in the **parameter name** — `_out` (`_Out_`), `_in_out` (`_Inout_`), `_In_` bare. See `AI.md` and the repo `AGENTS.md`.\n","readmeFilename":"README.md"}