@mediaway/ffi 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +51 -0
- package/dist/index.js +28 -0
- package/native/mediaway_ffi.dll +0 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -35,6 +35,9 @@ export declare const MwCameraConfig: TypeObject;
|
|
|
35
35
|
export declare const MwCameraFrame: TypeObject;
|
|
36
36
|
export declare const MwDesktopConfig: TypeObject;
|
|
37
37
|
export declare const MwDesktopFrame: TypeObject;
|
|
38
|
+
export declare const MwGpuAdapterInfo: TypeObject;
|
|
39
|
+
export declare const MwGpuAdapterSelect: TypeObject;
|
|
40
|
+
export declare const MwGpuDeviceOptions: TypeObject;
|
|
38
41
|
export declare const MwAudioConfig: TypeObject;
|
|
39
42
|
export declare const MwAudioFrame: TypeObject;
|
|
40
43
|
export declare const MwAudioEncodeConfig: TypeObject;
|
|
@@ -166,6 +169,8 @@ export declare const pipeline: {
|
|
|
166
169
|
audioDecodeSessionFlush: import("koffi").Callable;
|
|
167
170
|
audioDecodeSessionClose: import("koffi").Callable;
|
|
168
171
|
decodedAudioFrameFree: import("koffi").Callable;
|
|
172
|
+
sessionWriteFrameFromCameraCapture: import("koffi").Callable;
|
|
173
|
+
sessionWriteFrameFromDesktopCapture: import("koffi").Callable;
|
|
169
174
|
};
|
|
170
175
|
export declare const device: {
|
|
171
176
|
abiVersion: import("koffi").Callable;
|
|
@@ -190,6 +195,11 @@ export declare const device: {
|
|
|
190
195
|
audioPollFrame: import("koffi").Callable;
|
|
191
196
|
audioClose: import("koffi").Callable;
|
|
192
197
|
audioFrameFree: import("koffi").Callable;
|
|
198
|
+
gpuAdapterList: import("koffi").Callable;
|
|
199
|
+
gpuAdapterListFree: import("koffi").Callable;
|
|
200
|
+
gpuDeviceCreate: import("koffi").Callable;
|
|
201
|
+
gpuDeviceHandle: import("koffi").Callable;
|
|
202
|
+
gpuDeviceClose: import("koffi").Callable;
|
|
193
203
|
};
|
|
194
204
|
/** Copy `len` bytes out of a koffi pointer/opaque handle. */
|
|
195
205
|
export declare function copyBytes(ptr: unknown, len: number): Buffer;
|
|
@@ -290,6 +300,20 @@ export interface RawCameraFrame {
|
|
|
290
300
|
data: unknown;
|
|
291
301
|
data_len: number;
|
|
292
302
|
}
|
|
303
|
+
/** `mediaway_desktop_frame_t` (Screen output) — unlike `RawCameraFrame`, GPU
|
|
304
|
+
* storage (`storage_kind == 1`) leaves `data`/`data_len` empty and carries the
|
|
305
|
+
* frame in `gpu_buffer` instead (borrowed — never freed by the caller). */
|
|
306
|
+
export interface RawDesktopFrame {
|
|
307
|
+
pts: bigint | number;
|
|
308
|
+
duration: bigint | number;
|
|
309
|
+
width: number;
|
|
310
|
+
height: number;
|
|
311
|
+
pixel_format: number;
|
|
312
|
+
storage_kind: number;
|
|
313
|
+
data: unknown;
|
|
314
|
+
data_len: number;
|
|
315
|
+
gpu_buffer: RawGpuBufferHandle;
|
|
316
|
+
}
|
|
293
317
|
export interface RawAudioFrame {
|
|
294
318
|
pts: bigint | number;
|
|
295
319
|
duration: bigint | number;
|
|
@@ -311,6 +335,13 @@ export interface RawPipelineFrame {
|
|
|
311
335
|
raw_bytes_len: number;
|
|
312
336
|
gpu_buffer: RawGpuBufferHandle;
|
|
313
337
|
}
|
|
338
|
+
/** `mediaway_gpu_device_handle_t` (Screen capture / GPU-input encode input,
|
|
339
|
+
* mediaway_gpu_device_handle()'s output). */
|
|
340
|
+
export interface RawGpuDeviceHandle {
|
|
341
|
+
kind: number;
|
|
342
|
+
native: number | bigint;
|
|
343
|
+
webgpu_device_id: number | bigint;
|
|
344
|
+
}
|
|
314
345
|
/** `mediaway_gpu_buffer_handle_t`. */
|
|
315
346
|
export interface RawGpuBufferHandle {
|
|
316
347
|
kind: number;
|
|
@@ -403,3 +434,23 @@ export interface RawDecodedAudioFrame {
|
|
|
403
434
|
data: unknown;
|
|
404
435
|
data_len: number;
|
|
405
436
|
}
|
|
437
|
+
/** `mediaway_gpu_adapter_info_t` (mediaway-device ADR-0007). */
|
|
438
|
+
export interface RawGpuAdapterInfo {
|
|
439
|
+
index: number;
|
|
440
|
+
name: string;
|
|
441
|
+
vendor_id: number;
|
|
442
|
+
device_id: number;
|
|
443
|
+
dedicated_video_memory: bigint | number;
|
|
444
|
+
is_hardware: boolean;
|
|
445
|
+
}
|
|
446
|
+
/** `mediaway_gpu_adapter_select_t`. */
|
|
447
|
+
export interface RawGpuAdapterSelect {
|
|
448
|
+
kind: number;
|
|
449
|
+
index: number;
|
|
450
|
+
}
|
|
451
|
+
/** `mediaway_gpu_device_options_t`. */
|
|
452
|
+
export interface RawGpuDeviceOptions {
|
|
453
|
+
adapter: RawGpuAdapterSelect;
|
|
454
|
+
video_support: boolean;
|
|
455
|
+
debug_layer: boolean;
|
|
456
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -199,6 +199,23 @@ export const MwDesktopFrame = koffi.struct("MwDesktopFrame", {
|
|
|
199
199
|
data_len: "size_t",
|
|
200
200
|
gpu_buffer: MwGpuBufferHandle,
|
|
201
201
|
});
|
|
202
|
+
export const MwGpuAdapterInfo = koffi.struct("MwGpuAdapterInfo", {
|
|
203
|
+
index: "uint32",
|
|
204
|
+
name: "str", // owned NUL-terminated UTF-8; freed via gpuAdapterListFree, not per-entry
|
|
205
|
+
vendor_id: "uint32",
|
|
206
|
+
device_id: "uint32",
|
|
207
|
+
dedicated_video_memory: "uint64",
|
|
208
|
+
is_hardware: "bool",
|
|
209
|
+
});
|
|
210
|
+
export const MwGpuAdapterSelect = koffi.struct("MwGpuAdapterSelect", {
|
|
211
|
+
kind: "int32", // 0 = Default, 1 = Index
|
|
212
|
+
index: "uint32", // meaningful only when kind == Index
|
|
213
|
+
});
|
|
214
|
+
export const MwGpuDeviceOptions = koffi.struct("MwGpuDeviceOptions", {
|
|
215
|
+
adapter: MwGpuAdapterSelect,
|
|
216
|
+
video_support: "bool",
|
|
217
|
+
debug_layer: "bool",
|
|
218
|
+
});
|
|
202
219
|
export const MwAudioConfig = koffi.struct("MwAudioConfig", {
|
|
203
220
|
device_index: "uint32",
|
|
204
221
|
time_base: MwRational,
|
|
@@ -422,6 +439,11 @@ export const pipeline = {
|
|
|
422
439
|
audioDecodeSessionFlush: pipelineLib.func("int mediaway_audio_decode_session_flush(void *session)"),
|
|
423
440
|
audioDecodeSessionClose: pipelineLib.func("void mediaway_audio_decode_session_close(void *session)"),
|
|
424
441
|
decodedAudioFrameFree: pipelineLib.func("void mediaway_decoded_audio_frame_free(MwDecodedAudioFrame *frame)"),
|
|
442
|
+
// ── Capture-to-encode bridge (adr/pipeline/0005-capture-encode-bridge-c-abi.md) ──
|
|
443
|
+
// Pushes one polled frame from a device.h capture handle straight into a
|
|
444
|
+
// session — no intermediate MwCameraFrame/MwDesktopFrame, no extra copy.
|
|
445
|
+
sessionWriteFrameFromCameraCapture: pipelineLib.func("int mediaway_encode_session_write_frame_from_camera_capture(void *session, void *capture, _Out_ bool *out_wrote_frame)"),
|
|
446
|
+
sessionWriteFrameFromDesktopCapture: pipelineLib.func("int mediaway_encode_session_write_frame_from_desktop_capture(void *session, void *capture, _Out_ bool *out_wrote_frame)"),
|
|
425
447
|
};
|
|
426
448
|
// ── Device functions ───────────────────────────────────────────────────────────
|
|
427
449
|
export const device = {
|
|
@@ -447,6 +469,12 @@ export const device = {
|
|
|
447
469
|
audioPollFrame: deviceLib.func("int mediaway_audio_capture_poll_frame(void *capture, _Out_ MwAudioFrame *out_frame, _Out_ bool *out_has)"),
|
|
448
470
|
audioClose: deviceLib.func("int mediaway_audio_capture_close(void *capture)"),
|
|
449
471
|
audioFrameFree: deviceLib.func("void mediaway_audio_frame_free(MwAudioFrame *frame)"),
|
|
472
|
+
// ── GPU device factory (mediaway-device ADR-0007) ─────────────────────────
|
|
473
|
+
gpuAdapterList: deviceLib.func("int mediaway_gpu_adapter_list(_Out_ MwGpuAdapterInfo **out_adapters, _Out_ size_t *out_count)"),
|
|
474
|
+
gpuAdapterListFree: deviceLib.func("void mediaway_gpu_adapter_list_free(MwGpuAdapterInfo *adapters, size_t count)"),
|
|
475
|
+
gpuDeviceCreate: deviceLib.func("int mediaway_gpu_device_create(MwGpuDeviceOptions *options, _Out_ void **out_device)"),
|
|
476
|
+
gpuDeviceHandle: deviceLib.func("int mediaway_gpu_device_handle(void *device, _Out_ MwGpuDeviceHandle *out_handle)"),
|
|
477
|
+
gpuDeviceClose: deviceLib.func("void mediaway_gpu_device_close(void *device)"),
|
|
450
478
|
};
|
|
451
479
|
// ── Copy helpers ───────────────────────────────────────────────────────────────
|
|
452
480
|
/** Copy `len` bytes out of a koffi pointer/opaque handle. */
|
package/native/mediaway_ffi.dll
CHANGED
|
Binary file
|
package/package.json
CHANGED