{"_id":"@bun-win32/mfplat","_rev":"3-5ac1045f0d4eb97cb210904b2da40ba4","name":"@bun-win32/mfplat","dist-tags":{"latest":"2.0.1"},"versions":{"1.0.0":{"name":"@bun-win32/mfplat","version":"1.0.0","keywords":["bun","ffi","win32","windows","mfplat","bindings","typescript","dll"],"author":"Stev Peifer <stev@bell.net>","license":"MIT","_id":"@bun-win32/mfplat@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":"b4f98d06fbeb0a48b061a9d605b1ecc516f59fb9","tarball":"https://registry.npmjs.org/@bun-win32/mfplat/-/mfplat-1.0.0.tgz","fileCount":6,"integrity":"sha512-JZAxNB6Cs5Q26rx/iRiyivW5d66oArrxAsUt3GpZA4elVCJHUMIGqeqZwR/pqOolhLGV2Glsm7y74+OGzaUQ7w==","signatures":[{"sig":"MEYCIQCtH8yEUDsxztQoTB69UwL6u7RDVD62OyhY6nk5+alR0wIhAPuaoE3A4j3hD0WEn6Q4QFalGvrMgMuEqh2hIg32dzlU","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":79691},"main":"./index.ts","type":"module","module":"index.ts","shasum":"b4f98d06fbeb0a48b061a9d605b1ecc516f59fb9","engines":{"bun":">=1.1.0"},"exports":{".":"./index.ts"},"private":false,"scripts":{"example:mft-transform-census":"bun ./example/mft-transform-census.ts","example:mfplat-platform-probe":"bun ./example/mfplat-platform-probe.ts"},"_npmUser":{"name":"obscuritysrl","email":"stev@bell.net"},"_integrity":"sha512-JZAxNB6Cs5Q26rx/iRiyivW5d66oArrxAsUt3GpZA4elVCJHUMIGqeqZwR/pqOolhLGV2Glsm7y74+OGzaUQ7w==","repository":{"url":"git://github.com/ObscuritySRL/bun-win32.git","type":"git","directory":"packages/mfplat"},"_npmVersion":"10.8.3","description":"Zero-dependency, zero-overhead Win32 MFPLAT 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/mfplat_1.0.0_1776867979936_0.638922498821848","host":"s3://npm-registry-packages-npm-production"}},"2.0.0":{"name":"@bun-win32/mfplat","version":"2.0.0","keywords":["bun","ffi","win32","windows","mfplat","bindings","typescript","dll"],"author":"Stev Peifer <stev.p@outlook.com>","license":"MIT","_id":"@bun-win32/mfplat@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":"4b66d43371f6cc634f19d61eccf388f62c8181a3","tarball":"https://registry.npmjs.org/@bun-win32/mfplat/-/mfplat-2.0.0.tgz","fileCount":6,"integrity":"sha512-BZotm8WywZS85XVZ5CdTkyUPgdhvtJa5Dap1PmUG1OG7ZOTe0T8U4Y/GXz79NQDKOktOGfxIKuW/iwjb29MCUQ==","signatures":[{"sig":"MEUCIQCBZMk9UNhstChxTSLTe8tNlYWZVIrHwODbcU7ZTmZK4QIgLUFHtuXXw7ialEZ+2K9BnW5yeX7EeoDKufzEzog31VY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":82500},"main":"./index.ts","type":"module","module":"index.ts","shasum":"4b66d43371f6cc634f19d61eccf388f62c8181a3","engines":{"bun":">=1.1.0"},"exports":{".":"./index.ts"},"private":false,"scripts":{"example:mft-transform-census":"bun ./example/mft-transform-census.ts","example:mfplat-platform-probe":"bun ./example/mfplat-platform-probe.ts"},"_npmUser":{"name":"obscuritysrl","email":"stev.p@outlook.com"},"_integrity":"sha512-BZotm8WywZS85XVZ5CdTkyUPgdhvtJa5Dap1PmUG1OG7ZOTe0T8U4Y/GXz79NQDKOktOGfxIKuW/iwjb29MCUQ==","repository":{"url":"git://github.com/ObscuritySRL/bun-win32.git","type":"git","directory":"packages/mfplat"},"_npmVersion":"10.8.3","description":"Zero-dependency, zero-overhead Win32 MFPLAT 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/mfplat_2.0.0_1782435329415_0.6579090055608767","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 MFPLAT bindings for Bun (FFI) on Windows.","devDependencies":{"@types/bun":"latest"},"exports":{".":"./index.ts"},"license":"MIT","module":"index.ts","name":"@bun-win32/mfplat","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/mfplat"},"type":"module","version":"2.0.1","main":"./index.ts","keywords":["bun","ffi","win32","windows","mfplat","bindings","typescript","dll"],"sideEffects":false,"engines":{"bun":">=1.1.0"},"scripts":{"example:mfplat-platform-probe":"bun ./example/mfplat-platform-probe.ts","example:mft-transform-census":"bun ./example/mft-transform-census.ts"},"_id":"@bun-win32/mfplat@2.0.1","_integrity":"sha512-4KyI52CSLOnlFaQtk4/qO5FyQhUc+LLAVyeIMP4CaMh+tLY5ro0+6u5xpTDh/B5iee0OEl6NJMbJB/NRC9OgiQ==","_nodeVersion":"26.3.0","_npmVersion":"10.8.3","shasum":"e05aa6151417fc7de0f152af49296fbef362e3ad","dist":{"integrity":"sha512-4KyI52CSLOnlFaQtk4/qO5FyQhUc+LLAVyeIMP4CaMh+tLY5ro0+6u5xpTDh/B5iee0OEl6NJMbJB/NRC9OgiQ==","shasum":"e05aa6151417fc7de0f152af49296fbef362e3ad","tarball":"https://registry.npmjs.org/@bun-win32/mfplat/-/mfplat-2.0.1.tgz","fileCount":6,"unpackedSize":82500,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDeJD1gF5Ki4pfnaDH7xv/2T2B0tCfOIqquFRRJQ/uy2wIhAKd/zi6ayw5ko2QWdzjr7ciEzhzS91s/UormZp385xg+"}]},"_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/mfplat_2.0.1_1782438124628_0.05012964426255895"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-22T14:26:19.837Z","modified":"2026-06-26T01:42:04.985Z","1.0.0":"2026-04-22T14:26:20.093Z","2.0.0":"2026-06-26T00:55:29.549Z","2.0.1":"2026-06-26T01:42:04.765Z"},"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","mfplat","bindings","typescript","dll"],"repository":{"type":"git","url":"git://github.com/ObscuritySRL/bun-win32.git","directory":"packages/mfplat"},"description":"Zero-dependency, zero-overhead Win32 MFPLAT bindings for Bun (FFI) on Windows.","maintainers":[{"name":"obscuritysrl","email":"stev.p@outlook.com"}],"readme":"# @bun-win32/mfplat\n\nZero-dependency, zero-overhead Win32 Mfplat bindings for [Bun](https://bun.sh) on Windows.\n\n## Overview\n\n`@bun-win32/mfplat` exposes the documented `mfplat.dll` exports using [Bun](https://bun.sh)'s FFI. It provides a single class, `Mfplat`, which lazily binds native symbols on first use. You can optionally preload a subset or all symbols up-front via `Preload()`.\n\n`mfplat.dll` is the platform layer of Microsoft Media Foundation — it owns the MF runtime lifecycle (`MFStartup` / `MFShutdown`), the system clock (`MFGetSystemTime`), the MF work-queue thread pool (`MFAllocateWorkQueue`, `MFPutWorkItem`), and the foundational factory entry points for media types, attributes, samples, byte streams, events, async results, and the Media Foundation Transform (MFT) registry (`MFTEnumEx`, `MFTRegister*`). The 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 `mfplat.dll` (Media Foundation platform layer: lifecycle, clock, work queues, MFT registry, media-type / sample / byte-stream / event factories).\n- In-source docs in `structs/Mfplat.ts` with links to Microsoft Learn.\n- Lazy binding on first call; optional eager preload (`Mfplat.Preload()`).\n- No wrapper overhead; calls map 1:1 to native exports.\n- Strongly-typed COM pointer aliases for `IMFAttributes`, `IMFMediaType`, `IMFSample`, `IMFMediaBuffer`, `IMFByteStream`, `IMFActivate`, `IMFAsyncResult`, `IMFMediaEvent`, `IMFDXGIDeviceManager`, and factory parameters (see `types/Mfplat.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/mfplat\n```\n\n## Quick Start\n\n```ts\nimport Mfplat from '@bun-win32/mfplat';\n\nMfplat.Preload(['MFStartup', 'MFShutdown', 'MFCreateAttributes']);\n\nconst MF_VERSION = 0x0002_0070;\nconst MFSTARTUP_LITE = 0x1;\n\nconst startHr = Mfplat.MFStartup(MF_VERSION, MFSTARTUP_LITE);\nif (startHr === 0) {\n  const attrsOut = Buffer.alloc(8);\n  const createHr = Mfplat.MFCreateAttributes(attrsOut.ptr, 4);\n  if (createHr === 0) {\n    const attributes = attrsOut.readBigUInt64LE(0);\n    console.log(`IMFAttributes @ 0x${attributes.toString(16)}`);\n  }\n  Mfplat.MFShutdown();\n}\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:mft-transform-census\nbun run example:mfplat-platform-probe\n```\n\n## Notes\n\n- Either rely on lazy binding or call `Mfplat.Preload()`.\n- Most `MFCreate*` / `MFT*` / work-queue entry points require `ole32!CoInitializeEx` (STA or MTA) and `Mfplat.MFStartup(MF_VERSION)` up-front. Pair them with `MFShutdown` + `CoUninitialize` on exit.\n- Constants: `MF_VERSION = 0x0002_0070`, `MFSTARTUP_LITE = 0x1` (or `MFSTARTUP_FULL = 0x0` to include socket/network activation). See `types/Mfplat.ts`.\n- The returned `IMFAttributes` / `IMFMediaType` / `IMFSample` / `IMFActivate` / `IMFByteStream` objects are COM interfaces. Drive them through their vtable (see `example/mft-transform-census.ts` for a `GetAllocatedString` walkthrough and `example/mfplat-platform-probe.ts` for `IMFAttributes::Set/GetUINT32` and `IMFSample::AddBuffer`).\n- `MFTEnumEx` returns a `CoTaskMemAlloc`'d array of `IMFActivate*`. Release each activate via its vtable, then free the outer array with `ole32!CoTaskMemFree`.\n- 25 exports from `mfplat.dll` are forwarders into `RTWorkQ.dll` (MFAllocateWorkQueue, MFScheduleWorkItem, etc.). Bun's loader resolves them transparently — no special handling required.\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"}