{"_id":"@bun-win32/quartz","_rev":"3-33d96c1fe520df1cd721cba29684fbda","name":"@bun-win32/quartz","dist-tags":{"latest":"2.0.1"},"versions":{"1.0.0":{"name":"@bun-win32/quartz","version":"1.0.0","keywords":["bun","ffi","win32","windows","quartz","bindings","typescript","dll"],"author":"Stev Peifer <stev@bell.net>","license":"MIT","_id":"@bun-win32/quartz@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":"8d487500e96e2bb076ff13010d57bea94a9ed6af","tarball":"https://registry.npmjs.org/@bun-win32/quartz/-/quartz-1.0.0.tgz","fileCount":6,"integrity":"sha512-mzmjjwWUWoBPxXFIZIKKCiZq0Q8uxHRE+9Cc0fpvwWWMgN6XNpHLQ8WNQF2O9Fvy4xkr82y4OULzXs87siHSaA==","signatures":[{"sig":"MEQCIBS7g0+JRyxFKBxP+DEMaUcq0AN+hLXLM8YYDPpVukczAiAmdlBohny1vmnRqtSoeEQfR7opc7XAuyGOGL25NGIKVA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":12468},"main":"./index.ts","type":"module","module":"index.ts","shasum":"8d487500e96e2bb076ff13010d57bea94a9ed6af","engines":{"bun":">=1.1.0"},"exports":{".":"./index.ts"},"private":false,"scripts":{"test":"bun test ./example/quartz.integration.test.ts","example:capture-radar":"bun ./example/capture-radar.ts","example:directshow-device-census":"bun ./example/directshow-device-census.ts"},"_npmUser":{"name":"obscuritysrl","email":"stev@bell.net"},"_integrity":"sha512-mzmjjwWUWoBPxXFIZIKKCiZq0Q8uxHRE+9Cc0fpvwWWMgN6XNpHLQ8WNQF2O9Fvy4xkr82y4OULzXs87siHSaA==","repository":{"url":"git://github.com/ObscuritySRL/bun-win32.git","type":"git","directory":"packages/quartz"},"_npmVersion":"10.8.3","description":"Zero-dependency, zero-overhead Win32 QUARTZ (DirectShow) 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"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/quartz_1.0.0_1779222167901_0.4234235958231638","host":"s3://npm-registry-packages-npm-production"}},"2.0.0":{"name":"@bun-win32/quartz","version":"2.0.0","keywords":["bun","ffi","win32","windows","quartz","bindings","typescript","dll"],"author":"Stev Peifer <stev.p@outlook.com>","license":"MIT","_id":"@bun-win32/quartz@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":"7988865a9c844804d53a9da372f80f6e6ed74f7a","tarball":"https://registry.npmjs.org/@bun-win32/quartz/-/quartz-2.0.0.tgz","fileCount":6,"integrity":"sha512-ZWkQrblgWV6GksuUUmpA0tFNdwBX0jgwTsONiQD5FALGK3OTnrPLGbJrOb+8W5bcTbEYk4gfSNTXgNFOiYOiqw==","signatures":[{"sig":"MEYCIQCqtfJt8QOqkf16vzUxD5a1RVvC7EpD+v5ulp3oTYJNyQIhAIa8dzGI6YlIUZchoqOUrJcZedmnERvbX5nF8pqLWnzx","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":13737},"main":"./index.ts","type":"module","module":"index.ts","shasum":"7988865a9c844804d53a9da372f80f6e6ed74f7a","engines":{"bun":">=1.1.0"},"exports":{".":"./index.ts"},"private":false,"scripts":{"test":"bun test ./example/quartz.integration.test.ts","example:capture-radar":"bun ./example/capture-radar.ts","example:directshow-device-census":"bun ./example/directshow-device-census.ts"},"_npmUser":{"name":"obscuritysrl","email":"stev.p@outlook.com"},"_integrity":"sha512-ZWkQrblgWV6GksuUUmpA0tFNdwBX0jgwTsONiQD5FALGK3OTnrPLGbJrOb+8W5bcTbEYk4gfSNTXgNFOiYOiqw==","repository":{"url":"git://github.com/ObscuritySRL/bun-win32.git","type":"git","directory":"packages/quartz"},"_npmVersion":"10.8.3","description":"Zero-dependency, zero-overhead Win32 QUARTZ (DirectShow) 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"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/quartz_2.0.0_1782435496708_0.021186272550984153","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 QUARTZ (DirectShow) bindings for Bun (FFI) on Windows.","devDependencies":{"@types/bun":"latest"},"exports":{".":"./index.ts"},"license":"MIT","module":"index.ts","name":"@bun-win32/quartz","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/quartz"},"type":"module","version":"2.0.1","main":"./index.ts","keywords":["bun","ffi","win32","windows","quartz","bindings","typescript","dll"],"sideEffects":false,"engines":{"bun":">=1.1.0"},"scripts":{"example:capture-radar":"bun ./example/capture-radar.ts","example:directshow-device-census":"bun ./example/directshow-device-census.ts","test":"bun test ./example/quartz.integration.test.ts"},"_id":"@bun-win32/quartz@2.0.1","_integrity":"sha512-Rry8s9RNT2SaaUTqizQFpKJf7QkkS/AMOnzs0UfUmKWH8c0QlpD+EeyBfGP874IhDRsUrJ/EO6fMAnGmdoaBwA==","_nodeVersion":"26.3.0","_npmVersion":"10.8.3","shasum":"02073d17e2258d39df93320efa6c098f0e70f57b","dist":{"integrity":"sha512-Rry8s9RNT2SaaUTqizQFpKJf7QkkS/AMOnzs0UfUmKWH8c0QlpD+EeyBfGP874IhDRsUrJ/EO6fMAnGmdoaBwA==","shasum":"02073d17e2258d39df93320efa6c098f0e70f57b","tarball":"https://registry.npmjs.org/@bun-win32/quartz/-/quartz-2.0.1.tgz","fileCount":6,"unpackedSize":13737,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCEE7XVWwVBkS7/MBl/F2WKPKX70sMylWFx5JNslMqpgQIgNZWIMTMXQ/xh09MX4+PqWEygqqWsPNToP5AoE8w5hcs="}]},"_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/quartz_2.0.1_1782438157093_0.6201733516800934"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-19T20:22:47.794Z","modified":"2026-06-26T01:42:37.346Z","1.0.0":"2026-05-19T20:22:48.082Z","2.0.0":"2026-06-26T00:58:16.871Z","2.0.1":"2026-06-26T01:42:37.237Z"},"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","quartz","bindings","typescript","dll"],"repository":{"type":"git","url":"git://github.com/ObscuritySRL/bun-win32.git","directory":"packages/quartz"},"description":"Zero-dependency, zero-overhead Win32 QUARTZ (DirectShow) bindings for Bun (FFI) on Windows.","maintainers":[{"name":"obscuritysrl","email":"stev.p@outlook.com"}],"readme":"# @bun-win32/quartz\n\nZero-dependency, zero-overhead Win32 Quartz bindings for [Bun](https://bun.sh) on Windows.\n\n## Overview\n\n`@bun-win32/quartz` exposes the `quartz.dll` exports — the legacy **DirectShow** runtime — using [Bun](https://bun.sh)'s FFI. It provides a single class, `Quartz`, which lazily binds native symbols on first use. You can optionally preload a subset or all symbols up-front via `Preload()`.\n\nDirectShow is a legacy API (superseded by Media Foundation), but `quartz.dll` is still the only path that reaches a large fleet of older webcams, capture cards, virtual cameras, and codecs that never gained Media Foundation support. `quartz.dll` is also the in-process COM server for the DirectShow Filter Graph Manager (`CLSID_FilterGraph` → `IGraphBuilder`), so its `DllGetClassObject` export lets you spin up a real filter graph without `CoCreateInstance`.\n\nThe bindings are strongly typed for a smooth DX in TypeScript.\n\n## Features\n\n- [Bun](https://bun.sh)-first ergonomics on Windows 10/11.\n- Direct FFI to `quartz.dll` (DirectShow error-text lookup + the standard `Dll*` COM-server entry points for the Filter Graph Manager).\n- All documented `quartz.dll` exports are bound: `AMGetErrorTextA/W` plus the four `Dll*` COM-server functions.\n- In-source docs in `structs/Quartz.ts` with links to Microsoft Docs.\n- Lazy binding on first call; optional eager preload (`Quartz.Preload()`).\n- No wrapper overhead; calls map 1:1 to native APIs.\n- Strongly-typed Win32 aliases plus the `MAX_ERROR_TEXT_LEN` constant (see `types/Quartz.ts`).\n\n## Requirements\n\n- [Bun](https://bun.sh) runtime\n- Windows 10 or later\n\n## Installation\n\n```sh\nbun add @bun-win32/quartz\n```\n\n## Quick Start\n\n```ts\nimport Quartz, { MAX_ERROR_TEXT_LEN } from '@bun-win32/quartz';\n\n// Decode any DirectShow HRESULT into human-readable text.\nconst buffer = Buffer.alloc(MAX_ERROR_TEXT_LEN * 2); // WCHARs\nconst written = Quartz.AMGetErrorTextW(0x80040217, buffer.ptr!, MAX_ERROR_TEXT_LEN);\nconsole.log(buffer.toString('utf16le', 0, written * 2)); // \"No combination of intermediate filters...\"\n\n// quartz.dll is the COM server for the DirectShow Filter Graph Manager.\n// Resolve its class factory straight from the bound DllGetClassObject export.\nfunction guid(v: string): Buffer {\n  const m = /^(\\w{8})-(\\w{4})-(\\w{4})-(\\w{4})-(\\w{12})$/.exec(v)!;\n  const b = Buffer.alloc(16);\n  b.writeUInt32LE(parseInt(m[1], 16), 0);\n  b.writeUInt16LE(parseInt(m[2], 16), 4);\n  b.writeUInt16LE(parseInt(m[3], 16), 6);\n  const d = m[4] + m[5];\n  for (let i = 0; i < 8; i++) b[8 + i] = parseInt(d.slice(i * 2, i * 2 + 2), 16);\n  return b;\n}\n\nconst CLSID_FilterGraph = guid('e436ebb3-524f-11ce-9f53-0020af0ba770');\nconst IID_IClassFactory = guid('00000001-0000-0000-c000-000000000046');\nconst factoryOut = Buffer.alloc(8);\nconst hr = Quartz.DllGetClassObject(CLSID_FilterGraph.ptr!, IID_IClassFactory.ptr!, factoryOut.ptr!);\nconsole.log('IClassFactory @', factoryOut.readBigUInt64LE(0).toString(16), '(hr 0x' + (hr >>> 0).toString(16) + ')');\n```\n\n> [!NOTE]\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.\n\n## Examples\n\nRun the included examples:\n\n```sh\nbun run example:directshow-device-census\nbun run example:capture-radar\n```\n\n- **directshow-device-census** — a thorough diagnostic: resolves the System Device Enumerator, walks every video and audio capture moniker, reads each device's `FriendlyName` / `DevicePath` / `Description` from its `IPropertyBag`, then for each video device materializes `quartz.dll`'s own `CLSID_FilterGraph` COM server via the bound `DllGetClassObject` export, binds the source filter into the graph with `IGraphBuilder::AddFilter`, and enumerates its pins — with every HRESULT decoded by name through `AMGetErrorTextW`.\n- **capture-radar** — a live, animated radar console: a rotating ASCII sweep \"pings\" each discovered capture device, lighting it up with a signal-strength blip derived from how far its source filter gets when bound into a real `quartz.dll` filter graph (moniker → IPropertyBag → IBaseFilter → AddFilter → pins), with every HRESULT narrated live through `AMGetErrorTextW`.\n\n## Notes\n\n- DirectShow is a **legacy** API. Microsoft recommends Media Foundation for new code. Use `quartz.dll` when you must reach older webcams / capture hardware / codecs that Media Foundation does not surface.\n- `AMGetErrorTextW` takes a buffer sized in **WCHARs** and returns the number of characters written (0 on failure). `MAX_ERROR_TEXT_LEN` (160) is the documented maximum.\n- `DllGetClassObject` is `quartz.dll`'s in-process COM-server entry point. It serves DirectShow CLSIDs such as `CLSID_FilterGraph`; pass `IID_IClassFactory` and then call `IClassFactory::CreateInstance` over the returned vtable (the System Device Enumerator itself lives in `devenum.dll`, not `quartz.dll`).\n- `DllRegisterServer` / `DllUnregisterServer` mutate `HKLM` and require elevation; they are bound but should not be called from a normal process.\n- Call `CoInitializeEx` (e.g. via `@bun-win32/ole32`) before using any COM object obtained through `DllGetClassObject`.\n- COM interface pointers are opaque addresses; drive them through their vtables (resolve method slots with `ReadProcessMemory`, then `linkSymbols`).\n- Either rely on lazy binding or call `Quartz.Preload()`.\n- Windows only. Bun runtime required.\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"}